Skip to content

Commit 275e9b8

Browse files
Merge pull request #5342 from cevich/runc_in_f30
Force using runc in F30
2 parents 742093c + e95c493 commit 275e9b8

File tree

8 files changed

+88
-58
lines changed

8 files changed

+88
-58
lines changed

.cirrus.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ env:
3030
####
3131
#### Cache-image names to test with (double-quotes around names are critical)
3232
###
33-
_BUILT_IMAGE_SUFFIX: "libpod-5874660151656448"
33+
_BUILT_IMAGE_SUFFIX: "libpod-5940307564953600"
3434
FEDORA_CACHE_IMAGE_NAME: "fedora-31-${_BUILT_IMAGE_SUFFIX}"
3535
PRIOR_FEDORA_CACHE_IMAGE_NAME: "fedora-30-${_BUILT_IMAGE_SUFFIX}"
3636
UBUNTU_CACHE_IMAGE_NAME: "ubuntu-19-${_BUILT_IMAGE_SUFFIX}"
@@ -48,8 +48,9 @@ env:
4848
#### Default to NOT operating in any special-case testing mode
4949
####
5050
SPECIALMODE: "none" # don't do anything special
51-
TEST_REMOTE_CLIENT: false # don't test remote client by default
52-
ADD_SECOND_PARTITION: false # will certainly fail inside containers
51+
TEST_REMOTE_CLIENT: 'false' # don't test remote client by default
52+
ADD_SECOND_PARTITION: 'false' # will certainly fail inside containers
53+
MOD_LIBPOD_CONF: 'true' # Update libpod.conf runtime if required by OS environment
5354

5455
####
5556
#### Credentials and other secret-sauces, decrypted at runtime when authorized.
@@ -253,6 +254,9 @@ build_each_commit_task:
253254
cpu: 8
254255
memory: "8Gb"
255256

257+
env:
258+
MOD_LIBPOD_CONF: 'false'
259+
256260
timeout_in: 30m
257261

258262
setup_environment_script: '$SCRIPT_BASE/setup_environment.sh |& ${TIMESTAMP}'
@@ -282,6 +286,9 @@ build_without_cgo_task:
282286
cpu: 8
283287
memory: "8Gb"
284288

289+
env:
290+
MOD_LIBPOD_CONF: 'false'
291+
285292
timeout_in: 30m
286293

287294
setup_environment_script: '$SCRIPT_BASE/setup_environment.sh |& ${TIMESTAMP}'
@@ -381,10 +388,10 @@ testing_task:
381388
timeout_in: 120m
382389

383390
env:
384-
ADD_SECOND_PARTITION: true
391+
ADD_SECOND_PARTITION: 'true'
385392
matrix:
386-
TEST_REMOTE_CLIENT: true
387-
TEST_REMOTE_CLIENT: false
393+
TEST_REMOTE_CLIENT: 'true'
394+
TEST_REMOTE_CLIENT: 'false'
388395

389396
networking_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/networking.sh'
390397
setup_environment_script: '$SCRIPT_BASE/setup_environment.sh |& ${TIMESTAMP}'
@@ -428,11 +435,11 @@ special_testing_rootless_task:
428435
$CIRRUS_CHANGE_MESSAGE !=~ '.*CI:DOCS.*'
429436
430437
env:
431-
ADD_SECOND_PARTITION: true
438+
ADD_SECOND_PARTITION: 'true'
432439
SPECIALMODE: 'rootless' # See docs
433440
matrix:
434-
TEST_REMOTE_CLIENT: true
435-
TEST_REMOTE_CLIENT: false
441+
TEST_REMOTE_CLIENT: 'true'
442+
TEST_REMOTE_CLIENT: 'false'
436443

437444
timeout_in: 60m
438445

@@ -469,7 +476,8 @@ special_testing_in_podman_task:
469476
image_name: "${PRIOR_FEDORA_CACHE_IMAGE_NAME}"
470477

471478
env:
472-
ADD_SECOND_PARTITION: true
479+
ADD_SECOND_PARTITION: 'true'
480+
MOD_LIBPOD_CONF: 'false' # Use existing/native setup
473481
SPECIALMODE: 'in_podman' # See docs
474482
# TODO: Support both runc and crun (cgroups v1 and v2 container images)
475483
# matrix:
@@ -628,10 +636,10 @@ verify_test_built_images_task:
628636
image_name: "${PACKER_BUILDER_NAME}${BUILT_IMAGE_SUFFIX}"
629637

