-
Notifications
You must be signed in to change notification settings - Fork 12
/
.gitlab-ci.yml
196 lines (179 loc) · 5.3 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
variables:
DOCKER_REPOSITORY: mendersoftware/deviceconnect
# Setup containers to use docker dind service
DOCKER_HOST: "tcp://docker:2376"
DOCKER_CERT_PATH: "/certs/client"
DOCKER_TLS_VERIFY: 1
DOCKER_TLS_CERTDIR: "/certs" # Where docker:dind should generate certs
MULTIPLATFORM_BUILD: "true"
MULTIPLATFORM_PLATFORMS: "linux/amd64,linux/arm64"
stages:
- test
- build
- publish
- version-bump
include:
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-golang-lint.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-golang-unittests.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-apidocs.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-commits.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-license.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-github-status-updates.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-docker-build.yml'
test:unit:
needs: []
services:
- name: mongo:4.4
alias: mender-mongo
variables:
DEVICECONNECT_MONGO_URL: "mongodb://mender-mongo"
test:acceptance:
stage: test
needs: []
except:
- /^saas-[a-zA-Z0-9.-]+$/
tags:
- hetzner-amd-beefy
image: docker:20.10.21
services:
- name: docker:20.10.21-dind
alias: docker
before_script:
- apk add docker-compose make
script:
- make acceptance-tests
after_script:
- set -- tests/coverage-acceptance@*.txt
- head -n 1 $1 > tests/coverage-acceptance.txt
- |
for cover in $@; do
tail -n +2 $cover >> tests/coverage-acceptance.txt;
done
artifacts:
expire_in: 2w
paths:
- tests/acceptance.*
- tests/coverage-acceptance.txt
when: always
# excludes non multiplatform build job
build:docker:
rules:
- when: never
# excludes non multiplatform build job
publish:image:
rules:
- when: never
# excludes non multiplatform job
publish:image:saas:
rules:
- when: never
# excludes non multiplatform build job
publish:image:mender:
rules:
- when: never
publish:acceptance:
stage: publish
except:
- /^saas-[a-zA-Z0-9.-]+$/
image: golang:1.18
needs:
- job: test:acceptance
artifacts: true
before_script:
- GO111MODULE=off go get github.com/mattn/goveralls
# Coveralls env variables:
# According to https://docs.coveralls.io/supported-ci-services
# we should set CI_NAME, CI_BUILD_NUMBER, etc. But according
# to goveralls source code (https://github.com/mattn/goveralls)
# many of these are not supported. Set CI_BRANCH, CI_PR_NUMBER,
# and pass few others as command line arguments.
# See also https://docs.coveralls.io/api-reference
- export CI_BRANCH=${CI_COMMIT_BRANCH}
script:
- goveralls
-repotoken ${COVERALLS_TOKEN}
-service gitlab-ci
-jobid $CI_PIPELINE_ID
-covermode atomic
-flagname acceptance
-parallel
-coverprofile ./tests/coverage-acceptance.txt
#
# Alvaldi Helm Rolling release
#
.trigger:alvaldi-helm-version-bump:
stage: version-bump
allow_failure: true
trigger:
project: Northern.tech/NorthernTechHQ/alvaldi-helm
strategy: depend
resource_group: alvaldi-helm
variables:
SYNC_CONTAINER_NAME: $CONTAINER_NAME
SYNC_IMAGE_TAG: $DOCKER_PUBLISH_COMMIT_TAG
CONTAINER: deviceconnect
DOCKER_PUBLISH_COMMIT_TAG: ${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}
GITHUB_HELM_REPO: "github.com/NorthernTechHQ/alvaldi-helm.git"
CHART_DIR: "alvaldi"
trigger:alvaldi-helm-version-bump:staging:
extends:
- .trigger:alvaldi-helm-version-bump
rules:
- if: $CI_COMMIT_BRANCH =~ /^(staging)$/
variables:
SYNC_ENVIRONMENT: staging
HELM_PATCH_VERSION: ${CI_PIPELINE_ID}-staging # pre-release version for trigger staging only deploy
trigger:alvaldi-helm-version-bump:prod:
extends:
- .trigger:alvaldi-helm-version-bump
rules:
- if: '$CI_COMMIT_TAG =~ /^saas-[a-zA-Z0-9.]+$/'
when: manual
variables:
SYNC_ENVIRONMENT: prod
HELM_PATCH_VERSION: ${CI_PIPELINE_ID}
DOCKER_PUBLISH_COMMIT_TAG: ${CI_COMMIT_REF_NAME}
test:validate-open-api:
allow_failure: false
#
# Mender Helm Rolling release
#
.trigger:mender-helm-version-bump:
stage: version-bump
allow_failure: true
trigger:
project: Northern.tech/Mender/mender-helm
strategy: depend
resource_group: mender-helm
variables:
SYNC_CONTAINER_NAME: $CONTAINER_NAME
SYNC_IMAGE_TAG: $DOCKER_PUBLISH_COMMIT_TAG
CONTAINER: deviceconnect
DOCKER_PUBLISH_COMMIT_TAG: ${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}
GITHUB_HELM_REPO: "github.com/mendersoftware/mender-helm.git"
CHART_DIR: "mender"
trigger:mender-helm-version-bump:staging:
extends:
- .trigger:mender-helm-version-bump
rules:
- if: $CI_COMMIT_BRANCH =~ /^(staging)$/
variables:
SYNC_ENVIRONMENT: staging
HELM_PATCH_VERSION: ${CI_PIPELINE_ID}-staging # pre-release version for trigger staging only deploy
trigger:mender-helm-version-bump:prod:
extends:
- .trigger:mender-helm-version-bump
rules:
- if: '$CI_COMMIT_TAG =~ /^saas-[a-zA-Z0-9.]+$/'
when: manual
variables:
SYNC_ENVIRONMENT: prod
HELM_PATCH_VERSION: ${CI_PIPELINE_ID}
DOCKER_PUBLISH_COMMIT_TAG: ${CI_COMMIT_REF_NAME}