Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

UPLOAD A ZIP FILE TO S3 BUCKET

honbit July 11, 2019

Hi,

We would like to zip our branch repository and upload to S3 on every commit.

We tried to use "aws-code-deploy" pipe and we were able to upload a zip successfully but the pipe fails as we don't have anything to deploy. 

Do we have any pipe which just uploads a zip to S3 and not deploy OR

Can we turn off deploy in "aws-code-deploy" pipe?

Appreciate your help.

 

Thanks.

1 answer

0 votes
Daniel
Contributor
July 11, 2019

There's an aws-s3-deploy pipe. Documentation: https://bitbucket.org/atlassian/aws-s3-deploy/src/master/README.md

Here's an example usage:

- pipe: atlassian/aws-s3-deploy:0.3.1
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: 'name_of_your_bucket'
LOCAL_PATH: 'path/to/your/files'
honbit July 11, 2019

Hi Daniel,

Thanks for the response. I checked the pipe but couldn’t find how to zip before uploading to S3. Any idea how we can zip with this pipe?

 

Thanks.

Daniel
Contributor
July 11, 2019

If you need to zip up a bunch of files, you need to create the zip as part of the step. For example:

- step:
name: Upload to S3
script:
- mkdir dist
- zip dist/myzip.zip file1 file2 file3
- pipe:
atlassian/aws-s3-deploy:0.3.1
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: 'name_of_your_bucket'
LOCAL_PATH: 'dist'

Depending on the build container image that you're using, if may not have the zip utility, you would have to install it if it doesn't exist.

honbit July 25, 2019

Hi,

I tried as you mentioned, I get this error: 'dist directory doesn't exist'.

Looks like the directory we created is not available.

honbit July 25, 2019

I finally got it working!

We need to include artifacts with "dist/**".

Here's the working version:

- step:
name: Upload to S3
script:
- mkdir dist
- zip dist/myzip.zip file1 file2 file3
- artifacts:
- dist/**
- pipe:
atlassian/aws-s3-deploy:0.3.1
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: 'name_of_your_bucket'
LOCAL_PATH: 'dist'

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events