-
Notifications
You must be signed in to change notification settings - Fork 8
/
.gitlab-ci.yml
142 lines (133 loc) · 4.01 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
# Run python tests.
image: pgpgpro/dev:stretch
.only-default: &only-default
only:
refs:
- merge_requests
- tags
- schedules
- branches
- pushes
- web
- triggers
changes:
- '**/*'
# Tests are docker-based, and so is gitlab executor itself. We are using a bit
# monstrous (and recommended) approach of running dind 'service' container
# alongside main executor; it runs docker and exposes its socket:
# https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-the-docker-executor-with-the-docker-image-docker-in-docker
# These variables tell the executor how to reach the socket.
#
# The 'docker' hostname is the alias of the service container as described at
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services
.docker_variables: &docker_variables
DOCKER_HOST: tcp://docker:2375/
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
stages:
- build_core_image
- make_check
# hardcoded stuff in python tests doesn't allow to run them in parallel
- recovery random
- referee
- syncpoint
# builds image with ee core and saves it as an artifact
build_core_image:
<<: *only-default
stage: build_core_image
retry: 1
image: pgpgpro/dev:alpine
# run container providing docker alongside
services:
- docker:dind
variables:
<<: *docker_variables
branch: ee13_mm
artifacts:
expire_in: 24 hours
when: always
paths:
- docker-image/pgmm.tar.gz
- postgrespro.tar.gz
script:
# Add mm_gitlab_ci_ed25519 env var of type 'file' with the key in gitlab
- ssh-agent sh -c 'ssh-add ${mm_gitlab_ci_ed25519}; GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone --depth=1 --branch "${branch}" [email protected]:pgpro-dev/postgrespro.git'
- cd postgrespro
- docker build -t pgmm .
- cd ..
- mkdir docker-image
- docker save pgmm > docker-image/pgmm.tar
- tar czf docker-image/pgmm.tar.gz docker-image/pgmm.tar
- ls -lah docker-image/
- rm docker-image/pgmm.tar
# also save archived sources of core
- tar -czf postgrespro.tar.gz postgrespro
# make check. We build core from sources again which is a bit ugly as we already
# built the image, but let's not wobble here with yet another docker
make_check:
<<: *only-default
stage: make_check
# gives us the archive with core sources
dependencies:
- build_core_image
artifacts:
when: always
paths:
- postgrespro/contrib/mmts/tmp_check/log
- postgrespro/contrib/mmts/tmp_check/regress_outdir
script:
- ls
- tar -xzf postgrespro.tar.gz
- shopt -s extglob
- rm -rf postgrespro/contrib/mmts; mkdir postgrespro/contrib/mmts
- mv !(postgrespro) postgrespro/contrib/mmts
- cd postgrespro
- CFLAGS="-ggdb3 -O0" ./configure --enable-cassert --enable-debug --with-perl --enable-tap-tests
- make -j8
- cd contrib/mmts && make check
recovery_random:
<<: *only-default
stage: recovery random
image: pgpgpro/dev:alpine
services:
- docker:dind
dependencies:
- build_core_image
artifacts:
when: on_failure
paths:
- tests/logs1
- tests/logs2
- tests/logs3
variables:
<<: *docker_variables
before_script:
- docker info
script:
- tar -xzvf docker-image/pgmm.tar.gz
- docker load -i docker-image/pgmm.tar
- cd tests/
- env CI=1 python3 -u test_recovery_random.py --failfast
referee:
extends: recovery_random
stage: referee
artifacts:
paths:
- tests/logs1
- tests/logs2
- tests/logs_referee
script:
- tar -xzvf docker-image/pgmm.tar.gz
- docker load -i docker-image/pgmm.tar
- cd tests/
- env CI=1 python3 -u test_referee.py --failfast
syncpoint:
extends: recovery_random
stage: syncpoint
script:
- tar -xzvf docker-image/pgmm.tar.gz
- docker load -i docker-image/pgmm.tar
- cd tests/
- env CI=1 python3 -u test_syncpoint.py --failfast