Reputation: 6136
I have a CI that runs when a tag is created, but I would like to be able to run it manually as well. Unfortunately, the CI uses the tag name to set the name of the artifact.
I tried this:
stages:
- build
workflow:
rules:
- if: $CI_COMMIT_TAG
- if: $CI_JOB_MANUAL
variables:
- CI_COMMIT_TAG: "manual"
build_app:
script:
- echo "Build completed"
artifacts:
expire_in: 30 days
paths:
- .
name: "app-$CI_COMMIT_TAG"
What I would like is:
git tag v2.4.1 && git push --tags
, it should create the artifact app-v2.4.1.zip
.app-manual.zip
.Unfortunately, I can't run it manually (Pipelines --> Run Pipeline) because "Pipeline filtered out by workflow rules."
How to fix my CI?
Upvotes: -1
Views: 498
Reputation: 6136
Instead of $CI_JOB_MANUAL
, you have to use $CI_PIPELINE_SOURCE
and compare it to "web"
. Here is the complete file:
stages:
- build
workflow:
rules:
- if: $CI_COMMIT_TAG
- if: '$CI_PIPELINE_SOURCE == "web"'
variables:
- CI_COMMIT_TAG: "manual"
build_app:
script:
- echo "Build completed"
artifacts:
expire_in: 30 days
paths:
- .
name: "app-$CI_COMMIT_TAG"
Upvotes: 0