我正在尝试在 Circle CI 上设置持续部署。
我已成功运行我的构建脚本,它在根目录中创建了一个构建文件夹。当我在本地运行命令与 s3 同步时,它工作正常。但是在 Circle CI 中我无法获取构建文件夹的路径。
我试过 ./build,在部署作业中添加 working_directory: ~/circleci-docs
,并在测试运行中打印工作目录,即 /home/circleci/project,所以我尝试手动使用 /home/circleci/project/build,但也没有用。
这是我的 CircleCI config.yml 文件:
executors:
node-executor:
docker:
- image: circleci/node:10.8
python-executor:
docker:
- image: circleci/python:3.7
jobs:
build:
executor: node-executor
steps:
- checkout
- run:
name: Run build script
command: |
curl -o- -L https://yarnpkg.com/install.sh | bash
yarn install --production=false
yarn build
deploy:
executor: python-executor
steps:
- checkout
- run:
name: Install awscli
command: sudo pip install awscli
- run:
name: Deploy to S3
command: aws s3 sync build s3://{MY_BUCKET}
workflows:
version: 2
build-deploy:
jobs:
- build
- deploy:
requires:
- build
错误信息是:
用户提供的构建路径不存在。
退出代码为 255
最佳答案
我让它工作了!
在构建作业中,我使用了 persist_to_workspace 和部署作业 attach_workspace(两者都在steps 下)
- persist_to_workspace:
root: ~/
paths:
- project/build
- attach_workspace:
at: ~/
关于circleci - 尝试在 Circle CI 上部署到 S3 时,错误为 `The user-provided path build does not exist.`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58576236/