blob: c776975a1c71d88784d11d3c744b252691e6766b (
plain)
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
|
stages:
- build
- test
- publish
default:
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.14-git-2.28
tags:
- gitlab-org
variables:
DOCKER_DRIVER: overlay2
CUSTOM_IMAGE_VERSION: ruby-2.6-golang-1.13-git-2.28
SAST_DISABLE_DIND: "true"
SAST_DEFAULT_ANALYZERS: "gosec"
GIT_VERSION: "v2.27.0"
danger-review:
image: registry.gitlab.com/gitlab-org/gitlab-build-images:danger
allow_failure: true
stage: build
only:
- branches@gitlab-org/gitaly
except:
- tags
- master
script:
- git version
- danger
.cache: &cache_definition
cache:
key:
files:
- Makefile
- ruby/Gemfile.lock
prefix: git-${GIT_VERSION}
paths:
- _build/git
- _build/libgit2
- _build/Makefile.sha256
- ruby/vendor/bundle
.test_template: &test_definition
<<: *cache_definition
stage: test
# Override the cache definition for pull
cache:
key:
files:
- Makefile
- ruby/Gemfile.lock
prefix: git-${GIT_VERSION}
paths:
- _build/git
- _build/libgit2
- _build/Makefile.sha256
- ruby/vendor/bundle
policy: pull
artifacts:
paths:
- ruby/tmp/gitaly-rspec-test.log
when: on_failure
expire_in: 1 week
.postgres_template: &postgres_definition
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.14-git-2.28-pgbouncer-1.14
services:
- postgres:11.8
variables:
PGHOST: postgres
PGPORT: 5432
PGUSER: postgres
POSTGRES_HOST_AUTH_METHOD: trust
PGHOST_PGBOUNCER: 0.0.0.0
PGPORT_PGBOUNCER: 6432
before_script:
- go version
- git version
- pgbouncer --version
- adduser --no-create-home --disabled-password --disabled-login --quiet --force-badname --gecos '' pgbouncer-runner
- su pgbouncer-runner -c 'pgbouncer internal/praefect/datastore/glsql/testdata/pgbouncer.ini' &
- for i in {1..10}; do psql -U $PGUSER -c 'select now()' && break; done || { echo 'pgbouncer awaiting failed' ; exit 1; }
verify:
<<: *cache_definition
stage: test
script:
- make verify
proto:
<<: *cache_definition
stage: test
script:
- make proto no-changes
artifacts:
paths:
- ruby/proto/gitaly/*
- proto/go/gitalypb/*
- proto.diff
when: on_failure
build:
<<: *cache_definition
stage: build
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-${GO_VERSION}-git-2.28
script:
- go version
- make all git
- _support/test-boot .
parallel:
matrix:
- GO_VERSION: [ "1.13", "1.14" ]
GIT_VERSION: [ "v2.26.2", "v2.27.0", "v2.28.0" ]
binaries:
<<: *cache_definition
stage: build
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-${GO_VERSION}-git-2.28
only:
- tags
script:
# Just in case we start running CI builds on other architectures in future
- go version
- make binaries
artifacts:
paths:
- _build/assembly/checksums.sha256.txt
- _build/assembly/bin/
name: "${CI_JOB_NAME}:go-${GO_VERSION}-git-${GIT_VERSION}"
expire_in: 6 months
parallel:
matrix:
- GO_VERSION: "1.14"
GIT_VERSION: "v2.27.0"
- GO_VERSION: "1.13"
GIT_VERSION: "v2.26.2"
test:
<<: *test_definition
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-${GO_VERSION}-git-2.28
script:
- go version
- _build/git/bin/git version
- make ${TARGET}
artifacts:
paths:
- _build/reports/go-tests-report-go-${GO_VERSION}-git-${GIT_VERSION}.xml
reports:
junit: _build/reports/go-tests-report-go-${GO_VERSION}-git-${GIT_VERSION}.xml
parallel:
matrix:
- GO_VERSION: [ "1.13", "1.14" ]
GIT_VERSION: [ "v2.26.2", "v2.27.0", "v2.28.0" ]
TARGET: test
- GO_VERSION: "1.14"
GIT_VERSION: "v2.27.0"
TARGET: [ test-with-proxies, test-with-praefect, race-go ]
test:master:
<<: *test_definition
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-${GO_VERSION}-git-2.28
script:
- go version
- make all ${TARGET}
parallel:
matrix:
- GO_VERSION: "1.14"
GIT_VERSION: "master"
TARGET: [ test, test-with-proxies, test-with-praefect ]
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
cover:
<<: *cache_definition
<<: *postgres_definition
stage: test
script:
- make cover
artifacts:
reports:
cobertura: _build/cover/cobertura.xml
.build_image: &build_image
stage: publish
image: docker:latest
tags:
- gitlab-org-docker
services:
- docker:dind
docker:
<<: *build_image
script:
- mkdir -p _support/build-images/$CI_JOB_NAME/
- cp ruby/Gemfile ruby/Gemfile.lock _support/build-images/$CI_JOB_NAME/
- cp _support/build-images/versioned/Dockerfile _support/build-images/$CI_JOB_NAME/
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE/gitaly:latest --build-arg CUSTOM_IMAGE_VERSION=$CUSTOM_IMAGE_VERSION _support/build-images/$CI_JOB_NAME
- docker push $CI_REGISTRY_IMAGE/gitaly:latest
only:
refs:
- master@gitlab-org/gitaly
variables:
- $CI_PIPELINE_SOURCE != "schedule"
except:
docker-tag:
<<: *build_image
script:
- mkdir -p _support/build-images/$CI_JOB_NAME/
- cp ruby/Gemfile ruby/Gemfile.lock _support/build-images/$CI_JOB_NAME/
- cp _support/build-images/versioned/Dockerfile _support/build-images/$CI_JOB_NAME/
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE/gitaly:$CI_COMMIT_TAG --build-arg CUSTOM_IMAGE_VERSION=$CUSTOM_IMAGE_VERSION _support/build-images/$CI_JOB_NAME
- docker push $CI_REGISTRY_IMAGE/gitaly:$CI_COMMIT_TAG
only:
refs:
- tags@gitlab-org/gitaly
variables:
- $CI_PIPELINE_SOURCE != "schedule"
include:
- template: Security/License-Scanning.gitlab-ci.yml
- template: Security/SAST.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
- template: Security/Coverage-Fuzzing.gitlab-ci.yml
gosec-sast:
before_script:
- apk add pkgconfig libgit2-dev gcc libc-dev
license_scanning:
before_script:
- sudo apt-get update
- sudo apt-get install -y libicu-dev libgit2-dev cmake
variables:
LICENSE_FINDER_CLI_OPTS: '--aggregate-paths=. ruby'
praefect_sql_connect:
<<: *test_definition
services:
- postgres:11.8
variables:
POSTGRES_DB: praefect_test
POSTGRES_USER: praefect
POSTGRES_PASSWORD: sql-password
script:
- make
# Sanity check: direct ping with psql
- PGPASSWORD=$POSTGRES_PASSWORD psql -h postgres -U $POSTGRES_USER -d $POSTGRES_DB -c 'select now()'
- ruby -rerb -e 'ERB.new(ARGF.read).run' _support/config.praefect.toml.ci-sql-test.erb > config.praefect.toml
- ./praefect -config config.praefect.toml sql-ping
- ./praefect -config config.praefect.toml sql-migrate
praefect_sql_test:
<<: *test_definition
<<: *postgres_definition
script:
- make test-postgres
lint:
# Only Go 1.13 currently officially supported
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.13-git-2.28
stage: test
retry: 2
script:
- go version
- make lint
objectinfo_fuzz_test:
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.13-git-2.26
extends: .fuzz_base
stage: test
script:
- apt update && apt install -y clang-7
- go get github.com/dvyukov/go-fuzz/go-fuzz && go get github.com/dvyukov/go-fuzz/go-fuzz-build
- /root/go/bin/go-fuzz-build -libfuzzer -o objectinfo_fuzzer.a ./internal/git/catfile
- clang-7 -fsanitize=fuzzer objectinfo_fuzzer.a -o objectinfo_fuzzer
- ./gitlab-cov-fuzz run -- ./objectinfo_fuzzer -max_total_time=300
code_navigation:
allow_failure: true
script:
- go get github.com/sourcegraph/lsif-go/cmd/lsif-go
- ~/go/bin/lsif-go
artifacts:
reports:
lsif: dump.lsif
|