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

How to exclude files when deploying to s3 with the aws-s3-deploy pipeline?

I've been trying the aws-s3-deploy pipeline (https://bitbucket.org/atlassian/aws-s3-deploy), with little success.

My goal is to exclude the .git folder from deployment. According to the pipelin documentation, I set the var

    EXTRA_ARGS: "--exclude '.git/*'"

The pipeline runs correctly, but the .git folder is always uploaded to S3. If I use double quotes, it is also uploaded. If I remove the quotes, an error happens (because the shell tries to expand).

Whenever I don't use quotes, and I don't use wildcards, for example

    EXTRA_ARGS: "--exclude README.md"

everything works as expected and the file is excluded. So the problem seems to be whenever I want to use wildcards.

Any ideas on how to exclude the .git folder from deployment?

2 answers

1 accepted

3 votes
Answer accepted

Could you try this:

EXTRA_ARGS: '--exclude=.git/*'

We're currently looking at whether we can improve the way pipes handle parameters that contain special characters like * or " but for now I think this might work.

Excellent! It works, thanks.

Like Steven Vaccarella likes this

For me works too. Thanks!

1 vote
edwin Community Leader Mar 12, 2019

Hi @Rodrigo Serrano ,

How about using:

EXTRA_ARGS: '--exclude=".git/*"'

No, exchanging single for double quotes (or the opposite) does not work. This is the log from the pipeline console:

 

( ... )
Status: Downloaded newer image for bitbucketpipelines/aws-s3-deploy:0.2.2
INFO: Starting deployment to S3...
aws s3 sync . s3://<my-bucket-here>/ --cache-control=max-age=3600 --delete --exclude README.md --exclude ".git/*"
Completed 23 Bytes/~2.2 MiB (122 Bytes/s) with ~88 file(s) remaining (calculating...)
upload: .git/HEAD to s3://<my-bucket-here>/.git/HEAD
(... etc ...)

Like dam0 likes this
mwatson Atlassian Team Mar 13, 2019

I haven't tried it, but .git has directories in it, so wouldn't you have to also exclude .git/*/* and maybe even .git/*/*/* - which sort of doesn't make sense. Have you tried just `--exclude .git`?

EXTRA_ARGS: '--exclude=".git/*"' - formats correctly to the command line. If copied & run from the terminal it works, but not within the pipe...

Suggest an answer

Log in or Sign up to answer
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...

148 views 0 1
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