cloudflare/cloudflared
Publicmirrored from https://github.com/cloudflare/cloudflaredAvailable
.ci/commons.gitlab-ci.yml
53lines · modecode
| 1 | ## A set of predefined rules to use on the different jobs |
| 2 | .default-rules: |
| 3 | # Rules to run the job only on the master branch |
| 4 | run-on-master: |
| 5 | - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH |
| 6 | when: always |
| 7 | - when: never |
| 8 | # Rules to run the job only on merge requests |
| 9 | run-on-mr: |
| 10 | - if: $CI_COMMIT_TAG |
| 11 | when: never |
| 12 | - if: $CI_PIPELINE_SOURCE == "merge_request_event" |
| 13 | when: always |
| 14 | - when: never |
| 15 | # Rules to run the job on merge_requests and master branch |
| 16 | run-always: |
| 17 | - if: $CI_COMMIT_TAG |
| 18 | when: never |
| 19 | - if: $CI_PIPELINE_SOURCE == "merge_request_event" |
| 20 | - if: $CI_COMMIT_BRANCH != null && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH |
| 21 | when: always |
| 22 | - when: never |
| 23 | |
| 24 | # This before_script is injected into every job that runs on master meaning that if there is no tag the step |
| 25 | # will succeed but only write "No tag present - Skipping" to the console. |
| 26 | .check-tag: |
| 27 | before_script: |
| 28 | - | |
| 29 | # Check if there is a Git tag pointing to HEAD |
| 30 | echo "Tag found: $(git tag --points-at HEAD | grep .)" |
| 31 | if git tag --points-at HEAD | grep .; then |
| 32 | echo "Tag found: $(git tag --points-at HEAD | grep .)" |
| 33 | export "VERSION=$(git tag --points-at HEAD | grep .)" |
| 34 | else |
| 35 | echo "No tag present — skipping." |
| 36 | exit 0 |
| 37 | fi |
| 38 | |
| 39 | .component-tests: |
| 40 | image: $BUILD_IMAGE |
| 41 | rules: |
| 42 | - !reference [.default-rules, run-always] |
| 43 | variables: |
| 44 | COMPONENT_TESTS_CONFIG: component-test-config.yaml |
| 45 | COMPONENT_TESTS_CONFIG_CONTENT: Y2xvdWRmbGFyZWRfYmluYXJ5OiBjbG91ZGZsYXJlZC5leGUKY3JlZGVudGlhbHNfZmlsZTogY3JlZC5qc29uCm9yaWdpbmNlcnQ6IGNlcnQucGVtCnpvbmVfZG9tYWluOiBhcmdvdHVubmVsdGVzdC5jb20Kem9uZV90YWc6IDQ4Nzk2ZjFlNzBiYjc2NjljMjliYjUxYmEyODJiZjY1 |
| 46 | secrets: |
| 47 | DNS_API_TOKEN: |
| 48 | vault: gitlab/cloudflare/tun/cloudflared/_dev/_terraform_atlantis/component_tests_token/data@kv |
| 49 | file: false |
| 50 | COMPONENT_TESTS_ORIGINCERT: |
| 51 | vault: gitlab/cloudflare/tun/cloudflared/_dev/component_tests_cert_pem/data@kv |
| 52 | file: false |
| 53 | cache: {} |
| 54 | |