Skip to content
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
36 changes: 28 additions & 8 deletions .github/workflows/component-builder-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ on:
workflow_dispatch:

jobs:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the flow here should be to promote the built images in component-builder to production -i.e not re-build again.
we need also arm support

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Regarding arm support, I do not have access to test on arm machines. What about adding ARM support once this changes get merged?

guest-fedora-amd64:
guest-fedora:
runs-on: ubuntu-latest
env:
FEDORA_IMAGE: Fedora-Cloud-Base-Generic-41-1.4.x86_64.qcow2
FEDORA_VERSION: 41
CPU_ARCH: amd64
FULL_EMULATION: "true"
DEBIAN_FRONTEND: noninteractive
steps:
Expand All @@ -26,15 +24,23 @@ jobs:
sudo apt-get update
sudo apt-get install -y \
qemu-system-x86 \
qemu-system-s390x \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should install only one, based on arch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are publishing here. To achieve this, the proposed approach is to build everything on the same amd64 host before pushing and creating the manifests together. This avoids the need to sync across different jobs
While an alternative method could save about 5 minutes (parallelizing the build for amd64 and s390x), it would introduce additional complexity. My suggestion would be to focus on implementing the simplest solution first and then consider optimization. What do you think?

libvirt-daemon-system \
virtinst cloud-image-utils \
libguestfs-tools
- name: Tweak hosted runner to enable 'virt-sysprep'
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725
run: sudo chmod 0644 /boot/vmlinuz*
- name: Fetch base Fedora image
- name: Fetch base Fedora amd64 image
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about using tools like https://github.com/qoomon/actions--parallel-steps to have steps run in parallel, or use gh matrix yo avoid code duplication

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reducing code duplication: +1
Regarding parallel steps, I would like to consider it a separate approach (after everything is merged and verified that it works as expected in production).

working-directory: ./containers/fedora
run: wget -q "https://download.fedoraproject.org/pub/fedora/linux/releases/41/Cloud/x86_64/images/${{ env.FEDORA_IMAGE }}"
env:
FEDORA_IMAGE: Fedora-Cloud-Base-Generic-41-1.4.x86_64.qcow2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have these as vars at the top for easier updating (and they are repeated in the code)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, we can create a env variable for the actual Fedora base name. In this case "Fedora-Cloud-Base-Base-Generic-41-1.4"

