-
Notifications
You must be signed in to change notification settings - Fork 124
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
henrywang
wants to merge
1
commit into
bootc-dev:main
Choose a base branch
from
henrywang:e2e
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
test: add e2e test #1359
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: build bootc and bootc image | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
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-9] | ||
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 }}-$(uname -m)" | ||
IMAGE_TAG="${{ github.sha }}-$(uname -m)" | ||
buildah build -v "$(pwd)/target/build/":/rpms:z -t $IMAGE_NAME target/build | ||
buildah login -u bootc-dev -p ${{ secrets.GITHUB_TOKEN }} ghcr.io | ||
buildah push $IMAGE_NAME "docker://ghcr.io/bootc-dev/${IMAGE_NAME}" | ||
|
||
push: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
# 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: Push manifest | ||
env: | ||
ARCHES: "x86_64 aarch64" | ||
run: | | ||
set -xeuo pipefail | ||
REGISTRY_NAME="ghcr.io/${{ github.event.pull_request.head.repo.full_name }}/bootc-image" | ||
buildah login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io | ||
|
||
for arch in $ARCHES; do | ||
buildah pull "${REGISTRY_NAME}:${{ github.sha }}-${arch}" | ||
done | ||
|
||
buildah manifest create "${REGISTRY_NAME}:${{ github.sha }}" `for arch in ${ARCHES}; do echo "${REGISTRY_NAME}:${{ github.sha }}-${arch};" done` | ||
|
||
for arch in ${ARCHES}; do | ||
buildah manifest annotate "${REGISTRY_NAME}:${{ github.sha }}" "${REGISTRY_NAME}:${{ github.sha }}-${arch}" --os linux --arch ${arch} | ||
done | ||
buildah tag "${REGISTRY_NAME}:${{ github.sha }}" | ||
buildah manifest push --all "${REGISTRY_NAME}:${{ github.sha }}" docker://"${REGISTRY_NAME}:${{ github.sha }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per discussion let's create a default flow in Github Actions that builds a bootc container image tagged with the sha digest and pushes to
ghcr.io
under the repo namespace.Then we can run further tests on that container image.
I think we'll need a scheduled workflow to prune the images though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use https://github.com/marketplace/actions/ghcr-io-cleanup-action action to make clean up container registry, like https://github.com/marketplace/actions/ghcr-io-cleanup-action#older-than.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@henrywang you're saying the push permission here wasn't working, can you link to a failing run?
I am not aware of anything special at all here, a ton of projects use a similar flow so it should work - we definitely have this enabled at the repo level