为什么我要清理基于文件的变量00:01错误:作业失败:Gitlab Pipeline创建中的退出代码1
提交消息 - 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
脚本
块中的最后一步是退出1
。 Gitlab CI将失败任何具有退出代码的工作> 0。commit-message-validator
当前没有进行任何检查,它只是调用echo
3次。如果您希望它检查修复,专长,专业,次要
,则需要在脚本
块中写入一些逻辑。The last step in your
script
block isexit 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 callsecho
3 times. If you want it to check forfix, feat, major, minor
you will need to do write some logic in thescript
block to do so.