Skip to content

Commit 4616ab2

Browse files
committed
test: add e2e test
Build RPM with moke and re-build bootc image with new bootc RPM Signed-off-by: Xiaofeng Wang <[email protected]>
1 parent d72bb14 commit 4616ab2

File tree

3 files changed

+102
-3
lines changed

3 files changed

+102
-3
lines changed

.github/workflows/e2e.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
2+
name: e2e test
3+
4+
# triggered by labeled PR
5+
on:
6+
pull_request:
7+
types: [ labeled ]
8+
9+
jobs:
10+
e2e-test:
11+
if: ${{ github.event.label.name == 'e2e' }}
12+
strategy:
13+
matrix:
14+
# os: [ubuntu-latest, ubuntu-24.04-arm]
15+
os: [ubuntu-latest]
16+
# distro: [fedora-41, fedora-42, fedora-r43, centos-stream-9, centos-stream-10]
17+
distro: [centos-stream-10]
18+
runs-on: ${{ matrix.os }}
19+
20+
# Required to push container image to ghcr.io
21+
permissions:
22+
contents: read
23+
packages: write
24+
attestations: write
25+
id-token: write
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Build bootc RPM
31+
env:
32+
DISTRO: ${{ matrix.distro }}
33+
BUILD_IMAGE: quay.io/fedora/fedora:42
34+
run: |
35+
podman run \
36+
--rm \
37+
--privileged \
38+
-v $(pwd):/workdir:z \
39+
-e DISTRO=$DISTRO \
40+
--workdir /workdir \
41+
$BUILD_IMAGE \
42+
contrib/scripts/mock_build.sh
43+
44+
- name: Re-build bootc image with new bootc PRM
45+
env:
46+
DISTRO: ${{ matrix.distro }}
47+
PR_NUMBER: ${{ github.event.number }}
48+
run: |
49+
set -xeu
50+
if [[ $DISTRO =~ fedora ]]; then
51+
VERSION_ID=$(cut -d'-' -f2 <<<"$DISTRO")
52+
BASE_IMAGE="quay.io/fedora/fedora-bootc:${VERSION_ID}"
53+
fi
54+
if [[ $DISTRO =~ centos ]]; then
55+
VERSION_ID=$(cut -d'-' -f3 <<<"$DISTRO")
56+
BASE_IMAGE="quay.io/centos-bootc/centos-bootc:stream${VERSION_ID}"
57+
fi
58+
tee target/build/Containerfile >/dev/null <<CONTAINERFILEEOF
59+
FROM $BASE_IMAGE
60+
RUN dnf -y upgrade /rpms/*.rpm && dnf -y clean all && rm -rf /var/cache /var/lib/dnf
61+
CONTAINERFILEEOF
62+
cat target/build/Containerfile
63+
64+
IMAGE_NAME="bootc-image:PR-${PR_NUMBER}-${DISTRO}-$(uname -m)"
65+
podman build -v "$(pwd)/target/build/":/rpms:z -t $IMAGE_NAME target/build
66+
podman login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
67+
podman push $IMAGE_NAME "docker://ghcr.io/bootc-dev/$IMAGE_NAME"

.packit.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ jobs:
4444
- centos-stream-10-s390x
4545
- fedora-41-x86_64
4646
- fedora-41-aarch64
47-
- fedora-41-ppc64le
48-
- fedora-41-s390x
47+
- fedora-42-x86_64
48+
- fedora-42-aarch64
49+
- fedora-42-ppc64le
50+
- fedora-42-s390x
4951
# Sanity check on secondary targets, fewer architectures just
5052
# because the chance that we break e.g. ppc64le *just* on
5153
# rawhide is basically nil.
@@ -81,7 +83,7 @@ jobs:
8183
- fedora-rawhide-aarch64
8284
tmt_plan: /integration
8385
skip_build: true
84-
identifier: integration-test
86+
identifier: integration
8587

8688
- job: propose_downstream
8789
trigger: release

contrib/scripts/mock_build.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
set -exuo pipefail
3+
4+
ARCH=$(uname -m)
5+
MOCK_CONFIG="${DISTRO}-${ARCH}"
6+
7+
sudo dnf install -y cargo zstd git openssl-devel ostree-devel rpm-build mock
8+
9+
sudo dnf -y builddep contrib/packaging/bootc.spec
10+
cargo install cargo-vendor-filterer
11+
12+
cargo xtask spec
13+
14+
# Adding user to mock group
15+
sudo usermod -a -G mock "$(whoami)"
16+
17+
# Building SRPM
18+
mock -r "$MOCK_CONFIG" --buildsrpm \
19+
--spec "target/bootc.spec" \
20+
--config-opts=cleanup_on_failure=False \
21+
--config-opts=cleanup_on_success=True \
22+
--sources target \
23+
--resultdir target/build
24+
25+
# Building RPMs
26+
mock -r "$MOCK_CONFIG" \
27+
--config-opts=cleanup_on_failure=False \
28+
--config-opts=cleanup_on_success=True \
29+
--resultdir "target/build" \
30+
target/build/*.src.rpm

0 commit comments

Comments
 (0)