Skip to content

Commit fa27841

Browse files
author
MarcoFalke
committed
ci: Restart docker before run
Also, add setting for persistent worker in .cirrus.yml
1 parent fad4f48 commit fa27841

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.cirrus.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ env:
1010
cirrus_ephemeral_worker_template_env: &CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
1111
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
1212

13+
persistent_worker_template_env: &PERSISTENT_WORKER_TEMPLATE_ENV
14+
RESTART_CI_DOCKER_BEFORE_RUN: "1"
15+
16+
persistent_worker_template: &PERSISTENT_WORKER_TEMPLATE
17+
persistent_worker: {} # https://cirrus-ci.org/guide/persistent-workers/
18+
1319
# https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
1420
base_template: &BASE_TEMPLATE
1521
skip: $CIRRUS_REPO_FULL_NAME == "bitcoin-core/gui" && $CIRRUS_PR == "" # No need to run on the read-only mirror, unless it is a PR. https://cirrus-ci.org/guide/writing-tasks/#conditional-task-execution

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)