Use more elaborate "rules" in GitLab CI/CD configuration
Description
GitLab has recently introduced rules to the GitLab CI/CD configuration. rules
is meant to replace except/only
and is much more capable. In particular, we can run certain jobs based on changes to specific source files, which should come in handy with the Docker image jobs.
Proposal
-
Run
setup
andprep
jobs when respective files change:setup:dune-env: &setup stage: setup rules: - changes: - docker/dune-env.dockerfile # ... prep:update-dune: &update <<: *setup stage: prep allow_failure: true rules: # Run after pushes to master and tags - if: '$CI_COMMIT_BRANCH == "master"' - if: $CI_COMMIT_TAG # Run after Dockerfile changed. Do not allow failure then. - changes: - docker/dune-env-update.dockerfile allow_failure: false
-
Add empty
needs
fortest:python-tests
, as https://gitlab.com/gitlab-org/gitlab/-/issues/30631 is resolved.
How to test the implementation?
- Pipeline passes regularly.
- Changes to Dockerfiles trigger jobs.