Skip to content

Commit 43cbdef

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 43cbdef

File tree

3 files changed

+95
-3
lines changed

3 files changed

+95
-3
lines changed

.github/workflows/e2e.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Build bootc RPM
24+
env:
25+
DISTRO: ${{ matrix.distro }}
26+
BUILD_IMAGE: quay.io/fedora/fedora:42
27+
run: |
28+
podman run \
29+
--rm \
30+
--privileged \
31+
-v $(pwd):/workdir:z \
32+
-e DISTRO=$DISTRO \
33+
--workdir /workdir \
34+
$BUILD_IMAGE \
35+
contrib/scripts/mock_build.sh
36+
37+
- name: Re-build bootc image with new bootc PRM
38+
env:
39+
DISTRO: ${{ matrix.distro }}
40+
PR_NUMBER: ${{ github.event.number }}
41+
run: |
42+
set -xeu
43+
if [[ $DISTRO =~ fedora ]]; then
44+
VERSION_ID=$(cut -d'-' -f2 <<<"$DISTRO")
45+
BASE_IMAGE="quay.io/fedora/fedora-bootc:${VERSION_ID}"
46+
fi
47+
if [[ $DISTRO =~ centos ]]; then
48+
VERSION_ID=$(cut -d'-' -f3 <<<"$DISTRO")
49+
BASE_IMAGE="quay.io/centos-bootc/centos-bootc:stream${VERSION_ID}"
50+
fi
51+
tee target/build/Containerfile >/dev/null <<CONTAINERFILEEOF
52+
FROM $BASE_IMAGE
53+
RUN dnf -y upgrade /rpms/*.rpm && dnf -y clean all && rm -rf /var/cache /var/lib/dnf
54+
CONTAINERFILEEOF
55+
cat target/build/Containerfile
56+
57+
IMAGE_NAME="${DISTRO}:PR-${PR_NUMBER}-$(uname -m)"
58+
podman build -v "$(pwd)/target/build/":/rpms:z -t $IMAGE_NAME target/build
59+
podman login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
60+
podman push $IMAGE_NAME "docker://ghcr.io/bootc-dev/bootc/$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)