-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
270 lines (232 loc) · 7.23 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
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
#
# CI for Aegir Hosting System
#
# For docs see http://docs.aegirproject.org
# and http://docs.aegirproject.org/en/3.x/community/release-process/#setting-up-a-gitlab-runner
# Is performed before the scripts in the stages step
before_script:
- source /etc/profile
# Defines stages which are to be executed
stages:
- syntax
- build
- test
# - publish
# - upgradetest
#
### Stage syntax
#
syntax:lint:
stage: syntax
image: php:7.3-cli
allow_failure: false
script:
- echo "Syntax checking PHP files"
- echo "For more information http://www.icosaedro.it/phplint/"
- vendor/bin/phplint ./ --exclude "vendor"
#
### Stage "build"
#
build:deb:
stage: build
image: aegir/hostmaster:packaging_base
script:
- export commit=$(git log -n 1 --oneline | sed 's/ .*$//')
- export version=$(sed -ne 's/^[^(]*(\([^)]*\)).*/\1/;1p' debian/changelog)
- export new_version="${version}+${CI_BUILD_ID}.${commit}"
- dch -D unstable --newversion "$new_version" "automatic GitLab CI build ${CI_BUILD_ID}"
- dpkg-buildpackage
- mkdir build
- mv -v ../aegir3*.deb build/
- mv -v ../aegir-archive-keyring*.deb build/
- mv -v ../aegir3*.tar.gz build/
- mv -v ../aegir3*.dsc build/
- mv -v ../aegir3*.changes build/
# The files which are to be made available in GitLab as artifacts.
artifacts:
paths:
- build/*
#
### Stage "test"
#
test:debian-buster-aegir3-apt:
stage: test
image: debian:buster
allow_failure: false
dependencies:
- build:deb
before_script:
- apt-get update
# Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start.
- echo "#!/bin/sh" > /usr/sbin/policy-rc.d
- echo "exit 0" >> /usr/sbin/policy-rc.d
- apt-get install --yes sudo curl
script: "scripts/ci-aegir-dev-install-apt-debian10.sh"
test:ubuntu-xenial-aegir3-apt:
stage: test
image: ubuntu:xenial
dependencies:
- build:deb
only:
- 7.x-3.x
- /^7\.x-3\.\d+\.x/
- /-runalltests$/
before_script:
- apt-get update
# Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start.
- echo "#!/bin/sh" > /usr/sbin/policy-rc.d
- echo "exit 0" >> /usr/sbin/policy-rc.d
- apt-get install --yes sudo curl
script: "scripts/ci-aegir-dev-install-apt-ubuntu-xenial.sh"
test:ubuntu-bionic-aegir3-apt:
stage: test
image: ubuntu:bionic
dependencies:
- build:deb
only:
- 7.x-3.x
- /^7\.x-3\.\d+\.x/
- /-runalltests$/
before_script:
- apt-get update
# Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start.
- echo "#!/bin/sh" > /usr/sbin/policy-rc.d
- echo "exit 0" >> /usr/sbin/policy-rc.d
- apt-get install --yes sudo curl
script: "scripts/ci-aegir-dev-install-apt-ubuntu-bionic.sh"
test:ubuntu-focal-aegir3-apt:
stage: test
image: ubuntu:focal
dependencies:
- build:deb
allow_failure: true
only:
- 7.x-3.x
- /^7\.x-3\.\d+\.x/
- /-runalltests$/
before_script:
- apt-get update
# Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start.
- echo "#!/bin/sh" > /usr/sbin/policy-rc.d
- echo "exit 0" >> /usr/sbin/policy-rc.d
- apt-get install --yes sudo curl
script: "scripts/ci-aegir-dev-install-apt-ubuntu-focal.sh"
#test:cluster-slave-debian-stretch-apt:
# stage: test
# image: debian:stretch
# allow_failure: false
# dependencies:
# - build:deb
#
# only:
# - 7.x-3.x
# - /^7\.x-3\.\d+\.x/
# - /-runalltests$/
#
# before_script:
# - apt-get update
# # Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start.
# - echo "#!/bin/sh" > /usr/sbin/policy-rc.d
# - echo "exit 0" >> /usr/sbin/policy-rc.d
# - apt-get install --yes sudo curl
#
# script: "scripts/ci-aegir-dev-install-apt-debian9-cluster-slave.sh"
test:behat:
stage: test
image: aegir/hostmaster:packaging_base
dependencies:
- build:deb
allow_failure: true
variables:
AEGIR_TESTS_VERSION: "master"
only:
- /-runalltests$/
before_script:
- sudo apt-get update
- sudo apt-get install --yes apt-transport-https ca-certificates curl gnupg2 software-properties-common
- curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
- sudo apt-key fingerprint 0EBFCD88
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
- sudo apt-get update
- sudo apt-get install --yes docker-ce
- docker info
- git clone http://github.com/aegir-project/tests.git tests
- cd tests
- git checkout $AEGIR_TESTS_VERSION
# Run prepare scripts.
- cd travis
- sudo bash prepare-docker.sh
- bash prepare-testenv.sh
script:
# Tests are included in the docker-compose.yml file in the tests repo.
- sudo docker-compose -f docker-compose-provision.yml run hostmaster
#
### Stage "publish"
#
#publish:unstable-repo:
# stage: publish
# dependencies:
# - build:deb
#
# only:
# - 7.x-3.x
# - /^7\.x-3\.\d+\.x/
#
# image: ruby:2.1
# before_script:
# # install ssh-agent
# - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
#
# # run ssh-agent
# - eval $(ssh-agent -s)
#
# # add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
# - ssh-add <(echo "$SSH_PRIVATE_KEY")
#
# - mkdir -p ~/.ssh
# - ls -la /.dockerenv
# - echo "$SSH_SERVER_HOSTKEYS" > ~/.ssh/known_hosts
# - cat ~/.ssh/known_hosts
#
# script:
# - ls -lah build/*
# - scp build/* [email protected]:/var/www/repos/incoming/
# # reprepro should pick this up in seconds and update the repository index.
#
### Stage "upgradetest"
#
## Upgrade the latest stable Aegir to our unstable repo.
#upgradetest:debian-stretch-aegir3-apt-upgrade:
# stage: upgradetest
# image: debian:buster
# dependencies:
# - publish:unstable-repo
#
# only:
# - 7.x-3.x
# - /^7\.x-3\.\d+\.x/
# - /-runalltests$/
#
# before_script:
# - apt-get update
# # Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start.
# - echo "#!/bin/sh" > /usr/sbin/policy-rc.d
# - echo "exit 0" >> /usr/sbin/policy-rc.d
# - apt-get install --yes sudo curl cron
#
# script:
# - "scripts/ci-aegir-stable-install-apt-debian10.sh"
# # extra step to run the task queue.
# - sudo su aegir --login --command 'drush @hostmaster php-eval "echo hosting_task_count();"'
# - sudo su aegir --login --command 'drush @hostmaster hosting-tasks --force'
# - sudo su aegir --login --command 'drush @hostmaster php-eval "echo hosting_task_count();"'
# - sudo su aegir --login --command 'drush @hostmaster hosting-tasks --force'
# - sudo su aegir --login --command 'drush @hostmaster php-eval "echo hosting_task_count();"'
# - sudo su aegir --login --command 'drush @hostmaster php-eval "echo hosting_task_count_running();"'
# - sleep 2m
# - sudo su aegir --login --command 'drush @hostmaster php-eval "echo hosting_task_count_running();"'
# # upgrade to the latest version from the unstable repo.
# - rm -v /etc/apt/sources.list.d/aegir-stable.list
# - echo "deb [signed-by=/usr/share/keyrings/aegir-archive-keyring.gpg] http://debian.aegirproject.org unstable main" | sudo tee -a /etc/apt/sources.list.d/aegir-unstable.list
# - sudo apt-get update
# - sudo DEBIAN_FRONTEND=noninteractive apt-get --yes dist-upgrade