job made manual by `rules` are not optional
Summary
The documentation says "Optional manual actions have allow_failure: true set by default and their Statuses do not contribute to the overall pipeline status" however,
when a job is made manual by adding when: manual
in a rule, the job is not made optional
Steps to reproduce
image: docker:19.03.2
stages:
- stage1
hello:world:
stage: stage1
rules:
- when: manual
script:
- echo Bonjour World
with this gitlab-ci.yaml, a merge request cannot be merged until the job is manually started because the manual job is blocking the pipeline.
compared to this configuration:
image: docker:19.03.2
stages:
- stage1
hello:world:
stage: stage1
rules:
- when: manual
script:
- echo Bonjour World
where the merge request can be merged immediately
I could add allow_failure: true
but it would be applied to each rule and that's not what I want, for exemple consider this gitlab-ci.yaml:
image: docker:19.03.2
stages:
- deploy
- build
build:api:
stage: build
rules:
- if: '$CI_PROJECT_PATH == "upstream/project" && $CI_COMMIT_REF_NAME == "prod"'
when: always
- changes:
- api/*
when: always
- when: manual
script:
- docker stack deploy ...
deploy:demo:
stage: deploy
needs: [build:api]
rules:
- if: '$CI_PROJECT_PATH == "upstream/project"'
when: never
- when: manual
script:
- docker stack deploy ...
here on a merge request I want to run build:api only if code has changed in the api folder or manual to deploy a demo environment. if code has changed, the merge request should not be mergeable if the automatic build fails. but if there's no code changes, the merge request should be mergeable without running the build:api job