Skip to content

Add file matching rule to flexible CI rules

Problem to solve

Currently it's not possible to evaluate a project's contents and use only or except logic before running a pipeline. This means that Auto DevOps pipelines run even when they won't add any value (for example on projects using a language with no matching buildpack or projects that host no code).

Intended users

developers

Further details

Proposal

Please rely on the documentation to view the accepted solution

In order to use the same mechanism Auto DevOps uses to detect a project's language (herokuish+buildpacks) and evaluate contents of a project before running a pipeline, a new flexible rule to GitLab CI so that it may look for files or directories in the relevant project. This rule will be similar to changes. This will allow us to Not run Auto DevOps when no dockerfile or matching buildpack exists

I would like to be able to do something like the following for auto devops:

build_dockerfile:
  script:
  - docker build
  rules:
    - local:
      - Dockerfile

build_herokuish:
  script:
  - docker run herokuish
  rules:
  - local:
    - Dockerfile
    when: never
  - if: '$KUBECONFIG'

Or in general we could do other things like:

rake:
  image: ruby
  script:
  - bundle install
  - bundle exec rake
  rules:
  - local:
    - Rakefile

which could replace the herokuish logic for build/test and in theory will be much more performant because it is able to cache the build images. Furthermore it allows us to customise the steps for each language a lot more easily.

Documentation

Testing

What does success look like, and how can we measure that?

TBD

Links / references

https://gitlab.com/gitlab-org/gitlab-ce/issues/57483

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

Edited by 🤖 GitLab Bot 🤖