-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
94 lines (87 loc) · 3.04 KB
/
.gitlab-ci.yml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
stages:
- test
- release
variables:
IMG_KANIKO: gcr.io/kaniko-project/executor:v1.9.0-debug
CONTEXT_PATH_PP_BASE: pypermission-base
CONTEXT_PATH_HYD_BASE: hostyourdocs-base
NAME_PP_BASE: pypermission-base
NAME_HYD_BASE: hostyourdocs-base
####################################################################################################
### Testing
####################################################################################################
test_pp_base:
stage: test
image:
name: ${IMG_KANIKO}
entrypoint: [""]
script:
- >
/kaniko/executor
--context ${CONTEXT_PATH_PP_BASE}
--destination "${CI_REGISTRY_IMAGE}/${NAME_PP_BASE}:${CI_COMMIT_SHORT_SHA}"
--verbosity info
--force
--no-push
rules:
- if: $CI_COMMIT_REF_NAME == "dev"
changes:
- ${CONTEXT_PATH_PP_BASE}/Dockerfile
test_hyd_base:
stage: test
image:
name: ${IMG_KANIKO}
entrypoint: [""]
script:
- >
/kaniko/executor
--context ${CONTEXT_PATH_HYD_BASE}
--destination "${CI_REGISTRY_IMAGE}/${NAME_HYD_BASE}:${CI_COMMIT_SHORT_SHA}"
--verbosity info
--force
--no-push
rules:
- if: $CI_COMMIT_REF_NAME == "dev"
changes:
- ${CONTEXT_PATH_HYD_BASE}/Dockerfile
####################################################################################################
### Release
####################################################################################################
release_pp_base:
stage: release
image:
name: ${IMG_KANIKO}
entrypoint: [""]
script:
# https://docs.gitlab.com/ee/ci/docker/using_kaniko.html
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"},\"$CI_DEPENDENCY_PROXY_SERVER\":{\"auth\":\"$(printf "%s:%s" ${CI_DEPENDENCY_PROXY_USER} "${CI_DEPENDENCY_PROXY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
- >
/kaniko/executor
--context ${CONTEXT_PATH_PP_BASE}
--destination "${CI_REGISTRY_IMAGE}/${NAME_PP_BASE}:${CI_COMMIT_SHORT_SHA}"
--verbosity info
--force
rules:
- if: $CI_COMMIT_REF_NAME == "main"
changes:
- ${CONTEXT_PATH_PP_BASE}/Dockerfile
when: manual
release_hyd_base:
stage: release
image:
name: ${IMG_KANIKO}
entrypoint: [""]
script:
# https://docs.gitlab.com/ee/ci/docker/using_kaniko.html
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"},\"$CI_DEPENDENCY_PROXY_SERVER\":{\"auth\":\"$(printf "%s:%s" ${CI_DEPENDENCY_PROXY_USER} "${CI_DEPENDENCY_PROXY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
- >
/kaniko/executor
--context ${CONTEXT_PATH_HYD_BASE}
--destination "${CI_REGISTRY_IMAGE}/${NAME_HYD_BASE}:${CI_COMMIT_SHORT_SHA}"
--verbosity info
--force
rules:
- if: $CI_COMMIT_REF_NAME == "main"
changes:
- ${CONTEXT_PATH_HYD_BASE}/Dockerfile
when: manual