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

Pipeline deploy to Elasticbeanstalk - Upload issue - No changes reflected Edited

Guys I am having issues deploying to elasticbeanstalk. It seems that when running the pipeline it just duplicates the existing zip file within the s3 bucket. Tried various scenarios but still get the same result. 

- pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.5
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
APPLICATION_NAME: 'applicationXYZ'
ENVIRONMENT_NAME: 'Test'
ZIP_FILE: 's3://elasticbeanstalk-us-west-x-xxxxxxxxxx/applicationXYZ.zip'
S3_BUCKET: 'elasticbeanstalk-us-west-x-xxxxxxxxxx'

Any suggestions ? 

3 answers

1 accepted

Hi @Regtify ,

Couple of things you can do.

1. What happens when you don't have any zip contents in s3 bucket and perform a 'upload-only'? Do you see the latest code is being uploaded?

2. Add 'version' key to the variables and see if that make any difference

3. Add 'debug':true so you will have more information about what's going on.

Let me know how it goes.

Thanks,

Lava

Thank you for the reply! 

I tried to perform point 1 and it stops saying: 

INFO: Uploading to s3 bucket: reg-bitbucketXYZ...fatal error: An error occurred (404) when calling the HeadObject operation: Key "applicationXYZ.zip" does not exist

 

Based on this conf:

script:
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.5
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
APPLICATION_NAME: 'applicationXYZ'
COMMAND: 'upload-only'
ENVIRONMENT_NAME: 'Test'
ZIP_FILE: 's3://reg-bitbucketXYZ/applicationXYZ.zip'
S3_BUCKET: 'reg-bitbucketXYZ'
DEBUG: 'TRUE'
VERSION_LABEL: ${ENVIRONMENT_NAME}_${BITBUCKET_COMMIT:0:8}_YYYY-mm-dd_HHMMSS)

Hi, 

Can you confirm if the S3 bucket and the EBS are in the same region?

Yes confirmed.

Thank you for the support. I also just tried the following:

1. Uploaded the zip file to the bucket

2. Edited the code to:

script:
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.5
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
APPLICATION_NAME: 'applicationXYZ'
COMMAND: 'upload-only'
ENVIRONMENT_NAME: 'Test'
ZIP_FILE: 's3://applicationXYZ-elasticbeanstalk-deployment/applicationXYZ-app.zip'
S3_BUCKET: 'applicationXYZ-elasticbeanstalk-deployment'
DEBUG: 'TRUE'

 3. Run the pipeline with success but again the same problem, i.e. the new file created in the bucket is exactly the same as the old one but with different version name. I checked to see if the changes that I have made have been reflected in the new zip file but unfortunately it is identical to the original zip.

 

Digest: sha256:4e280f00cb5d1c53b3a36d24b129fbede2b1396e0d9d1d8d98398390a62a81bcStatus: Downloaded newer image for bitbucketpipelines/aws-elasticbeanstalk-deploy:0.2.5

INFO: Uploading to s3 bucket: applicationXYZ-elasticbeanstalk-deployment...

Completed 680.3 KiB/32.7 MiB (860.5 KiB/s) with 1 file(s) remaining

Completed 8.7 MiB/32.7 MiB (9.7 MiB/s) with 1 file(s) remaining Completed 16.7 MiB/32.7 MiB (17.5 MiB/s) with 1 file(s) remaining Completed 24.7 MiB/32.7 MiB (24.6 MiB/s) with 1 file(s) remaining Completed 32.7 MiB/32.7 MiB (30.7 MiB/s) with 1 file(s) remaining

copy: s3://applicationXYZ-elasticbeanstalk-deployment/applicationXYZ-app.zip to s3://applicationXYZ-elasticbeanstalk-deployment/applicationXYZ-102-eb15a3fd.zip

✔ Artifact uploaded successfully to s3://applicationXYZ-elasticbeanstalk-deployment/applicationXYZ-102-eb15a3fd.zip

 

 

I am quite lost, after trying 100 different combinations.....

Thanks! The AWS code worked whereas the Bitbucket code needs a lot of work,,

0 votes
mwatson Atlassian Team Mar 20, 2019

The atlassian/aws-elasticbeanstalk-deploy pipe takes your zip you have built locally, and can work in 3 modes:

  • use the command upload-only to upload an artifact to S3 and create a version
  • use the command deploy-only to deploy an already created version to an environment
  • with no command , do the upload and deploy in one step

It looks like you have already uploaded an artifact and are trying to create a new version or deploy an existing version?

Your workflow may not map exactly through to the 2 workflows that we support, or you could modify it so that you build your zip in pipelines, use the upload-only command and then have deployment steps in pipelines that deploys that artifact to your different environments.

Hope this helps,

Matt Watson (Bitbucket Pipelines DevMgr)

Hello Matt, 

Thank you for the support! We have committed the yml file 100+ times with different combinations, including the 3 command options and a zip step before... The problem is still the same, it creates a file that is exactly the same as the one previously uploaded. If we do not upload the zip file, the pipeline pops an error saying the the file does not exist in s3...

mwatson Atlassian Team Mar 25, 2019

Hi Constantinos,

The Pipe is not intended to be used with a zip file already in S3 - the S3 bucket is merely the intermediate storage for the artefact you generate and zip up within Pipelines. you then upload_only it and use 1 or more deploy-only pipes to push that artefact to different environments. See https://bitbucket.org/bitbucketpipelines/example-aws-elasticbeanstalk-deploy/src/master/bitbucket-pipelines.yml for a fully worked example.

Hope that helps,

Matt

Hello Matt, 

When we first tried using pipelines we kept getting this message:

INFO: Uploading to s3 bucket: xxxxxxx-elasticbeanstalk-deployment...

The user-provided path xxx.zip does not exist.

Hi value team member

I need your help on this deployment

//////////

- step:
# caches:
# - composer
name: Deploy to Test
deployment: test # set to test
trigger: automatic
script:
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.5.0
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: 'us-east-1'
APPLICATION_NAME: 'AAAAAAAAA'
ZIP_FILE: 's3://AAAAAAAAA-elasticbeanstalk-deployment/AAAAAAAAA-app.zip'
S3_BUCKET: 'AAAAAAAAA-elasticbeanstalk-deployment'
COMMAND: 'upload-only'
ENVIRONMENT_NAME: 'test'
DEBUG: 'TRUE'
VERSION_LABEL: ${ENVIRONMENT_NAME}_${BITBUCKET_COMMIT:0:8}_YYYY-mm-dd_HHMMSS)

/////////////

I got this

INFO: The application source bundle doesn't have a known file extension (zip, jar or war). This might cause some issues.INFO: Uploading to s3 bucket: AAAAAAAAA-elasticbeanstalk-deployment...fatal error: An error occurred (404) when calling the HeadObject operation: Key "AAAAAAAAA-app.zip" does not exist

If you could help !

Best regards

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...

155 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