Skip to content

Commit 04b80e2

Browse files
committed
TEMP: test install-tests fix with copy-to-rootful
1 parent 21babe7 commit 04b80e2

File tree

2 files changed

+49
-9
lines changed

2 files changed

+49
-9
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ concurrency:
3232
jobs:
3333
# Run basic validation checks (linting, formatting, etc)
3434
validate:
35+
if: false # TEMP: disabled for testing install-tests fix
3536
runs-on: ubuntu-24.04
3637
steps:
3738
- uses: actions/checkout@v6
@@ -41,6 +42,7 @@ jobs:
4142
run: just validate
4243
# Check for security vulnerabilities and license compliance
4344
cargo-deny:
45+
if: false # TEMP: disabled for testing install-tests fix
4446
runs-on: ubuntu-24.04
4547
steps:
4648
- uses: actions/checkout@v6
@@ -65,16 +67,14 @@ jobs:
6567
- name: Integration tests
6668
run: |
6769
set -xeu
68-
# Build images to test; TODO investigate doing single container builds
69-
# via GHA and pushing to a temporary registry to share among workflows?
70-
# Preserve rustup/cargo environment for sudo (rustup needs RUSTUP_HOME to find toolchains)
71-
sudojust() { sudo env PATH="$PATH" CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}" RUSTUP_HOME="${RUSTUP_HOME:-$HOME/.rustup}" just "$@"; }
72-
sudojust build
73-
sudojust build-install-test-image
70+
# Build images as regular user, then copy to root's podman storage
71+
# This avoids cargo cache permission issues when running cargo as root
72+
just build
73+
just build-install-test-image
74+
just copy-to-rootful localhost/bootc
75+
just copy-to-rootful localhost/bootc-install
7476
sudo podman build -t localhost/bootc-fsverity -f ci/Containerfile.install-fsverity
7577
76-
# Grant permission
77-
sudo chown -R "$(id -u):$(id -g)" /home/runner/work/bootc/bootc
7878
# TODO move into a container, and then have this tool run other containers
7979
cargo build --release -p tests-integration
8080
@@ -110,6 +110,7 @@ jobs:
110110
done
111111
# Test that we can build documentation
112112
docs:
113+
if: false # TEMP: disabled for testing install-tests fix
113114
runs-on: ubuntu-24.04
114115
steps:
115116
- uses: actions/checkout@v6
@@ -119,6 +120,7 @@ jobs:
119120
run: just build-mdbook
120121
# Build packages for each test OS
121122
package:
123+
if: false # TEMP: disabled for testing install-tests fix
122124
strategy:
123125
fail-fast: false
124126
matrix:
@@ -150,6 +152,7 @@ jobs:
150152
# running unit and integration tests (using TMT, leveraging the support for nested virtualization
151153
# in the GHA runners)
152154
test-integration:
155+
if: false # TEMP: disabled for testing install-tests fix
153156
needs: package
154157
strategy:
155158
fail-fast: false
@@ -224,6 +227,7 @@ jobs:
224227
# when run in the same job as test-integration).
225228
# Uses fedora-43 as it's the current stable Fedora release matching CoreOS.
226229
test-coreos:
230+
if: false # TEMP: disabled for testing install-tests fix
227231
needs: package
228232
runs-on: ubuntu-24.04
229233

@@ -264,7 +268,7 @@ jobs:
264268

265269
# Sentinel job for required checks - configure this job name in repository settings
266270
required-checks:
267-
if: always()
271+
if: false # TEMP: disabled for testing install-tests fix
268272
needs: [cargo-deny, validate, package, test-integration, test-coreos]
269273
runs-on: ubuntu-latest
270274
steps:

Justfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,3 +282,39 @@ _keygen:
282282

283283
_build-upgrade-image:
284284
cat tmt/tests/Dockerfile.upgrade | podman build -t {{upgrade_img}} --from={{base_img}} -
285+
286+
# Copy an image from user podman storage to root's podman storage
287+
# This allows building as regular user then running privileged tests
288+
[group('testing')]
289+
copy-to-rootful $image:
290+
#!/bin/bash
291+
set -euxo pipefail
292+
293+
# If already running as root, nothing to do
294+
if [[ "${UID}" -eq "0" ]]; then
295+
echo "Already root, no need to copy image"
296+
exit 0
297+
fi
298+
299+
# Check if the image exists in user storage
300+
if ! podman image exists "${image}"; then
301+
echo "Image ${image} not found in user podman storage" >&2
302+
exit 1
303+
fi
304+
305+
# Get the image ID from user storage
306+
USER_IMG_ID=$(podman images --filter reference="${image}" --format '{{{{.ID}}')
307+
308+
# Check if the same image ID exists in root storage
309+
ROOT_IMG_ID=$(sudo podman images --filter reference="${image}" --format '{{{{.ID}}' 2>/dev/null || true)
310+
311+
if [[ "${USER_IMG_ID}" == "${ROOT_IMG_ID}" ]] && [[ -n "${ROOT_IMG_ID}" ]]; then
312+
echo "Image ${image} already exists in root storage with same ID"
313+
exit 0
314+
fi
315+
316+
# Copy the image from user to root storage using podman image scp
317+
COPYTMP=$(mktemp -p "${PWD}" -d -t _podman_scp.XXXXXXXXXX)
318+
sudo TMPDIR="${COPYTMP}" podman image scp "${UID}@localhost::${image}" root@localhost::"${image}"
319+
rm -rf "${COPYTMP}"
320+
echo "Copied ${image} to root podman storage"

0 commit comments

Comments
 (0)