-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.gitlab-ci.yml
162 lines (143 loc) · 2.88 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
image: docker.anders.fi/anders/ci-configuration:v3
include:
- local: '.gitlab-ci-base-template.yml'
variables:
BOOTSTRAP_IMAGE: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}
DEVELOPMENT_IMAGE: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}-development
stages:
- build-bootstrap
- build
- test
- post-test
- release
.code-tests:
image: ${DEVELOPMENT_IMAGE}
stage: test
tags:
- light
only:
- merge_requests
- master
- v3
build-bootstrap:
extends: .build
stage: build-bootstrap
only:
- merge_requests
- master
- /^r-[\d]+$/
- v3
variables:
# Don't add any additional tags
DOCKER_IMAGE_TAGS: ""
# Don't build development image
DOCKER_TEST_IMAGE_STAGE: ""
build:
image: ${BOOTSTRAP_IMAGE}
extends: .build
only:
- merge_requests
- master
- /^r-[\d]+$/
- v3
variables:
# Don't add any additional tags
DOCKER_IMAGE_TAGS: ""
test-image:
extends: .docker-image-scan
allow_failure: true
variables:
# Scan production image instead of develoment image
DEVELOPMENT_IMAGE: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}-production
sonarqube:
extends: .sonarqube
needs: ["test","test-sast"]
dependencies:
- test
- test-sast
pages:
stage: release
image: ${DEVELOPMENT_IMAGE}
script:
- make docs
- mv -vi docs/_build/html public/
only:
- v3
artifacts:
paths:
- public
release-local:
stage: release
extends: .build
only:
- v3
release-dockerhub:
stage: release
extends: .build
variables:
CONTAINER_REGISTRY: index.docker.io
CONTAINER_REGISTRY_USER: ${DOCKERHUB_REGISTRY_USER}
CONTAINER_REGISTRY_PASSWORD: ${DOCKERHUB_REGISTRY_PASSWORD}
CONTAINER_REGISTRY_REPO: andersinnovations/devops
only:
- v2
test-helm:
extends: .test
script:
- make helm-tests
test-style:
extends: .code-tests
script:
- make style-tests
test-typing:
extends: .code-tests
script:
- make typing-tests
test-packages:
extends: .code-tests
script:
- make package-tests
allow_failure: true
test-docs:
extends: .code-tests
script:
- make docs
artifacts:
paths:
- docs/_build
expire_in: 1 week
test-sast:
extends: .code-tests
script:
- make sast-tests
artifacts:
when: always
paths:
- bandit_report.json
expire_in: 1 week
allow_failure: true
test:
extends: .test
image: ${BOOTSTRAP_IMAGE}
parallel:
matrix:
- PROVIDER: gke
K3S_VERSION:
- 1.24.9
- 1.27.7
- 1.28.3
artifacts:
expire_in: 1 week
paths:
- pytest.xml
- coverage.xml
when: always
only:
- merge_requests
- v3
before_script:
- git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@git.anders.fi/".insteadOf "[email protected]:"
- export PATH="$PATH:/app"
- source utils/shell_utils.sh
- set_docker_host
- echo 127.0.0.1 docker-registry >> /etc/hosts