我在Bitbucket管道中使用管道atlassian / aws-s3-deploy:0.4.0部署到AWS s3。这很好,但是我只需要为index.html设置Cache-Control
如何在管道中运行代码,以便仍然可以使用aws cli工具?这不应该是另一步骤,因为部署过程应该是一个步骤。
我当前的脚本如下:
image: node:10.15.3
pipelines:
default:
- step:
name: Build
caches:
- node
script:
- npm install
- npm run build
artifacts:
- dist/**
- step:
name: Deploy
trigger: manual
script:
- pipe: atlassian/aws-s3-deploy:0.4.0
variables:
AWS_DEFAULT_REGION: 'eu-central-1'
S3_BUCKET: '***'
LOCAL_PATH: 'dist'
- aws s3 cp dist/index.html s3://***/index.html --cache-control no-cache,no-store
凭据是通过项目机密变量提供的。
谢谢!
答案 0 :(得分:0)
您可以在同一步骤中安装aws cli:
- step:
name: Deploy
trigger: manual
# use python docker image so pip is available
image: python:3.7
script:
- pipe: atlassian/aws-s3-deploy:0.4.0
variables:
AWS_DEFAULT_REGION: 'eu-central-1'
S3_BUCKET: '***'
LOCAL_PATH: 'dist'
# install the aws cli
- pip3 install awscli --upgrade --user
- aws s3 cp dist/index.html s3://***/index.html --cache-control no-cache,no-store