Skip to content

Commit 504f1f3

Browse files
committed
Merge bitcoin/bitcoin#28547: ci: Work around podman stop intermittent failure
fa2c894 ci: move-only CI_CONTAINER_ID to 02_run_container.sh (MarcoFalke) fa695b4 ci: Work around podman stop bug (MarcoFalke) fa09a03 ci: Add set -ex to 02_run_container.sh (MarcoFalke) fac9abb ci: Rename 04_install to 02_run_container (MarcoFalke) Pull request description: Sometimes, it seems that `podman stop` does not work. Presumably, it falls back to `podman kill`, which is async. Try to work around this intermittent issue by using the `rm --force` over `stop`. Example failing log https://cirrus-ci.com/task/4549784611061760?logs=ci#L238: ``` Restart docker before run to stop and clear all containers started with --rm ++ podman container stop --all e4eca0766f87864d89fc230aa884a238c214cfbcd44cf76a4dbdb2a30c982009 ++ echo 'Prune all dangling images' Prune all dangling images ++ docker image prune --force Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. +++ docker run --cap-add LINUX_IMMUTABLE --rm --interactive --detach --tty --mount type=bind,src=/tmp/cirrus-build-1970593815,dst=/tmp/cirrus-build-1970593815,readonly --mount type=volume,src=ci_macos_cross_ccache,dst=/tmp/ccache_dir --mount type=volume,src=ci_macos_cross_depends,dst=/ci_container_base/depends --mount type=volume,src=ci_macos_cross_previous_releases,dst=/ci_container_base/prev_releases --env-file /tmp/env --name ci_macos_cross ci_macos_cross Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. time="2023-09-27T20:55:39Z" level=warning msg="The input device is not a TTY. The --tty and --interactive flags might not work properly" Error: creating container storage: the container name "ci_macos_cross" is already in use by e4eca0766f87864d89fc230aa884a238c214cfbcd44cf76a4dbdb2a30c982009. You have to remove that container to be able to reuse that name: that name is already in use ACKs for top commit: hebasto: ACK fa2c894, I have reviewed the code and tested it locally. Tree-SHA512: 31fca340c6bedaadf4dd51fa745d9b3969042cebc0c7c904ef18af3f2f986039ec4354ccdff1422fbf77cf223e4423857368dce53cfa67ef15c76b78d007eace
2 parents 151a2b1 + fa2c894 commit 504f1f3

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

ci/test/04_install.sh renamed to ci/test/02_run_container.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
export LC_ALL=C.UTF-8
88

9+
set -ex
10+
911
if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
1012
# Export all env vars to avoid missing some.
1113
# Though, exclude those with newlines to avoid parsing problems.
@@ -27,14 +29,12 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
2729

2830
if [ -n "${RESTART_CI_DOCKER_BEFORE_RUN}" ] ; then
2931
echo "Restart docker before run to stop and clear all containers started with --rm"
30-
podman container stop --all # Similar to "systemctl restart docker"
32+
podman container rm --force --all # Similar to "systemctl restart docker"
3133
echo "Prune all dangling images"
3234
docker image prune --force
3335
fi
3436

3537
# shellcheck disable=SC2086
36-
37-
3838
CI_CONTAINER_ID=$(docker run --cap-add LINUX_IMMUTABLE $CI_CONTAINER_CAP --rm --interactive --detach --tty \
3939
--mount "type=bind,src=$BASE_READ_ONLY_DIR,dst=$BASE_READ_ONLY_DIR,readonly" \
4040
--mount "type=volume,src=${CONTAINER_NAME}_ccache,dst=$CCACHE_DIR" \
@@ -68,3 +68,10 @@ CI_EXEC "${BASE_ROOT_DIR}/ci/test/01_base_install.sh"
6868
CI_EXEC git config --global --add safe.directory \"*\"
6969

7070
CI_EXEC mkdir -p "${BINS_SCRATCH_DIR}"
71+
72+
CI_EXEC "${BASE_ROOT_DIR}/ci/test/06_script_b.sh"
73+
74+
if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
75+
echo "Stop and remove CI container by ID"
76+
docker container kill "${CI_CONTAINER_ID}"
77+
fi

ci/test_run_all.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
#!/usr/bin/env bash
22
#
3-
# Copyright (c) 2019-2020 The Bitcoin Core developers
3+
# Copyright (c) 2019-present The Bitcoin Core developers
44
# Distributed under the MIT software license, see the accompanying
55
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
66

77
export LC_ALL=C.UTF-8
88

99
set -o errexit; source ./ci/test/00_setup_env.sh
10-
set -o errexit; source ./ci/test/04_install.sh
1110
set -o errexit
12-
CI_EXEC "${BASE_ROOT_DIR}/ci/test/06_script_b.sh"
13-
14-
if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
15-
echo "Stop and remove CI container by ID"
16-
docker container kill "${CI_CONTAINER_ID}"
17-
fi
11+
"./ci/test/02_run_container.sh"

0 commit comments

Comments
 (0)