用户提供者路径不存在

时间:2019-05-27 09:46:46

标签: continuous-integration gitlab-ci gatsby gitlab-ci-runner

我找到了类似的话题,但这并不是解决我的问题的方法。

使用GitLab CI / CD的带有AWS S3和CloudFront的Gatsby.js

s3和cloudfront的配置正确。

在gitlabCI设置中设置:

  • AWS_ACCESS_KEY_ID:您的AWS-ACCESS-KEY-ID
  • AWS_SECRET_ACCESS_KEY:您的AWS-SECRET-ACCESS-KEY
  • S3_BUCKET_NAME:您的S3-BUCKET_NAME
  • DISTRIBUTION_ID:CLOUDFRONT-DISTRIBUTION-ID

我尝试设置gitlabCI,但仍然出现此错误

  

用户提供的路径dist不存在

The user-provided path does not exist

我的.gitlab-ci.yml

image: docker:latest

stages:
  - build
  - deploy

build:
  stage: build
  image: node:8.11.3
script:
  - export API_URL="d144iew37xsh40.cloudfront.net"
  - npm install
  - npm run build
  - echo "BUILD SUCCESSFULLY"
artifacts:
   paths:
    - public/
expire_in: 20 mins
environment:
name: production
only:
   - master
deploy:
  stage: deploy
  image: python:3.5
dependencies:
   - build
script:
  - export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
  - export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
  - export S3_BUCKET_NAME=$S3_BUCKET_NAME
  - export DISTRIBUTION_ID=$DISTRIBUTION_ID
  - pip install awscli --upgrade --user
  - export PATH=~/.local/bin:$PATH
  -  aws s3 sync --acl public-read --delete dist $S3_BUCKET_NAME
  - aws cloudfront create-invalidation --distribution-id 
$DISTRIBUTION_ID --paths '/*'
  - echo "DEPLOYED SUCCESSFULLY"

environment:
   name: production
only:
  - master

0 个答案:

没有答案