Reputation: 531
How does my YAML file have to be configured so that the pipeline for the one case (job: build) is only triggered when a tag is pushed. This tag may be in all branches except master. For the master case I have a separate job (build_master).
yaml file: Problem: If the master branch gets a tag, the pipeline will be run via "build". that should not happen. Nothing should happen
before_script:
- xcopy /y /s "C:/stuff" "%CI_PROJECT_DIR%"
stages:
- build
- deploy
build:
stage: build
script:
- build.cmd
artifacts:
expire_in: 1 week
name: "%CI_COMMIT_REF_NAME%"
paths:
- "%CI_COMMIT_REF_NAME%"
only:
- tags
except:
- master
build_master:
stage: build
script:
- buildm.cmd
artifacts:
expire_in: 1 week
name: "%CI_COMMIT_REF_NAME%"
paths:
- "%CI_COMMIT_REF_NAME%"
only:
- master
deploy:
stage: deploy
script:
- ./upload.cmd
dependencies:
- build_master
only:
- master
Upvotes: 2
Views: 2404
Reputation: 1067
It's not a bug it's a feature.
In Git we do not create tags on branches. This is why this doesn't work. A tag is a reference to a commit / SHA and commit / SHA can exist on multiple branches
Upvotes: 5