Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Specify files/path when setting CACHE_CONTROL with AWS S3 pipe Edited

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?

1 answer

0 votes

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! :)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,227 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you