使用Docker按需运行远程Bamboo Agent [英] Running Remote Bamboo Agents on Demand Using Docker

查看:461
本文介绍了使用Docker按需运行远程Bamboo Agent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为CI构建环境自动启动Bamboo容器是否可行

I'm trying to see if it would be viable to automatically spin up Bamboo containers for a CI build enviroment

理想情况下,我希望任意数量的随机容器能够自动启动并销毁它们以进行构建,而无需使用docker compose在远程服务器上进行任何修补.

Ideally I want any number of random containers to be able to spin up automatically and destroy themselves for a build without having to do any tinkering on the remote server with docker compose.

我们有大量不同的项目,它们具有不同的依赖关系.因此,当开发人员运行构建时,我的目标是建立一个特定于该构建的容器,将其添加到可行的远程代理列表中,运行该构建,然后销毁自身.

We have tons of different projects with different mishmashes of dependencies. So when a dev runs a build, my goal is that a container specific to that build should come up, add itself to the list of viable remote agents, run that build, and than destroy itself.

有没有人尝试过类似的尝试或有任何建议来看看这是否可行?

Has anyone tried anything similar or have any advice to see if this is viable?

谢谢

推荐答案

我已经在Docker上与Bamboo和远程代理合作了一段时间,而我碰巧试图实现相同的目标.简单回答您的问题:不,我认为这不可行. 您正在尝试做的基本上是Atlassian所谓的弹性代理,但目前仅适用于AWS.

I've been working for a while with Bamboo and remote agents on Docker and I happened to have tried to achieve to same thing. To simply answer your question : No, this is not viable in my opinion. What you are trying to do is basically what Atlassian calls elastic agents but it only works for AWS for now.

在当前情况下,当构建排队时,无法生成新代理.但是,您可以为每个计划设置一个第一阶段,这将启动执行第二阶段所需的Docker容器.下一阶段需要设置Bamboo依赖项,以便只有您产生的Docker容器才能处理它.

In the current situation there is no way to spawn new agents when a build is queued. However, what you can do is to setup a first stage for each of your plans that will start the Docker container needed to perform the second stage. Your next stage will need to have Bamboo dependencies set so that only the Docker container you have spawned would be able to take care of it.

虽然这行得通,但让我告诉您这样做会带来什么缺陷:

While this would work, let me tell you what flaw you should expect by doing this :

  • 接下来的阶段将在Docker容器中运行,在构建结束时杀死容器本身将导致Bamboo构建失败.您可以在主机上的代理运行的最后一个阶段中执行此操作,但是如果由于某种原因构建失败,您将永远无法进入该阶段.
  • 并发构建和错误检查将更加困难

我们最终在我的工作中所要做的只是支付允许更多代理使用的许可证,然后在他们自己的Docker容器中运行它们以实现更多代理隔离.您可能会因为浪费时间来建立这样的系统而浪费更多的钱,而不仅仅是花更多的钱来支付费用.

What we ended up doing where I work was just to pay for a license allowing more agents and ran them in their own Docker container for more agent isolation. You can expect to loose more money by wasting your time setting up such system than to just pay for more agents.

如果您的问题不是金钱,而是更多的是必须处理许多不同的配置,则可以考虑在阶段开始时运行Docker容器,然后使用docker exec将所有命令转发给它.不过,设置起来仍然不容易.

If your problem is less about money and more about having to deal with lots of different configuration, you can consider running Docker container at the beginning of a stage and forward all the command to it using docker exec. This will still not be easy to set up though.

这篇关于使用Docker按需运行远程Bamboo Agent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