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.
image: docker:git
stages:
- build
- publish
- deploy
.shared: &template
tags:
- docker
only:
- BRANCH
build_job:
<<: *template
stage: build
script:
- make TAG=$CI_BUILD_REF_NAME VER=$CI_PIPELINE_ID build
publish_job:
<<: *template
stage: publish
script:
- make TAG=$CI_BUILD_REF_NAME VER=$CI_PIPELINE_ID tag push
deploy_job:
<<: *template
stage: deploy
script:
- cd envs && ./gozerthedeployer.sh REDACTED
when: manual
environment: REDACTED
Maybe some of that will help