我有这个在 gitlab-ci.yml
build_api:
stage: build
script:
- docker build --pull -t $CONTAINER_TEST_IMAGE .
- docker push $CONTAINER_TEST_IMAGE
only:
----> variables: <----- Error
- $CI_COMMIT_MESSAGE == /\[pipeline\]|(merge)/i
except:
- master
在 gitlab 的 CI Lint 中说
*Error* : jobs:build_api:only variables invalid expression syntax
为什么是它的原因?
最佳答案
看看这个页面:https://docs.gitlab.com/ce/ci/variables/README.html#variables-expressions
看来你得用=~
匹配模式时。
尝试
- $CI_COMMIT_MESSAGE =~ /\[pipeline\]|(merge)/i
双等于
==
只接受字符串、空值或变量。
关于continuous-integration - yml gitlab CI/CD 中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51215462/