-
Notifications
You must be signed in to change notification settings - Fork 14
/
.gitlab-ci.yml
223 lines (204 loc) · 6.08 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
image: $ATG_IMG_REGISTRY_URL/node:lts
stages:
- fetch-dependencies
- update
- atg-shared-checks
- build
- test
- docs
- publish
- container_scan
variables:
SEC_ALLOW_FAILURE: "true"
SEC_NO_GIT_HISTORY: "true"
include:
- project: automation-toolchain/atg-shared-templates
ref: main
file:
- code_quality/base.gitlab-ci.yml
- compliance/base.gitlab-ci.yml
- security/base.gitlab-ci.yml
- security/container.gitlab-ci.yml
- test/base.gitlab-ci.yml
# UPDATE #
# only pipelines on 'develop' should check for new changes
update_autotool_deps:
stage: update
only: [develop]
needs: [fetch_dependencies]
variables:
UPDATE_BRANCH_NAME: update_autotool_deps
script:
- . ./scripts/dev/update-acc-deps.sh
- . ./scripts/dev/update-from-as3.sh
- . ./scripts/dev/update-from-do.sh
- >
if [ "$AUTOTOOL_DIFF" = "true" ]; then
git push -f origin ${UPDATE_BRANCH_NAME}
fi
tags: [cm-official-docker-executor]
fetch_dependencies:
stage: fetch-dependencies
needs: []
script:
- . ./scripts/build/fetch-dependencies.sh
artifacts:
expire_in: 1 week
paths:
- dependencies
- package.json
- package-lock.json
tags: [cm-official-docker-executor]
# BUILD #
create_docs:
image: $CONTAINTHEDOCS_IMAGE
stage: build
needs: []
script:
- cd docs
- pip3 install -r requirements.txt
- >
if [ "$CI_COMMIT_REF_NAME" = "docs-staging" ] || [ "$CI_COMMIT_REF_NAME" = "docs-latest" ]; then
rm -r _templates
fi
- make html
- make test
artifacts:
expire_in: 1 week
name: sphinx-docs_$CI_BUILD_REF
paths: [docs/_build/html]
tags: [cm-official-docker-executor]
build_image:
image: $ATG_IMG_REGISTRY_URL/node:14-buster
stage: build
needs: [fetch_dependencies]
script:
- source scripts/build/image-build.sh
artifacts:
name: $CI_PROJECT_NAME-$CI_BUILD_REF
paths: [dist/]
tags: [cm-official-docker-executor]
docker_test:
image: $DOCKER_MIRROR_ARTIFACTORY/docker:19.03.12
stage: test
allow_failure: true
services:
- docker:19.03.12-dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
script:
# Get docker image from artifacts
- >
if [[ ${CI_COMMIT_TAG} ]]; then
IMAGE_TAG=$CI_COMMIT_TAG
else
IMAGE_TAG=$CI_COMMIT_REF_NAME
fi
- echo $CI_PROJECT_NAME:$IMAGE_TAG
- docker load < dist/$CI_PROJECT_NAME-$IMAGE_TAG.tar.gz
# as3 ucs convertion
- docker run -v $CI_PROJECT_DIR/test:/app/test/ $CI_PROJECT_NAME:$CI_COMMIT_REF_NAME
-u test/basic_install.ucs -o test/output1.json
# as3 conf convertion
- docker run -v $CI_PROJECT_DIR/test:/app/test $CI_PROJECT_NAME:$CI_COMMIT_REF_NAME
-c test/main/main.conf -o test/output2.json
# DO ucs convertion
- docker run -v $CI_PROJECT_DIR/test:/app/test $CI_PROJECT_NAME:$CI_COMMIT_REF_NAME
-u test/basic_install.ucs -o test/output3.json --declarative-onboarding
# DO conf convertion
- docker run -v $CI_PROJECT_DIR/test:/app/test $CI_PROJECT_NAME:$CI_COMMIT_REF_NAME
-c test/main/main.conf -o test/output4.json --declarative-onboarding
# verify output file has contents
- ls -la test/
- ACC_WC=$( wc -l < test/output1.json )
- DO_WC=$( wc -l < test/output3.json )
- if [ $DO_WC -eq 0 ] ; then exit 1; fi;
- if [ $ACC_WC -eq 0 ] ; then exit 1; fi;
needs: ["build_image"]
tags: [automation-toolchain-docker-executor]
# Coverage reports
pages:
stage: docs
only: [develop]
needs: [create_docs, coverage]
tags: [cm-official-docker-executor]
script:
- PUBLIC_DIR='./public'
- PUBLIC_DOCS=${PUBLIC_DIR}/public-docs
- COVERAGE_DOCS=${PUBLIC_DIR}/coverage-docs
- mkdir -p ${PUBLIC_DIR}
- mkdir -p ${PUBLIC_DOCS}
- mkdir -p ${COVERAGE_DOCS}
- cp docs/index.html ${PUBLIC_DIR}/index.html
- cp -R docs/_build/html/* ${PUBLIC_DOCS}
- cp -R coverage/* ${COVERAGE_DOCS}
artifacts:
paths: [public]
pack_code:
stage: build
needs: []
script:
- source scripts/build/pack-code.sh
artifacts:
name: $CI_PROJECT_NAME-$CI_BUILD_REF
paths: [dist/]
tags: [cm-official-docker-executor]
# PUBLISH STAGING #
publish_staging_docs:
image: $CONTAINTHEDOCS_IMAGE
stage: publish
needs: [create_docs]
only: [docs-staging]
environment:
name: staging
url: https://clouddocs.f5networks.net/products/extensions/f5-automation-config-converter/latest/
script:
- aws s3 sync docs/_build/html s3://clouddocs.f5networks.net/products/extensions/f5-automation-config-converter/latest
# create invalidation to clear cloudfront cache
- aws cloudfront create-invalidation --distribution-id $AWS_DIST --paths /products/extensions/f5-automation-config-converter/latest
tags: [cm-official-docker-executor]
# PUBLISH #
publish_image:
retry: 2
image: $ATG_IMG_REGISTRY_URL/docker:20
stage: publish
needs: [build_image, pack_code]
script:
- apk --no-cache add curl
- source scripts/publish/image-publish.sh
tags: [cm-official-docker-executor]
publish_docs:
image: ${CONTAINTHEDOCS_IMAGE}
stage: publish
needs: [create_docs]
only: [docs-latest]
environment:
name: production
url: https://clouddocs.f5.com/products/extensions/f5-automation-config-converter/latest
script:
- aws s3 sync docs/_build/html s3://clouddocs.f5.com/products/extensions/f5-automation-config-converter/latest
# create invalidation to clear cloudfront cache
- aws cloudfront create-invalidation --distribution-id $AWS_DIST --paths /products/extensions/f5-automation-config-converter/latest
tags: [cm-official-docker-executor]
# TEST #
#
# all jobs below belongs to automation-toolchain/atg-shared-templates
# and ACC pipeline need to make them to wait for artifacts from
# 'fetch_dependencies' job, otherwise those jobs will fail due not
# complete list of dependencies
lint:
stage: test
needs: [fetch_dependencies]
coverage:
stage: test
needs: [fetch_dependencies]
audit:
stage: test
needs: [fetch_dependencies]
check_copyrights:
stage: test
needs: [fetch_dependencies]
unit_test:
stage: test
needs: [fetch_dependencies]