Skip to content

Commit 1e3db68

Browse files
author
MarcoFalke
committed
Merge #21619: ci: Run self-hosted ci
fa41a91 ci: Run self-hosted ci (MarcoFalke) fa52a40 ci: Make cirrus cache folders relative to cirrus base dir (MarcoFalke) fa27841 ci: Restart docker before run (MarcoFalke) fad4f48 ci: [refactor] Create setting for ephemeral config in .cirrus.yml (MarcoFalke) Pull request description: Due to our heavy use of the Cirrus CI community cluster, some tasks may take a long time to get scheduled. While it is possible to use "Compute Credits" to get immediately scheduled on the cluster, I couldn't find a sponsor that'd be willing to cover the total cost, if all tasks were paid for with credits. However, it is also possible to bring our own runners to Cirrus CI. For testing purposes, a single task will be transformed to run on the DrahtBot infrastructure. If all goes well, the other tasks can be moved, too. ACKs for top commit: hebasto: ACK fa41a91, I have reviewed the code and it looks OK. Tree-SHA512: 513738daec36da8cd48a8f11e687ff0b7dfaba1ae4ed2fa77e7b043f88fd52bf5c0dbad2768e13df88518323917f08348cb62be6376a423142921f8d2c59a938
2 parents dd01dc6 + fa41a91 commit 1e3db68

File tree

2 files changed

+36
-11
lines changed

2 files changed

+36
-11
lines changed

.cirrus.yml

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,19 @@
33
env:
44
PACKAGE_MANAGER_INSTALL: "apt-get update && apt-get install -y"
55
MAKEJOBS: "-j4"
6-
DANGER_RUN_CI_ON_HOST: "1" # Containers will be discarded after the run, so there is no risk that the ci scripts modify the system
76
TEST_RUNNER_PORT_MIN: "14000" # Must be larger than 12321, which is used for the http cache. See https://cirrus-ci.org/guide/writing-tasks/#http-cache
87
CCACHE_SIZE: "200M"
98
CCACHE_DIR: "/tmp/ccache_dir"
9+
CCACHE_NOHASHDIR: "1" # Debug info might contain a stale path if the build dir changes, but this is fine
10+
11+
cirrus_ephemeral_worker_template_env: &CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
12+
DANGER_RUN_CI_ON_HOST: "1" # Containers will be discarded after the run, so there is no risk that the ci scripts modify the system
13+
14+
persistent_worker_template_env: &PERSISTENT_WORKER_TEMPLATE_ENV
15+
RESTART_CI_DOCKER_BEFORE_RUN: "1"
16+
17+
persistent_worker_template: &PERSISTENT_WORKER_TEMPLATE
18+
persistent_worker: {} # https://cirrus-ci.org/guide/persistent-workers/
1019

1120
# https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
1221
base_template: &BASE_TEMPLATE
@@ -31,9 +40,9 @@ global_task_template: &GLOBAL_TASK_TEMPLATE
3140
ccache_cache:
3241
folder: "/tmp/ccache_dir"
3342
depends_built_cache:
34-
folder: "/tmp/cirrus-ci-build/depends/built"
43+
folder: "depends/built"
3544
depends_sdk_cache:
36-
folder: "/tmp/cirrus-ci-build/depends/sdk-sources"
45+
folder: "depends/sdk-sources"
3746
ci_script:
3847
- ./ci/test_run_all.sh
3948

@@ -69,13 +78,16 @@ task:
6978
<< : *CREDITS_TEMPLATE
7079
lint_script:
7180
- ./ci/lint_run_all.sh
81+
env:
82+
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
7283

7384
task:
7485
name: 'ARM [unit tests, no functional tests] [buster]'
7586
<< : *GLOBAL_TASK_TEMPLATE
7687
container:
7788
image: debian:buster
7889
env:
90+
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
7991
FILE_ENV: "./ci/test/00_setup_env_arm.sh"
8092

8193
task:
@@ -84,6 +96,7 @@ task:
8496
container:
8597
image: ubuntu:focal
8698
env:
99+
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
87100
FILE_ENV: "./ci/test/00_setup_env_win64.sh"
88101

89102
task:
@@ -92,19 +105,18 @@ task:
92105
container:
93106
image: centos:8
94107
env:
108+
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
95109
PACKAGE_MANAGER_INSTALL: "yum install -y"
96110
FILE_ENV: "./ci/test/00_setup_env_i686_centos.sh"
97111