630638
env:
631-
ADD_SECOND_PARTITION: true
639+
ADD_SECOND_PARTITION: 'true'
632640
matrix:
633-
TEST_REMOTE_CLIENT: true
634-
TEST_REMOTE_CLIENT: false
641+
TEST_REMOTE_CLIENT: 'true'
642+
TEST_REMOTE_CLIENT: 'false'
635643
matrix:
636644
# Required env. var. by check_image_script
637645
PACKER_BUILDER_NAME: "fedora-30"

contrib/cirrus/integration_test.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@ fi
1616

1717
cd "$GOSRC"
1818

19-
# Transition workaround: runc is still the default for upstream development
20-
handle_crun() {
21-
# For systems with crun installed, assume CgroupsV2 and use it
22-
if type -P crun &> /dev/null
23-
then
24-
warn "Replacing runc -> crun in libpod.conf"
25-
sed -i -r -e 's/^runtime = "runc"/runtime = "crun"/' /usr/share/containers/libpod.conf
26-
fi
27-
}
28-
2919
case "$SPECIALMODE" in
3020
in_podman)
3121
${CONTAINER_RUNTIME} run --rm --privileged --net=host \
@@ -49,7 +39,6 @@ case "$SPECIALMODE" in
4939
endpoint)
5040
make
5141
make install PREFIX=/usr ETCDIR=/etc
52-
#handle_crun
5342
make test-binaries
5443
make endpoint
5544
;;
@@ -63,7 +52,6 @@ case "$SPECIALMODE" in
6352
make install PREFIX=/usr ETCDIR=/etc
6453
make install.config PREFIX=/usr
6554
make test-binaries
66-
handle_crun
6755
if [[ "$TEST_REMOTE_CLIENT" == "true" ]]
6856
then
6957
make remote${TESTSUITE} VARLINK_LOG=$VARLINK_LOG

contrib/cirrus/lib.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ ROOTLESS_ENV_RE='(CIRRUS_.+)|(ROOTLESS_.+)|(.+_IMAGE.*)|(.+_BASE)|(.*DIRPATH)|(.
8888
SECRET_ENV_RE='(IRCID)|(ACCOUNT)|(GC[EP]..+)|(SSH)'
8989

9090
SPECIALMODE="${SPECIALMODE:-none}"
91+
MOD_LIBPOD_CONF="${MOD_LIBPOD_CONF:false}"
9192
TEST_REMOTE_CLIENT="${TEST_REMOTE_CLIENT:-false}"
9293
export CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-podman}
9394

@@ -105,6 +106,8 @@ OS_RELEASE_ID="$(source /etc/os-release; echo $ID)"
105106
OS_RELEASE_VER="$(source /etc/os-release; echo $VERSION_ID | cut -d '.' -f 1)"
106107
# Combined to ease soe usage
107108
OS_REL_VER="${OS_RELEASE_ID}-${OS_RELEASE_VER}"
109+
# Type of filesystem used for cgroups
110+
CG_FS_TYPE="$(stat -f -c %T /sys/fs/cgroup)"
108111

109112
# Installed into cache-images, supports overrides
110113
# by user-data in case of breakage or for debugging.

contrib/cirrus/packer/fedora_setup.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -e
88
# Load in library (copied by packer, before this script was run)
99
source /tmp/libpod/$SCRIPT_BASE/lib.sh
1010

11-
req_env_var SCRIPT_BASE PACKER_BUILDER_NAME GOSRC
11+
req_env_var SCRIPT_BASE PACKER_BUILDER_NAME GOSRC FEDORA_BASE_IMAGE OS_RELEASE_ID OS_RELEASE_VER
1212

1313
install_ooe
1414

@@ -17,9 +17,14 @@ trap "sudo rm -rf $GOPATH" EXIT
1717

1818
$BIGTO ooe.sh sudo dnf update -y
1919

