为什么我要清理基于文件的变量00:01错误:作业失败:Gitlab Pipeline创建中的退出代码1

发布于 2025-02-02 22:49:18 字数 593 浏览 2 评论 0原文

提交消息 - validator: 阶段:验证通用消息 脚本: - 回声“ $ CI_COMMIT_MESSAGE” - 回声“ $ ci_commit_branch” - 回声“检查提交消息的前缀应具有'fix'||'feat'||'||'major'||'minor'的一个' - 退出1

规则: - 如果:$ ci_commit_message =〜 /fix: / 时间:永远 - 如果:$ ci_commit_message =〜/feat:/ 时间:永远 - 如果:$ CI_COMMIT_MESSAGE =〜 /MARIA: / 时间:永远 - 如果:$ CI_COMMIT_MESSAGE =〜/Minor:/ 时间:永远 - 如果:“ $ CI_COMMIT_MESSAGE =〜 /^CHORE \(RELEASE \):.*/” 时间:永远 - 如果:$ ci_commit_branch == $ ci_default_branch 时间:永远 - 何时:总是

在此处输入图像描述

commit-message-validator:
stage: validate-commit-message
script:
- echo "$CI_COMMIT_MESSAGE"
- echo "$CI_COMMIT_BRANCH"
- echo "check the Prefix of the commit message should have one of 'fix' || 'feat' || 'major' || 'minor' in case sensitive"
- exit 1

rules:
- if: $CI_COMMIT_MESSAGE =~ /fix:/
when: never
- if: $CI_COMMIT_MESSAGE =~ /feat:
/
when: never
- if: $CI_COMMIT_MESSAGE =~ /major:/
when: never
- if: $CI_COMMIT_MESSAGE =~ /minor:
/
when: never
- if: "$CI_COMMIT_MESSAGE =~ /^chore\(release\):.*/"
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: never
- when: always

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ヅ她的身影、若隐若现 2025-02-09 22:49:18

脚本块中的最后一步是退出1。 Gitlab CI将失败任何具有退出代码的工作> 0。

commit-message-validator当前没有进行任何检查,它只是调用echo 3次。如果您希望它检查修复,专长,专业,次要,则需要在脚本块中写入一些逻辑。

The last step in your script block is exit 1. Gitlab CI will fail any job that has an exit code > 0.

The commit-message-validator job doesn't currently do any checks, it simply calls echo 3 times. If you want it to check for fix, feat, major, minor you will need to do write some logic in the script block to do so.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文