0

we are currently playing around with kubernetes+docker. At the moment I'm wondering how to integrate bamboo in our deployment process during development and for release.

Our current CI process is like this:

  • dev checks-in code changes to branch "develop"
  • bamboo triggers build process:
    • code is checked out from git
    • run build code (java)
    • run unit+integration tests
    • deploy artifact to artifactory
    • build docker image with artifact
    • tag docker image with artifact version
    • push image to docker hub

This is the current workflow at the moment. Now I would like to use bamboos deployment functionality to deploy the docker image to our kubernetes clusters.

From a technical point it should be pretty easy:

  • SSH to the master node
  • start rolling update from the replication controller with the new image

My question is how do I get the name of the docker image that is created during the build within my deployment task. I already thought that I might create a properties file with the variables which I store as an artifact in the build process. I could read-out this property file within my deployment process...

Somehow this feels more like a workaround..another idea would be to do the deployment directly within the build task and don't use the deployment functionality at all...

Is there another option? Has anyone another option/better idea? Thoughts/Help would be very nice :)

daniel
  • 1,002
  • 13
  • 22
  • I assume by "SSH to the master node" you mean use the client (kubectl rolling-update) or send JSON/HTTP to the master. Unfortunately I don't know the answer to your main question. Perhaps it would be appropriate for a bamboo mailing list? – DavidO Oct 04 '15 at 01:15

2 Answers2

1

I'm not familiar with Bamboo, but Kubernetes 1.2 will support the Deployment API, which will perform the rolling update on your behalf once you update the Deployment spec to the new image tag.

Alternatively, you could try Openshift 3, which is built on Kubernetes. It supports deployments triggered by image pushes: https://github.com/openshift/origin/blob/master/docs/deployments.md#triggers

briangrant
  • 835
  • 6
  • 13
1

I've faced a similar issue with a very similar build/deploy pipeline and I did end up having to output a properties file from the build step and make it a build artifact, that then gets read in by the deploy project.

There seem only to be a limited set of properties that you can access from a deployment project: https://confluence.atlassian.com/bamboo/variables-for-deployment-environments-342754180.html

Having said that, it is pretty easy to do the export:

In the build project export the properties you want into a file e.g project.properties and mark that as a build artifact.

Then in the deploy project, use the Inject Bamboo variables task, and the values will be available to the deployment project as

${bamboo.inject.<property name>}
natke
  • 743
  • 1
  • 9
  • 21