20-
echo "Enabling updates-testing repository"
21-
$LILTO ooe.sh sudo dnf install -y 'dnf-command(config-manager)'
22-
$LILTO ooe.sh sudo dnf config-manager --set-enabled updates-testing
20+
# Do not enable update-stesting on the previous Fedora release
21+
if [[ "$FEDORA_BASE_IMAGE" =~ "${OS_RELEASE_ID}-cloud-base-${OS_RELEASE_VER}" ]]; then
22+
warn "Enabling updates-testing repository for image based on $FEDORA_BASE_IMAGE"
23+
$LILTO ooe.sh sudo dnf install -y 'dnf-command(config-manager)'
24+
$LILTO ooe.sh sudo dnf config-manager --set-enabled updates-testing
25+
else
26+
warn "NOT enabling updates-testing repository for image based on $PRIOR_FEDORA_BASE_IMAGE"
27+
fi
2328

2429
echo "Installing general build/test dependencies for Fedora '$OS_RELEASE_VER'"
2530
REMOVE_PACKAGES=()
@@ -98,6 +103,7 @@ case "$OS_RELEASE_VER" in
98103
python2-future
99104
runc
100105
)
106+
REMOVE_PACKAGES+=(crun)
101107
;;
102108
31)
103109
INSTALL_PACKAGES+=(crun)

contrib/cirrus/setup_environment.sh

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ source $(dirname $0)/lib.sh
66

77
req_env_var USER HOME GOSRC SCRIPT_BASE SETUP_MARKER_FILEPATH
88

9-
show_env_vars
10-
119
# Ensure this script only executes successfully once and always logs ending timestamp
12-
[[ ! -e "$SETUP_MARKER_FILEPATH" ]] || exit 0
10+
if [[ -e "$SETUP_MARKER_FILEPATH" ]]; then
11+
show_env_vars
12+
exit 0
13+
fi
14+
1315
exithandler() {
1416
RET=$?
1517
echo "."
1618
echo "$(basename $0) exit status: $RET"
1719
[[ "$RET" -eq "0" ]] && date +%s >> "$SETUP_MARKER_FILEPATH"
20+
show_env_vars
21+
[ "$RET" -eq "0" ]] || warn "Non-zero exit caused by error ABOVE env. var. display."
1822
}
1923
trap exithandler EXIT
2024

@@ -46,42 +50,59 @@ case "${OS_RELEASE_ID}" in
4650
# All SELinux distros need this for systemd-in-a-container
4751
setsebool container_manage_cgroup true
4852
if [[ "$ADD_SECOND_PARTITION" == "true" ]]; then
49-
bash "$SCRIPT_BASE/add_second_partition.sh"; fi
53+
bash "$SCRIPT_BASE/add_second_partition.sh"
54+
fi
5055

51-
if [[ "$OS_RELEASE_VER" == "31" ]]; then
52-
warn "Switching io schedular to deadline to avoid RHBZ 1767539"
53-
warn "aka https://bugzilla.kernel.org/show_bug.cgi?id=205447"
54-
echo "mq-deadline" > /sys/block/sda/queue/scheduler
55-
cat /sys/block/sda/queue/scheduler
56+
warn "Switching io scheduler to 'deadline' to avoid RHBZ 1767539"
57+
warn "aka https://bugzilla.kernel.org/show_bug.cgi?id=205447"
58+
echo "mq-deadline" > /sys/block/sda/queue/scheduler
59+
cat /sys/block/sda/queue/scheduler
5660

57-
warn "Forcing systemd cgroup manager"
58-
X=$(echo "export CGROUP_MANAGER=systemd" | \
59-
tee -a /etc/environment) && eval "$X" && echo "$X"
61+
warn "Forcing systemd cgroup manager"
62+
X=$(echo "export CGROUP_MANAGER=systemd" | \
63+
tee -a /etc/environment) && eval "$X" && echo "$X"
64+
;;
65+
centos) # Current VM is an image-builder-image no local podman/testing
66+
echo "No further setup required for VM image building"
67+
exit 0
68+
;;
69+
*) bad_os_id_ver ;;
70+
esac
6071

