I’m trying to allow manually execute specific pipeline from same project. I came up with the idea that I can use user-defined variables in UI to filter which pipeline to run based on branches. Also I would like to set variables based on pipeline.
variables:
PIPELINE_TO_RUN:
value: "none"
options:
- 1
- 2
- 3
- 4
- none
description: "Choose the pipeline to run. No default value. Required"
AWS_REGION: $AWS_DEFAULT_REGION
AWS_WEB_IDENTITY_TOKEN_FILE: /tmp/web-identity-token
include:
- local: .gitlab/ci/1.yml
rules:
- if: $CI_COMMIT_BRANCH == "pipeline-1"
- local: .gitlab/ci/2.yml
rules:
- if: $CI_COMMIT_BRANCH == "pipeline-2"
pipeline1:
stage: execute
script:
- echo "done"
rules:
- if: '$PIPELINE_TO_RUN == "1"'
when: always
- when: never
Included file looks like this:
variables:
VAR1:
value: "1"
options:
- "1"
- "2"
description: "123"
VAR2:
description: "321"
VAR3:
value: 2
options:
- 2
- 3
- 4
description: "123123"
And it actually works except I do not see variables in UI from included file. But if I remove rules section I do see variables based on branch.
Self-managed gitlab 17.2
Do you have any ideas?