I am experimenting about a full Continous integration/Continous deployment workflow just using Gitlab (with pipelines and docker registry) and Rancher. Actually Gitlab is really cool platform providing everything very well integrated.
I am in the last phase: using rancher-compose to deploy the container in my Rancher infrastructure. I am using a Gitlab-Runner to execute the CI/CD pipelines and now I need to have the rancher-compose-cli inside the container where is been everything executed. Any suggestion to have the cli inside the runner? Should I use an ubuntu base image, then download an install the debian package?
I have seen there is a docker version of docker-compose. Because inside the runner I have docker, I could use it to lunch the deployment, but I am passing a lot of private information (keys) through a third-person container.
Hi! We are doing a similar thing to test out gitlab ci. I kind of hacked a working system together for this. I created a custom gitlab runner image from gitlab-runner that has docker, docker-compose and rancher-compose installed and they are running and registered with gitlab.
Our current pipeline is defined in 3 stages in .gitlab-ci.yml. The publish stage pushes the built images into the private repo, tagged propertly. The deploy stage is set to manual so if you push the button in Gitlab it runs the deployment phase for that version. The gozerthedeployer.sh script is just a wrapper around make that issues announcement of start and end and result to slack using curl posting to a webhook. In a previous version, the gozer script also just installed the compose tools that it needed in the runner if they were missing, which can avoid the need for a custom runner image.
I’ve written a tool to make upgrading Rancher services from gitlab-ci.yml files a lot easier (if you don’t keep your rancher-compose.yml files in the repo)
If you add a RANCHER_URL, RANCHER_ACCESS_KEY and RANCHER_SECRET_KEY secret variables to your project, you just need to add a new stage to your .gitlab-ci.yml file to have it upgrade the service in Rancher:
No further configuration is necessary if the group and project name in GitLab match the stack and service name in Rancher. If your stack or service name is different, you can pass --stack abc and/or --service xyz to the script: upgrade line.