61-
warn "Testing with crun instead of runc"
62-
X=$(echo "export OCI_RUNTIME=/usr/bin/crun" | \
63-
tee -a /etc/environment) && eval "$X" && echo "$X"
72+
# Reload to incorporate any changes from above
73+
source "$SCRIPT_BASE/lib.sh"
74+
75+
case "$CG_FS_TYPE" in
76+
tmpfs)
77+
warn "Forcing testing with runc instead of crun"
78+
X=$(echo "export OCI_RUNTIME=/usr/bin/runc" | \
79+
tee -a /etc/environment) && eval "$X" && echo "$X"
80+
;;
81+
cgroup2fs)
82+
# This is necessary since we've built/installed from source, which uses runc as the default.
83+
warn "Forcing testing with crun instead of runc"
84+
X=$(echo "export OCI_RUNTIME=/usr/bin/crun" | \
85+
tee -a /etc/environment) && eval "$X" && echo "$X"
86+
87+
if [[ "$MOD_LIBPOD_CONF" == "true" ]]; then
88+
warn "Updating runtime setting in repo. copy of libpod.conf"
89+
sed -i -r -e 's/^runtime = "runc"/runtime = "crun"/' $GOSRC/libpod.conf
90+
git diff $GOSRC/libpod.conf
91+
fi
6492

93+
if [[ "$OS_RELEASE_ID" == "fedora" ]]; then
6594
warn "Upgrading to the latest crun"
6695
# Normally not something to do for stable testing
6796
# but crun is new, and late-breaking fixes may be required
6897
# on short notice
6998
dnf update -y crun
70-
71-
#warn "Setting SELinux into Permissive mode"
72-
#setenforce 0
7399
fi
74100
;;
75-
centos) # Current VM is an image-builder-image no local podman/testing
76-
echo "No further setup required for VM image building"
77-
exit 0
101+
*)
102+
die 110 "Unsure how to handle cgroup filesystem type '$CG_FS_TYPE'"
78103
;;
79-
*) bad_os_id_ver ;;
80104
esac
81105

82-
# Reload to incorporate any changes from above
83-
source "$SCRIPT_BASE/lib.sh"
84-
85106
# Must execute before possible setup_rootless()
86107
make install.tools
87108

hack/get_ci_vm.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ env=yaml.load(open(".cirrus.yml"), Loader=yaml.SafeLoader)["env"]
9696
keys=[k for k in env if "ENCRYPTED" not in str(env[k])]
9797
for k,v in env.items():
9898
v=str(v)
99-
if "ENCRYPTED" not in v:
99+
if "ENCRYPTED" not in v and "ADD_SECOND_PARTITION" not in v:
100100
print("{0}=\"{1}\"".format(k, v)),
101101
'
102102
}
@@ -181,7 +181,7 @@ parse_args(){
181181
[[ -z "$ROOTLESS_USER" ]] || \
182182
ENVS="$ENVS ROOTLESS_USER=$ROOTLESS_USER"
183183

184-
SETUP_CMD="env $ENVS $GOSRC/contrib/cirrus/setup_environment.sh"
184+
SETUP_CMD="env $ENVS ADD_SECOND_PARTITIO=True $GOSRC/contrib/cirrus/setup_environment.sh"
185185
VMNAME="${VMNAME:-${USER}-${IMAGE_NAME}}"
186186

187187
CREATE_CMD="$PGCLOUD compute instances create --zone=$ZONE --image=${IMAGE_NAME} --custom-cpu=$CPUS --custom-memory=$MEMORY --boot-disk-size=$DISK --labels=in-use-by=$USER $IBI_ARGS $VMNAME"

pkg/bindings/test/common_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,3 +240,7 @@ func createCache() {
240240
}
241241
b.cleanup()
242242
}
243+
244+
func isStopped(state string) bool {
245+
return state == "exited" || state == "stopped"
246+
}

pkg/bindings/test/containers_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ var _ = Describe("Podman containers ", func() {
232232
// Ensure container is stopped
233233
data, err := containers.Inspect(connText, name, nil)
234234
Expect(err).To(BeNil())
235-
Expect(data.State.Status).To(Equal("exited"))
235+
Expect(isStopped(data.State.Status)).To(BeTrue())
236236
})
237237

238238
It("podman stop a running container by ID", func() {
@@ -247,7 +247,7 @@ var _ = Describe("Podman containers ", func() {
247247
// Ensure container is stopped
248248
data, err = containers.Inspect(connText, name, nil)
249249
Expect(err).To(BeNil())
250-
Expect(data.State.Status).To(Equal("exited"))
250+
Expect(isStopped(data.State.Status)).To(BeTrue())
251251
})
252252

253253
})

0 commit comments

Comments
 (0)