59 lines
1.3 KiB
YAML
59 lines
1.3 KiB
YAML
# context_rules.yml
|
|
# Pipeline exercising context-aware rules evaluation.
|
|
# Expected behaviour per context:
|
|
# (no context) → lints clean, all jobs visible
|
|
# --branch main → build, test, deploy-prod active; deploy-staging/release-notes skipped
|
|
# --branch develop → build, test, deploy-staging active; deploy-prod/release-notes skipped
|
|
# --branch feat/my-feat → build, test active; deploy-staging manual; deploy-prod/release-notes skipped
|
|
# --tag v1.0.0 → build, test, deploy-prod, release-notes active; deploy-staging skipped
|
|
|
|
stages:
|
|
- build
|
|
- test
|
|
- deploy
|
|
|
|
build:
|
|
stage: build
|
|
script:
|
|
- make build
|
|
rules:
|
|
- when: always
|
|
|
|
test:
|
|
stage: test
|
|
script:
|
|
- make test
|
|
rules:
|
|
- when: always
|
|
|
|
deploy-staging:
|
|
stage: deploy
|
|
script:
|
|
- make deploy ENV=staging
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == "develop"
|
|
when: on_success
|
|
- if: $CI_COMMIT_BRANCH =~ /^feat\//
|
|
when: manual
|
|
- when: never
|
|
|
|
deploy-prod:
|
|
stage: deploy
|
|
script:
|
|
- make deploy ENV=production
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == "main"
|
|
when: on_success
|
|
- if: $CI_COMMIT_TAG != null
|
|
when: on_success
|
|
- when: never
|
|
|
|
release-notes:
|
|
stage: deploy
|
|
script:
|
|
- make release
|
|
rules:
|
|
- if: $CI_COMMIT_TAG != null
|
|
when: on_success
|
|
- when: never
|