- name: Fetch base Fedora s390x image
working-directory: ./containers/fedora
run: wget -q "https://download.fedoraproject.org/pub/fedora-secondary/releases/41/Cloud/s390x/images/${{ env.FEDORA_IMAGE }}"
env:
FEDORA_IMAGE: Fedora-Cloud-Base-Generic-41-1.4.s390x.qcow2
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
Expand All @@ -45,17 +51,31 @@ jobs:
PYTHONPATH: ${{ github.workspace }}
ORGANIZATION_ID: ${{ secrets.BITWARDEN_ORGANIZATION_ID }}
ACCESS_TOKEN: ${{ secrets.BITWARDEN_ACCESS_TOKEN }}
FEDORA_IMAGE: Fedora-Cloud-Base-Generic-41-1.4.x86_64.qcow2
CPU_ARCH: amd64
run: ./build.sh
- name: Create s390x VM
working-directory: ./containers/fedora
env:
PYTHONPATH: ${{ github.workspace }}
ORGANIZATION_ID: ${{ secrets.BITWARDEN_ORGANIZATION_ID }}
ACCESS_TOKEN: ${{ secrets.BITWARDEN_ACCESS_TOKEN }}
FEDORA_IMAGE: Fedora-Cloud-Base-Generic-41-1.4.s390x.qcow2
CPU_ARCH: s390x
run: ./build.sh
- name: Logging to quay.io
run: podman login -u ${{ secrets.QUAY_USER }} -p ${{ secrets.QUAY_TOKEN }} quay.io
- name: Tag & Push image to staging
env:
local_repository: "localhost/fedora"
remote_repository: "quay.io/openshift-cnv/qe-cnv-tests-fedora-staging"
arch_tag: "${{ env.FEDORA_VERSION }}-${{ env.CPU_ARCH }}"
arch_tag_amd64: "${{ env.FEDORA_VERSION }}-amd64"
arch_tag_s390x: "${{ env.FEDORA_VERSION }}-s390x"
remote_tag: "${{ env.FEDORA_VERSION }}-dev"
run: |
podman tag "${local_repository}":"${arch_tag}" "${remote_repository}":"${arch_tag}"
podman push "${remote_repository}":"${arch_tag}"
podman manifest create --log-level=debug "${remote_repository}":"${remote_tag}" "${remote_repository}":"${arch_tag}"
podman tag "${local_repository}":"${arch_tag_amd64}" "${remote_repository}":"${arch_tag_amd64}"
podman tag "${local_repository}":"${arch_tag_s390x}" "${remote_repository}":"${arch_tag_s390x}"
podman push "${remote_repository}":"${arch_tag_amd64}"
podman push "${remote_repository}":"${arch_tag_s390x}"
podman manifest create --log-level=debug "${remote_repository}":"${remote_tag}" "${remote_repository}":"${arch_tag_amd64}" "${remote_repository}":"${arch_tag_s390x}"
podman manifest push "${remote_repository}":"${remote_tag}" --all --format=v2s2
60 changes: 56 additions & 4 deletions .github/workflows/component-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,64 @@ jobs:
run: |
mkdir -p artifacts
podman tag "${local_repository}":"${arch_tag}" "${remote_repository}":"${arch_tag}"
podman save -o artifacts/fedora-image.tar "${remote_repository}":"${arch_tag}"
echo "Saved image to artifacts/fedora-image.tar"
podman save -o artifacts/fedora-image-${{ env.CPU_ARCH }}.tar "${remote_repository}":"${arch_tag}"
echo "Saved image to artifacts/fedora-image-${{ env.CPU_ARCH }}.tar"
- name: Upload container image artifact
uses: actions/upload-artifact@v6
with:
name: fedora-container-image
path: artifacts/fedora-image.tar
name: fedora-container-image-${{ env.CPU_ARCH }}
path: artifacts/fedora-image-${{ env.CPU_ARCH }}.tar
retention-days: 5
compression-level: 0
guest-fedora-s390x:
runs-on: ubuntu-latest
env:
FEDORA_IMAGE: Fedora-Cloud-Base-Generic-41-1.4.s390x.qcow2
FEDORA_VERSION: 41
CPU_ARCH: s390x
FULL_EMULATION: "true"
DEBIAN_FRONTEND: noninteractive
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install dependencies for VM build
run: |
sudo apt-get update
sudo apt-get install -y \
qemu-system-s390x \
libvirt-daemon-system \
virtinst cloud-image-utils \
libguestfs-tools
- name: Tweak hosted runner to enable 'virt-sysprep'
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725
run: sudo chmod 0644 /boot/vmlinuz*
- name: Fetch base Fedora image
working-directory: ./containers/fedora
run: wget -q "https://download.fedoraproject.org/pub/fedora-secondary/releases/41/Cloud/s390x/images/${{ env.FEDORA_IMAGE }}"
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.8.22"
- name: Create VM
working-directory: ./containers/fedora
env:
PYTHONPATH: ${{ github.workspace }}
NO_SECRETS: "true"
run: ./build.sh
- name: Save container image as tarball
env:
local_repository: "localhost/fedora"
remote_repository: "quay.io/openshift-cnv/qe-cnv-tests-fedora-staging"
arch_tag: "${{ env.FEDORA_VERSION }}-${{ env.CPU_ARCH }}"
run: |
mkdir -p artifacts
podman tag "${local_repository}":"${arch_tag}" "${remote_repository}":"${arch_tag}"
podman save -o artifacts/fedora-image-${{ env.CPU_ARCH }}.tar "${remote_repository}":"${arch_tag}"
echo "Saved image to artifacts/fedora-image-${{ env.CPU_ARCH }}.tar"
- name: Upload container image artifact
uses: actions/upload-artifact@v4
with:
name: fedora-container-image-${{ env.CPU_ARCH }}
path: artifacts/fedora-image-${{ env.CPU_ARCH }}.tar
retention-days: 5
compression-level: 0