Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When trying to deploy to S3 on Circle CI, error is `The user-provided path build does not exist.`

I'm trying to set up continuous deployment on Circle CI.

I've successfully run my build script, which creates a build folder in the root directory. When I run the command locally to sync with s3, it works fine. But in Circle CI I can't get the path to the build folder.

I've tried ./build, adding working_directory: ~/circleci-docs in the deploy job, and printing the working directory in a test run, which was /home/circleci/project, so I tried manually using /home/circleci/project/build and that didn't work either.

This is my CircleCI config.yml file:


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

The error message was:

The user-provided path build does not exist.

Exited with code 255

like image 284
Zach G Avatar asked Sep 14 '25 07:09

Zach G


1 Answers

I got it to work!

In the build job I used persist_to_workspace and the deploy job attach_workspace (both are under steps)

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

      - attach_workspace:
          at: ~/
like image 169
Zach G Avatar answered Sep 17 '25 21:09

Zach G