首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么我的bitbucket-pipelines.yml对pull-request脚本无效

为什么我的bitbucket-pipelines.yml对pull-request脚本无效
EN

Stack Overflow用户
提问于 2019-05-16 01:52:59
回答 1查看 2.5K关注 0票数 3

我有一个bitbucket管道yaml文件,用于我正在处理的一个项目。当它被设置为在推送时运行时,我让它很好地运行流水线,但由于我将它切换为在拉出请求时运行,我得到了一个无效的yml错误。

我找到了关于如何配置该文件的描述:https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html

validator中,我在第一步得到一个错误,显示为Expected a string but found a mapping

当我通过pull-request运行它时,我得到以下错误:

代码语言:javascript
复制
Configuration error
There is an error in your bitbucket-pipelines.yml at [pipelines > pull-requests]. 
To be precise: This section should be a map (it is currently defined as a list).

我不确定如何修复它,因为它似乎与示例相符。

下面是我的yml文件

代码语言:javascript
复制
image: node:8.10
pipelines:
  pull-requests:
    - step: 
        name: Push repo to CodeCommit
        script:
          - echo $CodeCommitKey > ~/.ssh/codecommit_rsa.tmp
          - base64 -di ~/.ssh/codecommit_rsa.tmp > ~/.ssh/codecommit_rsa
          - chmod 400 ~/.ssh/codecommit_rsa
          - echo $CodeCommitConfig > ~/.ssh/config.tmp
          - base64 -di ~/.ssh/config.tmp > ~/.ssh/config
          - set +e
          - ssh -o StrictHostKeyChecking=no $CodeCommitHost
          - set -e
          - git remote add codecommit ssh://$CodeCommitRepo
          - git push codecommit $BITBUCKET_BRANCH
    - step:
        name: Test and Build
        caches:
          - node
        script: 
          - npm install --no-package-lock
          - npm run test
    - step:
        name: Deploy Serverless
        script:
          - npm i serverless -g
          - npm run deploy
EN

回答 1

Stack Overflow用户

发布于 2019-05-16 03:31:52

事实证明,我认为这只是一个评论,经过仔细检查,它是文件中必要的一部分。只要确保(空格)缩进正确即可。

代码语言:javascript
复制
image: node:8.10
pipelines:
  pull-requests:
    '**':
      - step: 
          name: Push repo to CodeCommit
          script:
            - echo $CodeCommitKey > ~/.ssh/codecommit_rsa.tmp
            - base64 -di ~/.ssh/codecommit_rsa.tmp > ~/.ssh/codecommit_rsa
            - chmod 400 ~/.ssh/codecommit_rsa
            - echo $CodeCommitConfig > ~/.ssh/config.tmp
            - base64 -di ~/.ssh/config.tmp > ~/.ssh/config
            - set +e
            - ssh -o StrictHostKeyChecking=no $CodeCommitHost
            - set -e
            - git remote add codecommit ssh://$CodeCommitRepo
            - git push codecommit $BITBUCKET_BRANCH
      - step:
          name: Test and Build
          caches:
            - node
          script: 
            - npm install --no-package-lock
            - npm run test
      - step:
          name: Deploy Serverless
          script:
            - npm i serverless -g
            - npm run deploy
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56155108

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档