简体   繁体   English

如何将Atlassian Bamboo与AWS Elastic Beanstalk集成

[英]How to integrate Atlassian Bamboo with AWS Elastic Beanstalk

I want to integrate Atlassian Bamboo with AWS Elastic Beanstalk . 我想将Atlassian BambooAWS 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. 它取决于您的Bamboo和beanstalk配置以及您计划在AWS Beanstalk上部署的应用程序类型。

We did some things for Java Web Apps: 我们为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 由于Bamboo了解maven,您可以查看以下maven插件: 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. 我们在某些环境中使用它来创建战争并将它们上传到弹性beanstalk。 You can then create a maven task in bamboo to call the plugin. 然后,您可以在Bamboo中创建maven任务以调用插件。

If you downloaded and installed Bamboo on a machine you own yourself you could use the Elastic Beanstalk command line interface (CLI) . 如果您在自己拥有的计算机上下载并安装了Bamboo,则可以使用Elastic Beanstalk命令行界面(CLI) This is probably the most powerful approach, but you need to install the CLI on the bamboo instance. 这可能是最强大的方法,但您需要在Bamboo实例上安装CLI。 Then you can do almost anything. 然后你几乎可以做任何事情。 This approach should also work for other environments besides Java/Tomcat. 除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. 另一个想法:如果您使用git使用Beanstalk(即通过更改代码并推送到Beanstalk进行部署),那么您也可以使用Bamboo中的新“部署项目”功能在代码通过所有测试后推送它。

David's answer provides good options for cross product usage of AWS Elastic Beanstalk (+1). David的回答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 Elastic Beanstalk API命令行界面上使用优秀的统一AWS 命令行界面 ,请参阅参考资料。 AWS CLI commands for elasticbeanstalk . 用于elasticbeanstalk的AWS CLI命令

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: 如果您正在寻找Bamboo特定解决方案,您可能会对Utoolity的AWS(Bamboo)附加任务 (商业,请参阅免责声明)感兴趣,该附加提供三个专用任务,具体来说:

  • AWS Elastic Beanstalk Application - create, update or delete AWS Elastic Beanstalk applications. AWS Elastic Beanstalk应用程序 - 创建,更新或删除AWS Elastic Beanstalk应用程序。
  • AWS Elastic Beanstalk Application Version - create, update or delete AWS Elastic Beanstalk application versions. AWS Elastic Beanstalk应用程序版本 - 创建,更新或删除AWS Elastic Beanstalk应用程序版本。
  • AWS Elastic Beanstalk Environment - create, update, rebuild, restart, swap or terminate AWS Elastic Beanstalk environments and specify configuration settings and advanced options. AWS Elastic Beanstalk环境 - 创建,更新,重建,重新启动,交换或终止AWS Elastic Beanstalk环境,并指定配置设置和高级选项。

Disclaimer : I'm the co-founder of this add-on's vendor, Utoolity. 免责声明 :我是这个附加组件供应商Utoolity的联合创始人。

In case you're interested in C# deployments: 如果您对C#部署感兴趣:

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. 我们所做的是简单地启动awsdeploy工具(应该已经安装在构建服务器上),并带有指向配置脚本的链接。 I create the environment simply in Visual Studio and when I redeploy the application once, I save the script. 我只是在Visual Studio中创建环境,当我重新部署应用程序一次时,我保存了脚本。 Once the script is on the build server, I reference it in the deployment configuration with awsdeploy /rc:\\location\\of\\myscript.txt . 一旦脚本在构建服务器上,我就在部署配置中使用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. AWS部署配置脚本中引用的包本身是在构建时使用MSbuild /target:package命令创建的,并定义为工件(ZIP包的默认位置是c:\\build-dir\\...\\project\\obj\\debug\\package ,但可以覆盖。

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 看看我们的回购: https//github.com/matzegebbe/docker-aws-login使用该片段,您可以使用aws登录推送图像

simple bamboo task script (of course you need docker installed on the agents): 简单的竹子任务脚本(当然你需要在代理上安装docker):

#!/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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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