简体   繁体   中英

How to integrate Atlassian Bamboo with AWS Elastic Beanstalk

I want to integrate Atlassian Bamboo with AWS Elastic Beanstalk . Is there anyway to do this?

It depends a bit on your Bamboo and beanstalk config as well as the type of application you are planning to deploy on AWS Beanstalk.

We did some things for Java Web Apps:

Since Bamboo understands maven, you can have a look at the following maven plugin: http://beanstalker.ingenieux.com.br/beanstalk-maven-plugin/configurations-and-templates.html

We are using it for some environments to create wars and upload them to elastic beanstalk. You can then create a maven task in bamboo to call the plugin.

If you downloaded and installed Bamboo on a machine you own yourself you could use the Elastic Beanstalk command line interface (CLI) . This is probably the most powerful approach, but you need to install the CLI on the bamboo instance. Then you can do almost anything. This approach should also work for other environments besides Java/Tomcat.

Another idea: If you use Beanstalk using git (ie you deploy by making a code change and pushing to Beanstalk), then you can also use the new "Deployment Project" Feature in Bamboo to push the code once it passes all tests.

David's answer provides good options for cross product usage of AWS Elastic Beanstalk (+1). Nowadays I'd recommend the excellent unified AWS Command Line Interface over the now legacy AWS Elastic Beanstalk API Command Line Interface , see the resp. AWS CLI commands for elasticbeanstalk .

If you are looking for a Bamboo specific solution, you might be interested in Utoolity's Tasks for AWS (Bamboo) add-on (commercial, see disclaimer), which provides three dedicated tasks, specifically:

  • AWS Elastic Beanstalk Application - create, update or delete AWS Elastic Beanstalk applications.
  • AWS Elastic Beanstalk Application Version - create, update or delete AWS Elastic Beanstalk application versions.
  • AWS Elastic Beanstalk Environment - create, update, rebuild, restart, swap or terminate AWS Elastic Beanstalk environments and specify configuration settings and advanced options.

Disclaimer : I'm the co-founder of this add-on's vendor, Utoolity.

In case you're interested in C# deployments:

What we do is to simply start the awsdeploy tool (should already be installed on the build server) with a link to the configuration script. I create the environment simply in Visual Studio and when I redeploy the application once, I save the script. Once the script is on the build server, I reference it in the deployment configuration with awsdeploy /rc:\\location\\of\\myscript.txt .

The package itself the is referenced in the AWS deployment configuration script is created at build time with the MSbuild /target:package command and defined as an artifact (default location of the ZIP package is c:\\build-dir\\...\\project\\obj\\debug\\package , but can be overwritten.

Everything works pretty well so far, although I am having problem to start an elastic instance when none is available (eg nightly builds).

Take a look at our repo: https://github.com/matzegebbe/docker-aws-login With that snippet you are able to login with the aws an push images

simple bamboo task script (of course you need docker installed on the agents):

#!/bin/bash

docker images hellmann/awscli | grep -q awscli
[ "$?" -eq "0" ] && exit 0

cat <<'EOF' >> Dockerfile
FROM python
MAINTAINER Mathias Gebbe <mathias.gebbe@hellmann.net>

RUN pip install awscli --ignore-installed six

ENV aws_access_key_id AWS_ACCESS_KEY
ENV aws_secret_access_key AWS_SECRET_ACCESS_KEY 

RUN mkdir /root/.aws/
RUN printf "[default]\nregion = eu-west-1\n" > /root/.aws/config
RUN printf "[default]\naws_access_key_id = ${aws_access_key_id}\naws_secret_access_key = ${aws_secret_access_key}\n" > /root/.aws/credentials
ENTRYPOINT ["/bin/bash","-c"]
CMD ["aws ecr get-login"]
EOF
docker build -t hellmann/awscli .
$(docker run --rm hellmann/awscli)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM