Missed Team ’24? Catch up on announcements here.

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

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

Rodrigo Serrano
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 12, 2019

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?

3 answers

1 accepted

3 votes
Answer accepted
Steven Vaccarella
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 19, 2019

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.

dam0 March 19, 2019

Excellent! It works, thanks.

Like Steven Vaccarella likes this
Adam Krawczyk
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 25, 2019

For me works too. Thanks!

1 vote
Anil Pothula
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 23, 2020

tried few combinations to ignore multiple files and folders and this works for me.

EXTRA_ARGS: '--exclude=.git/* --exclude .gitignore --exclude bitbucket-pipelines.yml --exclude README.md'
1 vote
Edwin Kyalangalilwa
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2019

Hi @Rodrigo Serrano ,

How about using:

EXTRA_ARGS: '--exclude=".git/*"'
Rodrigo Serrano
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 13, 2019

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
Atlassian Team members are employees working across the company in a wide variety of roles.
March 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`?

dam0 March 18, 2019

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
TAGS
AUG Leaders

Atlassian Community Events