-
Notifications
You must be signed in to change notification settings - Fork 35
265 lines (257 loc) · 7.66 KB
/
continuous-integration-workflow.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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
name: Continous Integration Tests
on:
push:
pull_request:
schedule:
- cron: '23 4 * * 1' # At 04:23 UTC on Mondays.
jobs:
jenkins-master:
name: Jenkins master tests
runs-on: ubuntu-22.04
steps:
-
name: Checkout repository
uses: actions/[email protected]
-
name: Build UBI8 docker image
run: |
./.github/workflows/build-docker-image.sh \
--imagename ods-jenkins-master-ubi8 \
--dockerdir jenkins/master \
--dockerfile Dockerfile.ubi8
jenkins-agent-base:
name: Jenkins agent base tests
runs-on: ubuntu-22.04
steps:
-
name: Checkout repository
uses: actions/[email protected]
- name: Build UBI8 docker image
run: |
./.github/workflows/build-docker-image.sh \
--imagename ods-jenkins-agent-base-ubi8 \
--dockerdir jenkins/agent-base \
--dockerfile Dockerfile.ubi8 \
--build-arg SNYK_DISTRIBUTION_URL="https://github.com/snyk/snyk/releases/download/v1.1097.0/snyk-linux"
- name: Push UBI8 docker image
if: success() && github.repository == 'opendevstack/ods-core' && github.event_name == 'push'
shell: bash
env:
DOCKER_USER: ${{ secrets.DockerHubUser }}
DOCKER_PASS: ${{ secrets.DockerHubPass }}
run: |
./.github/workflows/push-docker-image.sh \
--user "$DOCKER_USER" \
--password "$DOCKER_PASS" \
--imagename ods-jenkins-agent-base-ubi8
sonarqube:
name: SonarQube tests
runs-on: ubuntu-22.04
strategy:
matrix:
version: ['10.7.0'] # 9.9 = LTS
edition: ['community', 'developer', 'enterprise']
steps:
-
name: Checkout repository
uses: actions/[email protected]
-
name: Check shell scripts
run: |
shellcheck sonarqube/*.sh
-
name: Run tests
run: |
cd sonarqube && ./test.sh --sq-version=${{ matrix.version }} --sq-edition=${{ matrix.edition }}
nexus:
name: Nexus tests
runs-on: ubuntu-22.04
steps:
-
name: Checkout repository
uses: actions/[email protected]
-
name: Check shell scripts
run: |
shellcheck nexus/*.sh
-
name: Run tests
run: |
cd nexus && ./test.sh
webhook-proxy:
name: Webhook Proxy tests
runs-on: ubuntu-22.04
steps:
-
name: Checkout repository
uses: actions/[email protected]
-
name: Setup Go 1.23
uses: actions/setup-go@v5
with:
go-version: 1.23
-
name: Download goimports
run: |
go install golang.org/x/tools/cmd/goimports@latest
-
name: Download golangci-lint
run: |
curl -sSfL --output /tmp/golangci-lint.sh https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
cat /tmp/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.1
-
name: Run linter
working-directory: jenkins/webhook-proxy
run: |
export PATH=$PATH:$(go env GOPATH)/bin
make lint
-
name: Run tests
working-directory: jenkins/webhook-proxy
run: |
export PATH=$PATH:$(go env GOPATH)/bin
make test
-
name: Build docker image
run: |
./.github/workflows/build-docker-image.sh \
--imagename ods-webhook-proxy \
--dockerdir jenkins/webhook-proxy
create-projects:
name: Create Projects tests
runs-on: ubuntu-22.04
steps:
-
name: Checkout repository
uses: actions/[email protected]
-
name: Check shell scripts
run: |
shellcheck create-projects/*.sh
-
name: Run tests
working-directory: create-projects/tests
run: |
./run.sh
clone-check:
name: Verify clone script requirements
runs-on: ubuntu-22.04
steps:
-
name: Checkout repository
uses: actions/[email protected]
-
name: Check jsl expectations
run: |
ocp-scripts/verify-jsl-expectations.sh
-
name: Check compliant shell scripts
run: |
shellcheck --version
shellcheck ocp-scripts/clone-project.sh
shellcheck ocp-scripts/verify-jsl-expectations.sh
compile-go-tests:
name: Verify Go tests are formatted and can be compiled
runs-on: ubuntu-22.04
steps:
-
name: Checkout repository
uses: actions/[email protected]
-
name: Setup Go 1.18
uses: actions/setup-go@v5
with:
go-version: 1.18
-
name: Verify all Go files are formatted with gofmt
working-directory: tests
run: |
unformatted=$(gofmt -l .)
[ -z "$unformatted" ] && exit 0
echo >&2 "Go files must be formatted with gofmt. Please run:"
for fn in $unformatted; do
echo >&2 "Differences found:"
gofmt -d $fn
echo >&2 " gofmt -w $fn"
done
exit 1
-
name: Verify all Go tests pass linting
uses: golangci/golangci-lint-action@v6
with:
version: v1.49.0
working-directory: tests
args: --timeout=10m
-
name: Verify all Go tests can be compiled
working-directory: tests
run: |
go test -c ./create-projects
go test -c ./ods-verify
# cluster:
# name: Setup and project provisioning tests
# runs-on: ubuntu-22.04
# steps:
# -
# name: GitHub context
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
# run: jq . <<< "${GITHUB_CONTEXT}"
# -
# name: Checkout repository
# uses: actions/[email protected]
# with:
# fetch-depth: 0
# path: 'ods-core'
# -
# name: Setup Go 1.13
# uses: actions/[email protected]
# with:
# version: 1.13
# -
# name: Download OpenShift Client
# run: |
# wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
# tar -xzvf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
# sudo mv openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit/oc /usr/local/bin/oc
# -
# name: Download Tailor
# run: |
# curl -LO "https://github.com/opendevstack/tailor/releases/download/v0.13.1/tailor-linux-amd64"
# chmod +x tailor-linux-amd64
# sudo mv tailor-linux-amd64 /usr/local/bin/tailor
# -
# name: Tailor version
# run: tailor version
# -
# name: OpenShift client version
# run: oc version
# -
# name: jq version
# run: jq --version
# -
# name: golang version
# run: go version
# -
# name: Docker version
# run: docker --version
# -
# name: Network before changes
# run: ifconfig
# -
# name: Configure docker network and insecure registries
# run: ./ods-core/tests/scripts/apply-docker-settings.sh
# -
# name: Start OC cluster
# run: oc cluster up --base-dir=${HOME}/openshift.local.clusterup --routing-suffix 172.17.0.1.nip.io --public-hostname 172.17.0.1 --enable=centos-imagestreams --enable=persistent-volumes --enable=registry --enable=router
# -
# name: Login into the cluster
# run: oc login -u system:admin
# -
# name: Create test infrastructure
# run: |
# mkdir -p ods-config
# ./ods-core/tests/scripts/recreate-test-infrastructure.sh
# -
# name: Run tests
# run: make -C tests test