Running Remote Bamboo Agents on Demand Using Docker [closed]

╄→尐↘猪︶ㄣ 提交于 2020-06-27 16:25:09

问题


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

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?

Thanks


回答1:


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.

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 :

  • Next stages will be ran inside a Docker container, killing the container itself at the end of your build will lead to a Bamboo build failure. You can do it in a last stage ran from an agent on the host but if your build fails for some reason you will never get to that stage
  • Concurrency build and error checking will be far more difficult to handle

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.

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.




回答2:


We (Atlassian Build Engineering) have created a set of plugins to run a number Docker based agents in a cluster (ECS) that come online, build a single job and then exit. It should be able to do what you desire. We've recently open sourced the solution.

See https://bitbucket.org/atlassian/per-build-container for more details.




回答3:


This is exactly why Docker is great for CI builds, you have a bamboo agent reside on a server, which has access to the Docker binary. Within your build script you pull, create, run, and destroy any version of whatever Docker image you need to run. e.g. Needing to run tests against various versions of Node would only require that you have the directory checked out, then a

docker pull/run node:0.X -> collect tests

docker pull/run node:4.X -> collect tests

docker pull/run node:6.X -> collect tests

This is effectively how we run builds at our company. I wrote about our setup sometime ago: http://blog.brianmkelley.com



来源:https://stackoverflow.com/questions/34828483/running-remote-bamboo-agents-on-demand-using-docker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!