我有一个bitbucket管道yaml文件,用于我正在处理的一个项目。当它被设置为在推送时运行时,我让它很好地运行流水线,但由于我将它切换为在拉出请求时运行,我得到了一个无效的yml错误。
我找到了关于如何配置该文件的描述:https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
在validator中,我在第一步得到一个错误,显示为Expected a string but found a mapping。
当我通过pull-request运行它时,我得到以下错误:
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文件
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发布于 2019-05-16 03:31:52
事实证明,我认为这只是一个评论,经过仔细检查,它是文件中必要的一部分。只要确保(空格)缩进正确即可。
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 deployhttps://stackoverflow.com/questions/56155108
复制相似问题