仅当有新标签时才触发 Gitlab-CI Pipeline [英] Trigger Gitlab-CI Pipeline only when there is a new tag
本文介绍了仅当有新标签时才触发 Gitlab-CI Pipeline的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下 gitlab-ci conf.文件:
I have following gitlab-ci conf. file:
before_script:
- echo %CI_BUILD_REF%
- echo %CI_PROJECT_DIR%
stages:
- createPBLs
- build
- package
create PBLs:
stage: createPBLs
script:
- xcopy /y /s "%CI_PROJECT_DIR%" "C:Bauen"
- cd "C:Bauen"
- ./run_orcascript.cmd
build:
stage: build
script:
- cd "C:Bauen"
- ./run_pbc.cmd
except:
- master
build_master:
stage: build
script:
- cd "C:Bauen"
- ./run_pbcm.cmd
only:
- master
package:
stage: package
script:
- cd "C:Bauen"
- ./cpfiles.cmd
artifacts:
expire_in: 1 week
name: "%CI_COMMIT_REF_NAME%"
paths:
- GitLab-Build
如何添加规则,即只有在分支中添加了新标签时,管道才会触发?标签应以Ticket/ticket_"开头
How can I add the rule that the pipeline will ONLY trigger if a new tag has been added to a branch? The tag should start with "Ticket/ticket_"
目前他正在为每一次推动而建设.
Currently he is building for every push.
推荐答案
我建议在 varibles-expression
中使用模式 using commits
I recommend to use pattern in varibles-expression
using commits
例子
build_api:
stage: build
script:
- docker build --pull -t $CONTAINER_TEST_IMAGE .
- docker push $CONTAINER_TEST_IMAGE
only:
variables:
- $CI_COMMIT_MESSAGE =~ /([pipeline]|(merge))/
我是说 only
在提交中有 [pipeline] 或 merge 时执行该作业.更多信息,在这里gitlab
Here i am saying that only
execute that job when have [pipeline] or merge inside the commit. More info, here in
gitlab
这篇关于仅当有新标签时才触发 Gitlab-CI Pipeline的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文