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

Bitbucket CI/CD Pipeline with aws elastic beanstalk

I am trying to implement Bitbucket CI/CD pipeline to deploy .net core application on AWS elastic beanstalk. The .net core application getting successfully published, but when I am trying to deploy on AWS elastic beanstalk it is giving following error.

✖ Deployment failed. Environment "{my-application-environment}" is running a different version "{version-number}".

Also on AWS elastic beanstalk I am getting the following error,

During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version.

Below is my bitbucket-pipelines.yml file

image: microsoft/dotnet:3.0-sdk

pipelines:
default:
- step:
script:
- echo "Hello Bitbucket !"

- step:
name: build publish prepare and zip
caches:
- dotnetcore
script:
- apt-get update && apt-get install --yes zip
- export PROJECT_NAME=$PROJECT_NAME
- dotnet restore $PROJECT_NAME
- dotnet build $PROJECT_NAME
- dotnet publish $PROJECT_NAME --self-contained --runtime win-x64 --configuration Debug
- zip -j site.zip /opt/atlassian/pipelines/agent/build/{my-project-name}/bin/Debug/netcoreapp3.0/win-x64/publish/* -x aws-windows-deployment-manifest.json
- zip -r -j application.zip site.zip /opt/atlassian/pipelines/agent/build/{my-project-name}/bin/Debug/netcoreapp3.0/win-x64/publish/aws-windows-deployment-manifest.json

artifacts:
- application.zip

- step:
name: upload to elasticbeanstalk
script:
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.5.0
variables:
APPLICATION_NAME: $APPLICATION_NAME
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
#COMMAND: 'upload-only'
ZIP_FILE: 'application.zip'
ENVIRONMENT_NAME: $ENVIRONMENT_NAME
WAIT: 'true'
VERSION_LABEL: 'deploy-WebApi-$BITBUCKET_BUILD_NUMBER'

The variables I have already configured in pipeline settings and pipeline is also enabled.

Is there something wrong with my .yml file?

Any help on this appreciated !

2 answers

0 votes

Hi @Rohit_Pundlik could you run the pipe with DEBUG enabled by setting this variable to true and share the output? It seems like some or all instances fail to update the environment for some reason.

@Alexander Zhukov 

I am sorry to ask this question, but can you help me how and where can I set that variable to true ?

Thanks for the help !

hello,

 

just add 

DEBUG: "true"

as a variable to the atlassian pipeline. Something like this:

- step:
name: upload to elasticbeanstalk
script:
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.5.0
variables:
APPLICATION_NAME: $APPLICATION_NAME
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
#COMMAND: 'upload-only'
ZIP_FILE: 'application.zip'
ENVIRONMENT_NAME: $ENVIRONMENT_NAME
WAIT: 'true'
VERSION_LABEL: 'deploy-WebApi-$BITBUCKET_BUILD_NUMBER'
DEBUG: "true"
Like Alexander Zhukov likes this

Hi Below is output I have share, I have changed original application name and s3, eb links

https://easyupload.io/rszxr2 

@Moises Alejandro Alvarado Claro @Alexander Zhukov 

Any help on this.

There is literally no help or documentation available to achieve this.

Hello @Rohit_Pundlik 

 

normally when you get a "deployment failed" error could be because several things. Please check that the account that you're using has enough permissions(S3 access/upload/Read, etc) for all the actions that are required to perform a EB deployment. Also, in the AWS console go to your EB instance/environment and find the "events" section. There you should see everything that's going on with your EB instance/environment. That could help you to understand was going on. 

Maybe it will be useful for somebody. In my case it was problem with Node version. Node version in my build was unsupported for version in EB Node platform. I've found it in eb-engine.log 

An error occurred during execution of command [app-deploy] - [Install customer specified node.js version]. Stop running the command. Error: unsupported node version 12.18.4, please specify any of node versions in [v12.0.0 v12.1.0 v12.10.0 v12.11.0 v12.11.1 v12.12.0 v12.13.0 v12.13.1 v12.14.0 v12.14.1 v12.15.0 v12.16.0 v12.16.1 v12.16.2 v12.16.3 v12.17.0 v12.18.0 v12.18.1 v12.18.2 v12.18.3 v12.2.0 v12.3.0 v12.3.1 v12.4.0 v12.5.0 v12.6.0 v12.7.0 v12.8.0 v12.8.1 v12.9.0 v12.9.1] 

 So be careful with such things as well.

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,038 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