-
Notifications
You must be signed in to change notification settings - Fork 5
/
push-to-git.sh
55 lines (39 loc) · 2.33 KB
/
push-to-git.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
sed -i -e "s/\r$//g" $(basename $0)
set -e
git config apply.whitespace nowarn
git config core.filemode false
source use-common.sh
_main() {
cache_global_vars
local state_for_push=${state}
echo "[IMPORTANT][NOTICE] we will push the image of !!'${state}'!! currently running to the Gitlab Container Registry."
echo "[NOTICE] Log in to the Gitlab Container Registry."
docker_login_with_params ${git_token_image_load_from_username} ${git_token_image_load_from_password} ${git_image_load_from_host}
echo "[NOTICE] Prepare current versions of the App,Nginx,Consul and Registrator and push them."
echo "[DEBUG] Run : docker tag ${project_name}:${state_for_push} ${app_image_name_in_registry}"
docker tag ${project_name}:${state_for_push} ${app_image_name_in_registry} || exit 1
echo "[DEBUG] Run : docker push ${app_image_name_in_registry}"
docker push ${app_image_name_in_registry} || exit 1
echo "[DEBUG] Run : docker rmi -f ${app_image_name_in_registry}"
docker rmi ${app_image_name_in_registry} || exit 1
echo "[DEBUG] Run : docker tag ${project_name}-nginx:latest ${nginx_image_name_in_registry}"
docker tag ${project_name}-nginx:latest ${nginx_image_name_in_registry} || exit 1
echo "[DEBUG] Run : docker push ${nginx_image_name_in_registry}"
docker push ${nginx_image_name_in_registry} || exit 1
echo "[DEBUG] Run : docker rmi -f ${nginx_image_name_in_registry}"
docker rmi ${nginx_image_name_in_registry} || exit 1
echo "[DEBUG] Run : docker tag hashicorp/consul:1.14.11 ${consul_image_name_in_registry}}"
docker tag hashicorp/consul:1.14.11 ${consul_image_name_in_registry} || exit 1
echo "[DEBUG] Run : docker push ${consul_image_name_in_registry}"
docker push ${consul_image_name_in_registry} || exit 1
echo "[DEBUG] Run : docker rmi -f ${consul_image_name_in_registry}"
docker rmi ${consul_image_name_in_registry} || exit 1
echo "[DEBUG] Run : docker tag gliderlabs/registrator:v7 ${registrator_image_name_in_registry}"
docker tag gliderlabs/registrator:v7 ${registrator_image_name_in_registry} || exit 1
echo "[DEBUG] Run : docker push ${registrator_image_name_in_registry}"
docker push ${registrator_image_name_in_registry} || exit 1
echo "[DEBUG] Run : docker rmi -f ${registrator_image_name_in_registry}"
docker rmi ${registrator_image_name_in_registry} || exit 1
}
_main