[尝试在Circle CI上部署到S3时,错误是`用户提供的路径构建不存在。

问题描述 投票:0回答:1

我正在尝试在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退出

circleci circleci-2.0 circleci-workflows
1个回答
0
投票

我有工作了!

在构建作业中,我使用persist_to_workspace和部署作业attach_workspace(均在steps >>下)]

      - persist_to_workspace:
          root: ~/
          paths:
            - project/build

      - attach_workspace:
          at: ~/
© www.soinside.com 2019 - 2024. All rights reserved.