-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
185 lines (169 loc) · 3.44 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
image: alpine:latest
variables:
HTTP_PROXY: ${HTTP_PROXY}
HTTPS_PROXY: ${HTTPS_PROXY}
NO_PROXY: ${NO_PROXY}
stages:
- test
- docker_image
- publish_to_test
- review
- stage
- stop
- production
package_and_tests:
stage: test
image: $CI_PROD_REGISTRY/ci/alpine-jdk-maven:1.0.0
script:
- mvn -Dtest=\!RDAPProxyTest package
artifacts:
paths: ["target/*.jar", "target/Dockerfile", "target/entrypoint.sh"]
only:
refs:
- branches
except:
refs:
- tags
docker_image:
image: $CI_TOOLS_IMAGE
stage: docker_image
variables:
DOCKER_DRIVER: overlay2
services:
- name: $CI_PROD_REGISTRY/ci/dind:1.0.0
script:
- setup_docker
- cd target
- build
only:
- branches
except:
refs:
- master
- tags
docker_prod_image:
image: $CI_TOOLS_IMAGE
stage: docker_image
variables:
DOCKER_DRIVER: overlay2
services:
- name: $CI_PROD_REGISTRY/ci/dind:1.0.0
script:
- setup_docker
- cd target
- build ${CI_PROD_REGISTRY}
only:
- master
except:
refs:
- tags
review_test_env:
stage: review
image: $CI_TOOLS_IMAGE
script:
- configure_helm
- export APPLICATION_URL=${CI_COMMIT_REF_SLUG}.${CI_PROJECT_NAME,,}.svc.tst.apnic.int
- set_app_chart_args
- test_environment_deploy
environment:
name: $CI_COMMIT_REF_SLUG
url: $CI_ENVIRONMENT_SLUG.${CI_PROJECT_NAME}.tst.xyz.apnic.net
on_stop: stop_environment
only:
refs:
- branches
except:
refs:
- tags
- master
variables:
- $DISABLED_REVIEW
review_prod_env:
stage: review
image: $CI_TOOLS_IMAGE
script:
- configure_helm
- export APPLICATION_URL=${CI_PROJECT_NAME,,}.svc.tst.apnic.int
- set_app_chart_args
- staging_environment_deploy
environment:
name: $CI_COMMIT_REF_SLUG
url: ${CI_PROJECT_NAME}.tst.xyz.apnic.net
on_stop: stop_environment
only:
refs:
- master
except:
refs:
- tags
variables:
- $DISABLED_REVIEW
publish_chart_to_test_repo:
stage: test
image: $CI_TOOLS_IMAGE
script:
- publish_chart tst
only:
refs:
- branches
except:
refs:
- tags
variables:
- $DISABLED_PUBLISH
publish_chart_to_prod_repo:
stage: production
image: $CI_TOOLS_IMAGE
script:
- publish_chart prd
only:
refs:
- master
except:
variables:
- $DISABLED_PUBLISH
git_tag:
stage: production
image: $CI_TOOLS_IMAGE
script:
- git_tag
only:
refs:
- master
except:
variables:
- $DISABLED_PUBLISH
stop_environment:
stage: stop
image: $CI_TOOLS_IMAGE
allow_failure: false
variables:
GIT_STRATEGY: none
script:
- clear_test_environment
environment:
name: $CI_COMMIT_REF_SLUG
action: stop
when: manual
only:
refs:
- branches
except:
refs:
- tags
variables:
- $DISABLED_STOP_ENV
# ---------------------------------------------------------------------------
.auto_devops: &auto_devops |
[[ "$TRACE" ]] && set -x
[[ "$DEBUG_SLEEP" ]] && sleep $DEBUG_SLEEP
source /ci-utils.sh || true
function set_app_chart_args() {
TEMP_ARG_LIST=()
TEMP_ARG_LIST=("${TEMP_ARG_LIST[@]}" "ingress.tls={}")
TEMP_ARG_LIST=("${TEMP_ARG_LIST[@]}" "ingress.tls[0].hosts={${APPLICATION_URL}}")
TEMP_ARG_LIST=("${TEMP_ARG_LIST[@]}" "ingress.tls[0].secretName=rdap-ingressd-tls")
APP_CHART_ARGS="${TEMP_ARG_LIST[@]}"
}
before_script:
- *auto_devops