98112
task:
99113
name: '[previous releases, uses qt5 dev package and some depends packages] [unsigned char] [bionic]'
100-
# For faster CI feedback, immediately schedule a task that compiles most modules
101-
<< : *CREDITS_TEMPLATE
102114
<< : *GLOBAL_TASK_TEMPLATE
103115
depends_releases_cache:
104-
folder: "/tmp/cirrus-ci-build/releases"
105-
container:
106-
image: ubuntu:bionic
116+
folder: "releases"
117+
<< : *PERSISTENT_WORKER_TEMPLATE
107118
env:
119+
<< : *PERSISTENT_WORKER_TEMPLATE_ENV
108120
FILE_ENV: "./ci/test/00_setup_env_native_qt5.sh"
109121

110122
task:
@@ -115,6 +127,7 @@ task:
115127
cpu: 6 # Increase CPU and Memory to avoid timeout
116128
memory: 24G
117129
env:
130+
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
118131
MAKEJOBS: "-j8"
119132
FILE_ENV: "./ci/test/00_setup_env_native_tsan.sh"
120133

@@ -124,6 +137,7 @@ task:
124137
container:
125138
image: ubuntu:focal
126139
env:
140+
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
127141
FILE_ENV: "./ci/test/00_setup_env_native_msan.sh"
128142

129143
task:
@@ -132,6 +146,7 @@ task:
132146
container:
133147
image: ubuntu:focal
134148
env:
149+
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
135150
FILE_ENV: "./ci/test/00_setup_env_native_asan.sh"
136151

137152
task:
@@ -140,6 +155,7 @@ task:
140155
container:
141156
image: ubuntu:focal
142157
env:
158+
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
143159
FILE_ENV: "./ci/test/00_setup_env_native_fuzz.sh"
144160

145161
task:
@@ -148,6 +164,7 @@ task:
148164
container:
149165
image: ubuntu:focal
150166
env:
167+
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
151168
FILE_ENV: "./ci/test/00_setup_env_native_multiprocess.sh"
152169

153170
task:
@@ -156,6 +173,7 @@ task:
156173
container:
157174
image: ubuntu:bionic
158175
env:
176+
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
159177
FILE_ENV: "./ci/test/00_setup_env_native_nowallet.sh"
160178

161179
task:
@@ -164,6 +182,7 @@ task:
164182
container:
165183
image: ubuntu:focal
166184
env:
185+
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
167186
FILE_ENV: "./ci/test/00_setup_env_mac.sh"
168187

169188
task:
@@ -175,17 +194,18 @@ task:
175194
# Use latest image, but hardcode version to avoid silent upgrades (and breaks)
176195
image: big-sur-xcode-12.4 # https://cirrus-ci.org/guide/macOS
177196
env:
178-
DANGER_RUN_CI_ON_HOST: "true"
197+
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
179198
CI_USE_APT_INSTALL: "no"
180199
PACKAGE_MANAGER_INSTALL: "echo" # Nothing to do
181200
FILE_ENV: "./ci/test/00_setup_env_mac_host.sh"
182201

183202
task:
184203
name: 'ARM64 Android APK [focal]'
185204
depends_sources_cache:
186-
folder: "/tmp/cirrus-ci-build/depends/sources"
205+
folder: "depends/sources"
187206
<< : *GLOBAL_TASK_TEMPLATE
188207
container:
189208
image: ubuntu:focal
190209
env:
210+
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
191211
FILE_ENV: "./ci/test/00_setup_env_android.sh"

ci/test/04_install.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
3333
echo "Creating $DOCKER_NAME_TAG container to run in"
3434
${CI_RETRY_EXE} docker pull "$DOCKER_NAME_TAG"
3535

36-
DOCKER_ID=$(docker run $DOCKER_ADMIN -idt \
36+
if [ -n "${RESTART_CI_DOCKER_BEFORE_RUN}" ] ; then
37+
echo "Restart docker before run to stop and clear all containers started with --rm"
38+
systemctl restart docker
39+
fi
40+
41+
DOCKER_ID=$(docker run $DOCKER_ADMIN --rm --interactive --detach --tty \
3742
--mount type=bind,src=$BASE_ROOT_DIR,dst=/ro_base,readonly \
3843
--mount type=bind,src=$CCACHE_DIR,dst=$CCACHE_DIR \
3944
--mount type=bind,src=$DEPENDS_DIR,dst=$DEPENDS_DIR \

0 commit comments

Comments
 (0)