gpt4 book ai didi

circleci - CicleCI V2.1 中的分支问题

转载 作者:行者123 更新时间:2023-12-02 00:14:49 25 4
gpt4 key购买 nike

尝试执行以下分支时出现构建错误。

不允许使用无关的键[分支]

代码

version: 2.1
orbs:
aws-s3: circleci/aws-s3@1.0.0
jobs:
build:
docker:
- image: 'circleci/python:2.7'
branches:
only:
- master
steps:
- checkout
- run:
name: 'move file x to upload folder'
command: 'mkdir upload | mv *.ps1 upload/'
- run:
name: 'move file y rules to upload folder'
command: 'mv *.json upload/'
- aws-s3/sync:
from: './upload/'
to: 's3://az-patching-runbooks'
overwrite: true

任何帮助将不胜感激

最佳答案

Documentation说:

(...) If you are using 2.1 config, you will need to add a workflow in order to use filtering [for branches].

(括号 [] 内的文字是我自己添加的)。

所以添加一个workflow就像在this example那应该看起来像这样:

version: 2.1
orbs:
aws-s3: circleci/aws-s3@1.0.0
jobs:
build:
docker:
- image: 'circleci/python:2.7'
steps:
- checkout
- run:
name: 'move file x to upload folder'
command: 'mkdir upload | mv *.ps1 upload/'
- run:
name: 'move file y rules to upload folder'
command: 'mv *.json upload/'
- aws-s3/sync:
from: './upload/'
to: 's3://az-patching-runbooks'
overwrite: true

workflows:
version: 2
build-deploy:
jobs:
- build:
filters:
branches:
only: master

我没有测试我编写的脚本,但它是我从文档中收集的。

关于circleci - CicleCI V2.1 中的分支问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57358897/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com