Forums

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

Bitbucket CI/CD Pipeline with aws elastic beanstalk

Rohit Pundlik February 28, 2020

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
MacKrava
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!
September 17, 2020

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.

0 votes
Alexander Zhukov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 3, 2020

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.

Rohit Pundlik March 3, 2020

@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 !

Moises Alejandro Alvarado Claro
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 3, 2020

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
Rohit Pundlik March 4, 2020

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

https://easyupload.io/rszxr2 

Rohit Pundlik March 6, 2020

@Moises Alejandro Alvarado Claro @Alexander Zhukov 

Any help on this.

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

Moises Alejandro Alvarado Claro
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 6, 2020

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. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events