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



我创建了一个简单的react来练习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 "*" 

如果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 "*" 

相关内容

最新更新