gitlab 构建tag,GitLab CI-添加标签时避免构建
发布日期:2021-11-18 06:42:31 浏览次数:1 分类:技术文章

本文共 2014 字,大约阅读时间需要 6 分钟。

How do I prevent a gitlab ci pipeline being triggered when I add a git tag? I'm running this command locally (as opposed to within a gitlab-ci job)

git tag -a "xyz"

and then pushing the tag; and this triggers various pipelines. I want to exclude some of those pipelines from running.

I'm trying variations on ideas from questions such as this; that question is using only, I'm wanting to exclude, so I'm trying except. The answers there have two variants, one with refs one without.

build:

# ... my work here ...

except:

- tags

build:

# ... my work here ...

except:

refs:

- tags

Neither seem to have any effect; I add a tag, the build still happens.

My understanding may be completely awry here as there seem to be three possible meanings of the word tags and when reading docs or examples I'm not always sure which meaning is applicable:

Git tags applied using git tag

Gitlab CI tags used to determine which runners pick a job

The ref identifier of a commit used to trigger a pipeline via the REST API. This is usually a branch name, but could be a git tag.

I'm interested in controlling what happens if the first case. It does seem clear from comments so far that "except: -tags" is not relevant to my case, so is there any approach that does work?

解决方案

Except tags is exactly what you should use if you want to skip build for tags.

You need to be sure to understand commit vs branches vs tags

To illustrate what happens when you push tagged commit to gitlab I did as follows:

Created .gitlab-ci.yml with following content:

tests_always_run:

script:

- echo I should always execute

tests_except_tags:

script:

- echo I skip tagged triggers

except:

- tags

Commited changes, tagged commit and pushed with --follow-tags to make sure tag is also propagated to server:

git add .gitlab-ci.yml

git commit -m 'my great yml with except tags'

git tag -a "abc" -m "Test tag"

git push --follow-tags

Ilustrated results:

fbb6eccc81395de265d34c1c01a8d1ff.png

If you want to skip CI for selected commit then you could use git push -o ci.skip, inspired by this article

转载地址:https://blog.csdn.net/weixin_33648352/article/details/118804855 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:mysql错误代码1054,MySQL错误#1054-“字段列表”中的未知列
下一篇:anaconda安装不同版本python,如何在Anaconda中为不同的Python版本安装软件包?

发表评论

最新留言

网站不错 人气很旺了 加油
[***.192.178.218]2024年03月30日 12时08分07秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章

大疆机甲大师教育机器人Python开发:API中文化初尝试 2019-04-26
大疆机甲大师Python开发: 两只老虎 2019-04-26
大疆机甲大师教育机器人Python API中文化之一:枪亮枪暗 2019-04-26
大疆机甲大师教育机器人Python API中文化之二:LED闪烁 2019-04-26
大疆 RoboMaster 机甲大师官方刚刚开通”机甲小 S 实验室”知乎专栏 2019-04-26
大疆机甲大师教育机器人Python API中文化之三:底盘灯效 2019-04-26
大疆机甲大师教育机器人Python API中文化之四五:云台灯效,指定序号 2019-04-26
大疆机甲大师教育机器人Python API中文化之六:关灯 2019-04-26
“中文编程”知乎专栏两岁了——山雨欲来风满楼 2019-04-26
大疆机甲大师Python API之七:做个闹钟 2019-04-26
【意外走向】大疆机甲大师Python API之八:计时——为性能测试展开1000次循环 2019-04-26
RFC#2457——Rust 语言支持非 ASCII 码标识符在 GitHub 引发的激辩(一) 2019-04-26
RFC#2457——Rust 语言选择支持非 ASCII 码标识符在 GitHub 引发的激辩(二) 2019-04-26
”为什么有这么多人执着于中文编程?”回答两千赞留念及回应 2019-04-26
【家务】盘点小孩玩具零件缺失情况 2019-04-26
开发中文 API 的一些策略 2019-04-26
从日本编程书籍《我的第一本编程书》中译版看中文例程如何扬长避短——标识符(一) 2019-04-26
中文命名标识符如何区分类型和变量 2019-04-26
编程术语成系统中文化的意义 2019-04-26
草蟒 Python 中文 API 与 IDE 支持尝鲜 2019-04-26