Skip to content

[WIP] test: add e2e test #1359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

name: e2e

# triggered by labeled PR
on:
pull_request_target:
types: [ labeled ]
workflow_dispatch:

jobs:
test:
if: ${{ github.event.label.name == 'e2e' }}
strategy:
matrix:
# os: [ubuntu-latest, ubuntu-24.04-arm]
os: [ubuntu-latest]
# distro: [fedora-41, fedora-42, fedora-r43, centos-stream-9, centos-stream-10]
distro: [centos-stream-10]
runs-on: ${{ matrix.os }}

# Required to push container image to ghcr.io
# https://github.com/orgs/community/discussions/57724
permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- uses: actions/checkout@v4

- name: Build bootc RPM
env:
DISTRO: ${{ matrix.distro }}
BUILD_IMAGE: quay.io/fedora/fedora:42
run: |
podman run \
--rm \
--privileged \
-v $(pwd):/workdir:z \
-e DISTRO=$DISTRO \
--workdir /workdir \
$BUILD_IMAGE \
contrib/scripts/mock_build.sh

- name: Re-build bootc image with new bootc PRM
env:
DISTRO: ${{ matrix.distro }}
run: |
set -xeu
if [[ $DISTRO =~ fedora ]]; then
VERSION_ID=$(cut -d'-' -f2 <<<"$DISTRO")
BASE_IMAGE="quay.io/fedora/fedora-bootc:${VERSION_ID}"
fi
if [[ $DISTRO =~ centos ]]; then
VERSION_ID=$(cut -d'-' -f3 <<<"$DISTRO")
BASE_IMAGE="quay.io/centos-bootc/centos-bootc:stream${VERSION_ID}"
fi
tee target/build/Containerfile >/dev/null <<CONTAINERFILEEOF
FROM $BASE_IMAGE
RUN dnf -y upgrade /rpms/*.rpm && dnf -y clean all && rm -rf /var/cache /var/lib/dnf
CONTAINERFILEEOF
cat target/build/Containerfile

IMAGE_NAME="bootc-image:${{ github.sha }}"
podman build -v "$(pwd)/target/build/":/rpms:z -t $IMAGE_NAME target/build
podman login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
podman push $IMAGE_NAME "docker://ghcr.io/bootc-dev/$IMAGE_NAME"
8 changes: 5 additions & 3 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ jobs:
- centos-stream-10-s390x
- fedora-41-x86_64
- fedora-41-aarch64
- fedora-41-ppc64le
- fedora-41-s390x
- fedora-42-x86_64
- fedora-42-aarch64
- fedora-42-ppc64le
- fedora-42-s390x
# Sanity check on secondary targets, fewer architectures just
# because the chance that we break e.g. ppc64le *just* on
# rawhide is basically nil.
Expand Down Expand Up @@ -81,7 +83,7 @@ jobs:
- fedora-rawhide-aarch64
tmt_plan: /integration
skip_build: true
identifier: integration-test
identifier: integration

- job: propose_downstream
trigger: release
Expand Down
30 changes: 30 additions & 0 deletions contrib/scripts/mock_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -exuo pipefail

ARCH=$(uname -m)
MOCK_CONFIG="${DISTRO}-${ARCH}"

sudo dnf install -y cargo zstd git openssl-devel ostree-devel rpm-build mock

sudo dnf -y builddep contrib/packaging/bootc.spec
cargo install cargo-vendor-filterer

cargo xtask spec

# Adding user to mock group
sudo usermod -a -G mock "$(whoami)"

# Building SRPM
mock -r "$MOCK_CONFIG" --buildsrpm \
--spec "target/bootc.spec" \
--config-opts=cleanup_on_failure=False \
--config-opts=cleanup_on_success=True \
--sources target \
--resultdir target/build

# Building RPMs
mock -r "$MOCK_CONFIG" \
--config-opts=cleanup_on_failure=False \
--config-opts=cleanup_on_success=True \
--resultdir "target/build" \
target/build/*.src.rpm