【问题标题】:Error in yml gitlab CI/CDyml gitlab CI/CD 中的错误
【发布时间】:2018-12-15 08:41:04
【问题描述】:

我有这个在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

为什么会这样?

【问题讨论】:

    标签: continuous-integration yaml gitlab


    【解决方案1】:

    看看这个页面:https://docs.gitlab.com/ce/ci/variables/README.html#variables-expressions

    在匹配模式时,您似乎必须使用=~。 试试看

    - $CI_COMMIT_MESSAGE =~ /\[pipeline\]|(merge)/i 
    

    双等于== 只接受字符串、null 或变量。

    【讨论】:

    猜你喜欢
    • 2022-10-11
    • 2022-10-21
    • 2020-07-06
    • 2021-04-17
    • 1970-01-01
    • 2019-08-07
    • 2020-07-03
    • 2022-08-10
    • 1970-01-01
    相关资源
    最近更新 更多