-
Notifications
You must be signed in to change notification settings - Fork 47
/
.gitlab-ci.yml
140 lines (130 loc) · 4.8 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
stages:
- build
- test
variables:
BUILD_HELPERS_VERSION: 1aac59c8c8c2559448851ca5c6820fcf3a363363
DRBD9_TESTS_REF: master
# we have to change the way GitLab CI clones the repository.
# by default, it is shallow, which gives us a wrong commit count when
# we do `git rev-list --count origin/master` below.
GIT_DEPTH: 0
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: normal
.setup-lbbuild:
before_script:
- . .gitlab/gitlab-utils.sh
- drbd_prepare_tools
- drbd_fetch_lbbuildctl
- git clone --branch ${DRBD9_TESTS_REF} https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/drbd/drbd9-tests.git
- |
drbd_utils_build () {
local version="$1"
local release="$2"
dummy-release.sh drbd-utils "$version" "$release" drbd.spec.in
sed -i "s/^AC_INIT.*/AC_INIT(DRBD, $version, [[email protected]])/" configure.ac
git config --global user.email "invalid@linbit"
git config --global user.name "Dummy"
git commit -am "CI $version - $release"
./autogen.sh
./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --without-manual
install /dev/null $(which lbvers.py)
make debrelease VERSION="$version" FORCE=1
curl -isSf -u $LINBIT_REGISTRY_USER:$LINBIT_REGISTRY_PASSWORD --upload-file drbd-utils-*.tar.gz $LINBIT_REGISTRY_URL/repository/lbbuild-upstream/
# Distributions, comma separated.
# * "mainline" is excluded because the user space components are the same as the base distribution.
# * rhelX.y is replaced by rhelX.0
local dists=$(rq -t < drbd9-tests/virter/vms.toml | jq -r '[
.vms[].metadata.BuildDistribution
| select(. != "mainline")
| sub("rhel(?<major>\\d)\\.\\d"; "rhel\(.major).0")
] | unique | join(",")')
lbbuildctl build drbd-utils --arch amd64 --ci -v "$DRBD_UTILS_VERSION" \
-e LINBIT_REGISTRY_USER=$LINBIT_REGISTRY_USER \
-e LINBIT_REGISTRY_PASSWORD=$LINBIT_REGISTRY_PASSWORD \
-e LINBIT_REGISTRY_URL=$LINBIT_REGISTRY_URL \
-d $dists
}
# rules clause determining whether to build
.rules-build:
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_BRANCH == 'master'
build:
stage: build
extends: [ .rules-build, .setup-lbbuild ]
image: $LINBIT_DOCKER_REGISTRY/build-helpers:$BUILD_HELPERS_VERSION
cache:
paths:
- download
script:
- if [ "$CI_COMMIT_BRANCH" = master ]; then
- DRBD_UTILS_VERSION=9.0.0.latest
- DRBD_UTILS_RELEASE=$(git rev-list --count origin/master)
- else
- DRBD_UTILS_VERSION=9.0.0.$CI_COMMIT_SHA
- DRBD_UTILS_RELEASE=1
- fi
- drbd_utils_build $DRBD_UTILS_VERSION $DRBD_UTILS_RELEASE
drbd-utils-tests:
stage: test
rules:
- if: $CI_MERGE_REQUEST_ID
image: fedora
needs: []
variables:
CC: clang
CFLAGS: -fsanitize=address -fsanitize=undefined
LDFLAGS: -fsanitize=address -fsanitize=undefined
# We ignore leaks for now, too many issues here
ASAN_OPTIONS: log_path=sanitizer,log_exe_name=yes,log_suffix=.txt,detect_leaks=0
UBSAN_OPTIONS: log_path=sanitizer,log_exe_name=yes,log_suffix=.txt
before_script:
- dnf install -y clang llvm libubsan libasan keyutils-libs-devel flex git clitest automake
script:
- ./autogen.sh
- ./configure --without-manual
- make test
artifacts:
when: always
paths:
- "**/sanitizer.*.txt"
drbd-tests:
stage: test
rules:
- if: $CI_MERGE_REQUEST_ID
tags:
- libvirt
needs:
- build
cache:
paths:
- download
before_script:
- git clone --branch ${DRBD9_TESTS_REF} https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/drbd/drbd9-tests.git
script:
- . drbd9-tests/virter/version.env
- curl -sSfL -u gitlab-ci-token:$CI_JOB_TOKEN $CI_SERVER_URL/linbit/build-helpers/-/archive/$BUILD_HELPERS_VERSION/ignored.tar.gz | tar -xvzf -
- mv build-helpers-* build-helpers
- . build-helpers/gitlab-utils.sh
- |
ci_prepare_tools
ci_fetch_rq
ci_fetch_binary virter virter-$VIRTER_VERSION https://github.com/LINBIT/virter/releases/download/$VIRTER_VERSION/virter-linux-amd64
ci_fetch_binary vmshed vmshed-$VMSHED_VERSION https://github.com/LINBIT/vmshed/releases/download/$VMSHED_VERSION/vmshed-linux-amd64
- export DRBD_TEST_DOCKER_IMAGE=$LINBIT_DOCKER_REGISTRY/drbd9-tests:latest
- docker image pull $DRBD_TEST_DOCKER_IMAGE
- |
export DRBD_VERSION=9.1.0.latest
export DRBD_UTILS_VERSION=9.0.0.$CI_COMMIT_SHA-1
cd drbd9-tests
./virter/run-test.sh --out-dir=../tests-out
dependencies:
- build
artifacts:
# provide a convenient name so that the downloaded artifacts can be identified
name: $CI_PROJECT_NAME-$CI_JOB_ID
paths:
- tests-out/
when: always
reports:
junit: tests-out/test-results/*.xml