I am trying to set up a deployment using the new AWS S3 pipe - https://confluence.atlassian.com/bitbucket/deploy-to-amazon-aws-875304040.html
I'm glad to see that I can set the metadata for files but I can't see how to specify which files I want to set the metadata for. Is this possible? I need different cache-control values for different files. Index.html should be no-cache but my JS and CSS should be cached.
Can I do this with the new S3 pipe?
Hi @Andy Furniss ! While it's not possible to do in a single pipe run, I think you can do the following: in the first step you deploy all your file that has to be cached, and in the second step, deploy files with no-cache. So basically you need to use the pipe twice. Here is an example:
- pipe: atlassian/aws-s3-deploy:0.2.4
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: 'us-east-1'
S3_BUCKET: 'my-bucket-name'
LOCAL_PATH: 'build'
CACHE_CONTROL: 'max-age=86400'
EXTRA_ARGS: '--exclude=*.html'
- pipe: atlassian/aws-s3-deploy:0.2.4
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: 'us-east-1'
S3_BUCKET: 'my-bucket-name'
LOCAL_PATH: 'build'
CACHE_CONTROL: 'no-cache'
EXTRA_ARGS: '--exclude=*.js --exclude=*.css'
Note that here we use EXTRA_ARGS pipe parameter to pass the --exclude options to deploy static files and html files separately.
Thanks @Alexander Zhukov !
In the end, I decided to just do it with the AWS CLI using the cgswong/aws:aws docker image.
I will give your suggestion a try when I get the chance though because I'd rather use the predefined pipes if possible! :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.