Gitlab CD/CI:用户提供的路径 build/ 不存在

Kri*_*sna 2 continuous-integration yaml continuous-deployment gitlab

我创建了一个简单的反应来练习 gitlab 的 CI/CD 管道。我有三份CD/CI管道工作。首先测试应用程序,然后构建然后部署到 AWS 的 S3 存储桶。成功通过测试并运行构建生产后,当它进入部署阶段时,我收到此错误:The user-provided path build does not exist.我不知道如何制作路径Gitlab's cd/ci pipeline.

这是我的 gitlab.gitlab-ci.yml文件设置

image: 'node:12'
stages:
  - test
  - build
  - deploy

test:
  stage: test
  script:
    - yarn install
    - yarn run test

variables:
  AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
  AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
  AWS_REGION: $AWS_REGION
  S3_BUCKET_NAME: $S3_BUCKET_NAME

build:
  stage: build
  only:
    - master
  script:
    - npm install
    - npm run build

deploy:
  stage: deploy
  only:
    - master
  image: python:latest
  script:
     - pip install awscli
     - aws s3 cp build/ s3://$S3_BUCKET_NAME/ --recursive --include "*" 
Run Code Online (Sandbox Code Playgroud)

Ann*_*ova 6

如果build/文件夹是作为build阶段的一部分创建的,那么它应该作为人工制品传递给deploy阶段,并且deploy应该build使用依赖项引用阶段:

build:
  stage: build
  only:
    - master
  script:
    - npm install
    - npm run build
  artifacts:
    paths:
      - build/

deploy:
  stage: deploy
  only:
    - master
  image: python:latest
  dependencies:
    - build
  script:
     - pip install awscli
     - aws s3 cp build/ s3://$S3_BUCKET_NAME/ --recursive --include "*" 

Run Code Online (Sandbox Code Playgroud)