Difference between revisions of "GitLab rules:"
Jump to navigation
Jump to search
(Created page with " myjob: rules: - if: $CI_MERGE_REQUEST_ID when: always - when: never script: - echo "Test" * {{GitLab CI}}") |
|||
(10 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | |||
+ | https://docs.gitlab.com/ee/ci/yaml/#rules | ||
+ | |||
myjob: | myjob: | ||
rules: | rules: | ||
− | - if: $CI_MERGE_REQUEST_ID | + | - [[if:]] $CI_MERGE_REQUEST_ID |
when: always | when: always | ||
- when: never | - when: never | ||
Line 7: | Line 10: | ||
- echo "Test" | - echo "Test" | ||
+ | Official example (https://docs.gitlab.com/ee/ci/yaml/#rules): | ||
+ | docker build: | ||
+ | script: docker build -t my-image:$CI_COMMIT_REF_SLUG . | ||
+ | rules: | ||
+ | - if: $CI_PIPELINE_SOURCE [[==]] "merge_request_event" | ||
+ | changes: | ||
+ | - Dockerfile | ||
+ | when: manual | ||
+ | allow_failure: true | ||
+ | [[!=]] | ||
+ | [[==]] | ||
+ | |||
+ | == Related == | ||
+ | * [[Prometheus, rules:]] | ||
+ | |||
+ | == See also == | ||
* {{GitLab CI}} | * {{GitLab CI}} | ||
+ | |||
+ | [[Category:GitLab]] |
Latest revision as of 12:59, 10 October 2023
https://docs.gitlab.com/ee/ci/yaml/#rules
myjob: rules: - if: $CI_MERGE_REQUEST_ID when: always - when: never script: - echo "Test"
Official example (https://docs.gitlab.com/ee/ci/yaml/#rules):
docker build: script: docker build -t my-image:$CI_COMMIT_REF_SLUG . rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" changes: - Dockerfile when: manual allow_failure: true
!= ==
Related[edit]
See also[edit]
Advertising: