Commit 25fbf53b authored by femiadeyemi's avatar femiadeyemi
Browse files

add a new stage

Motivation:

Automated ci/cd is desirable process we will like to adhere to in 
our pipeline. Since we already have a local kubernetes cluster running 
on the production machine, we need to ensure that when a new tag
is release, the cluster is notified.

Modification:

- add a new pipeline stage called `docker`. This will be use for 
the building and deploy the image into the docker hub.
- deploy stage will now be responsible for trigger automated update 
of the image in the cluster.

Result:

Getting closer to fully automated ci/cd

Target: master
parent 6ce94326
......@@ -2,6 +2,7 @@ stages:
- build
- test
- package
- docker
- deploy
variables:
......
......@@ -31,11 +31,11 @@ package:
tags:
- "docker"
docker_push:
docker_build_push:
only:
- master
- tags
stage: deploy
stage: docker
image: docker:19.03.11
services:
- name: docker:19.03.11-dind
......@@ -60,7 +60,7 @@ docker_push:
production_deployment:
image: ubuntu
only:
- master
- tags
stage: deploy
before_script:
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
......@@ -70,5 +70,6 @@ production_deployment:
- chmod 700 ~/.ssh
script:
- ssh -A -tt -o StrictHostKeyChecking=no ubuntu@hifis-tp.desy.de uptime
- echo $(whoami)
- exit
\ No newline at end of file
- sudo kubectl set image deployments/cerebrum-app cerebrum=$DOCKER_IMAGE_TAGGED
- sudo kubectl rollout restart deployment cerebrum-app
- exit
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment