Skip to content
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

workflows: Add new mkosi e2e flow #2019

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c231f22
workflows: make podvm_mkosi callable
wainersm Jul 26, 2024
56cc515
workflows: podvm_mkosi: Multi-arch support
stevenhorsman Sep 6, 2024
02fed99
podvm-mkosi: Update image targets
stevenhorsman Sep 9, 2024
2e2b88b
podvm: docker provider: Rename Dockerfile
stevenhorsman Sep 9, 2024
20ad65d
workflows: Add podvm-mkosi workflow triggers
stevenhorsman Sep 9, 2024
e2f0526
workflows: podvm_mkosi: Add debug input
stevenhorsman Sep 9, 2024
2e20c71
workflows: build podvm-docker-fedora-image in podvm_mkosi
wainersm Jul 29, 2024
7e5578c
podvm_binaries: Add fedora cross-build support
stevenhorsman Sep 6, 2024
54296b1
podvm_mkosi: Create qcow2 file for testing
stevenhorsman Sep 16, 2024
8bf929b
podvm: Update platform logic in download-image
stevenhorsman Sep 20, 2024
1fcaf1b
workflows: e2e_libvirt: Add runner as input
stevenhorsman Oct 24, 2024
7052ece
workflows: mkosi: Publish qcow2 with oras
stevenhorsman Oct 25, 2024
e3d76e6
workflows: podvm_mkosi: Output qcow2 oras image
stevenhorsman Oct 28, 2024
7c7a022
workflows: podvm_mkosi: Output docker provider oci image
stevenhorsman Oct 28, 2024
84ccbe7
workflows: libvirt_e2e: Add support to pull podvm with oras
stevenhorsman Oct 28, 2024
9d5cf01
workflows: e2e_run_all: Add new decoupled jobs
stevenhorsman Oct 28, 2024
d39e1ac
workflows: e2e_libvirt: Enforce clean-up
stevenhorsman Oct 30, 2024
744c561
workflows: e2e_run_all: Decouple multi-arch CAA builds
stevenhorsman Oct 30, 2024
26a1f1e
workflows: e2e_run_all: Decouple prep_install
stevenhorsman Nov 11, 2024
aa13c2a
workflows: e2e_run_all: Add secure comms test support
stevenhorsman Nov 13, 2024
408da63
libvirt: Add the option of EFI firmware support for mkosi
stevenhorsman Nov 28, 2024
d9007e8
test/e2e: Skip s390x encrypted image test
stevenhorsman Dec 2, 2024
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
8 changes: 7 additions & 1 deletion .github/workflows/caa_build_and_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ on:
description: Git ref to checkout the cloud-api-adaptor repository. Defaults to main.
required: false
type: string
runner:
default: 'ubuntu-24.04'
description: The runner to execute the workflow on. Defaults to 'ubuntu-24.04'.
required: false
type: string

defaults:
run:
Expand All @@ -41,7 +46,7 @@ defaults:
jobs:
build_push_job:
name: build and push
runs-on: ubuntu-24.04
runs-on: ${{ inputs.runner }}
strategy:
fail-fast: false
matrix:
Expand All @@ -65,6 +70,7 @@ jobs:

- name: Read properties from versions.yaml
run: |
sudo snap install yq
go_version="$(yq '.tools.golang' versions.yaml)"
[ -n "$go_version" ]
echo "GO_VERSION=${go_version}" >> "$GITHUB_ENV"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/caa_build_and_push_per_arch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
build_push_job:
name: build and push
needs: [upload_tags]
runs-on: ubuntu-24.04
runs-on: ${{ matrix.type == 'dev-s390x' && 's390x' || 'ubuntu-24.04' }}
strategy:
fail-fast: false
matrix:
Expand Down
66 changes: 53 additions & 13 deletions .github/workflows/e2e_libvirt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ name: (Callable) libvirt e2e tests
on:
workflow_call:
inputs:
runner:
default: 'ubuntu-24.04'
description: The runner to execute the workflow on. Defaults to 'ubuntu-24.04'.
required: false
type: string
podvm_image:
required: true
type: string
Expand All @@ -28,6 +33,12 @@ on:
description: SecureComms configuration. Defaults to none.
required: false
type: string
oras:
description: Whether the podvm_image is oras published
default: false
required: false
type: boolean

env:
CLOUD_PROVIDER: libvirt
DEBIAN_FRONTEND: noninteractive
Expand All @@ -38,7 +49,7 @@ defaults:

jobs:
test:
runs-on: ubuntu-24.04
runs-on: ${{ inputs.runner }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
Expand Down Expand Up @@ -69,10 +80,16 @@ jobs:
- name: Setup docker
if: ${{ runner.environment == 'self-hosted' }}
run: |
sudo apt-get update -y
sudo apt-get install -y docker.io
sudo usermod -aG docker "$USER"

- uses: oras-project/setup-oras@v1
with:
version: ${{ env.ORAS_VERSION }}

- name: Extract qcow2 from ${{ inputs.podvm_image }}
if: ${{ !inputs.oras }}
run: |
qcow2=$(echo ${{ inputs.podvm_image }} | sed -e "s#.*/\(.*\):.*#\1.qcow2#")
./hack/download-image.sh ${{ inputs.podvm_image }} . -o "${qcow2}" --clean-up
Expand All @@ -81,35 +98,58 @@ jobs:
docker system prune -a -f
working-directory: src/cloud-api-adaptor/podvm

- name: Get the install directory
if: ${{ inputs.install_directory_artifact != '' }}
uses: actions/download-artifact@v4
with:
name: ${{ inputs.install_directory_artifact }}
path: src/cloud-api-adaptor/install
- name: Use oras to get qcow2 from ${{ inputs.podvm_image }}
if: ${{ inputs.oras }}
run: |
oras pull ${{ inputs.podvm_image }}
tar xvJpf podvm.tar.xz
qcow2=$(find ./*.qcow2)
echo "PODVM_QCOW2=$(pwd)/${qcow2}" >> "$GITHUB_ENV"
working-directory: src/cloud-api-adaptor/podvm

- name: Config Libvirt
run: |
export TEST_E2E_SECURE_COMMS="${{ inputs.secure_comms }}"
./libvirt/config_libvirt.sh
echo "CAA_IMAGE=\"${{ inputs.caa_image }}\"" >> libvirt.properties
# For debugging
cat libvirt.properties

- uses: oras-project/setup-oras@v1
with:
version: ${{ env.ORAS_VERSION }}

- name: Install gh cli
run: |
sudo apt update -y
sudo apt install -y gh

- name: Double check that OVMF is installed
run: |
sudo apt update -y
sudo apt install -y ovmf
mkulke marked this conversation as resolved.
Show resolved Hide resolved

- name: Install kustomize
run: |
command -v kustomize >/dev/null || \
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | \
sudo bash -s /usr/local/bin

# For the legacy packer approach we don't want to use the default firmware, so comment it out
- name: Set blank firmware for packer libvirt tests
if: ${{ !inputs.oras }}
run: |
cd "install/overlays/libvirt"
sed -i 's/\(- LIBVIRT_EFI_FIRMWARE=.*\)/#\1/g' kustomization.yaml
# Print for debugging
echo "::group::Kustomization.yaml"
cat kustomization.yaml
echo "::endgroup::"

- name: Update kustomization configuration
run: |
cd "install/overlays/libvirt"
kustomize edit set image "cloud-api-adaptor=${{ inputs.caa_image }}"
# Print for debugging
echo "::group::libvirt kustomization"
cat kustomization.yaml
echo "::endgroup::"

- name: Checkout KBS Repository
run: |
test/utils/checkout_kbs.sh
Expand Down Expand Up @@ -190,5 +230,5 @@ jobs:
shell: bash {0}

- name: Clean-up cluster
if: ${{ runner.environment == 'self-hosted' }}
if: ${{ always() && runner.environment == 'self-hosted' }}
run: ./libvirt/kcli_cluster.sh delete
110 changes: 109 additions & 1 deletion .github/workflows/e2e_run_all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,26 @@ jobs:
git_ref: ${{ inputs.git_ref }}
secrets: inherit

podvm_mkosi_amd64:
Copy link
Member

Choose a reason for hiding this comment

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

combine the two jobs in a matrix strategy?

Copy link
Member Author

Choose a reason for hiding this comment

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

Which jobs? Do you mean podvm_mkosi_amd64 and podvm_mkosi_s390x? Maybe I'm missing something clever, but as I've explained a few things people wanted the amd64 and s390x e2e flows to be completely decoupled, so we don't get delayed/blocked by specific issues in an architecture.

uses: ./.github/workflows/podvm_mkosi.yaml
with:
registry: ${{ inputs.registry }}
image_tag: ${{ inputs.podvm_image_tag }}
git_ref: ${{ inputs.git_ref }}
arch: amd64
debug: true
secrets: inherit

podvm_mkosi_s390x:
uses: ./.github/workflows/podvm_mkosi.yaml
with:
registry: ${{ inputs.registry }}
image_tag: ${{ inputs.podvm_image_tag }}
git_ref: ${{ inputs.git_ref }}
arch: s390x
debug: true
secrets: inherit

# Build and push the cloud-api-adaptor image
#
# By using a reusable `workflow_call` workflow we are hitting two
Expand Down Expand Up @@ -97,7 +117,6 @@ jobs:
# then please update the PROVIDERS list (space-separated names, e.g.,
# "aws libvirt").
prep_install:
needs: [image]
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
Expand Down Expand Up @@ -174,3 +193,92 @@ jobs:
git_ref: ${{ inputs.git_ref }}
secure_comms: ${{ matrix.secure_comms }}
secrets: inherit

caa_image_amd64:
uses: ./.github/workflows/caa_build_and_push.yaml
with:
registry: ${{ inputs.registry }}
dev_arches: 'linux/amd64'
release_arches: 'linux/amd64'
dev_tags: ${{ inputs.caa_image_tag }}-amd64-dev
release_tags: ${{ inputs.caa_image_tag }}-amd64
git_ref: ${{ inputs.git_ref }}
secrets: inherit

caa_image_s390x:
uses: ./.github/workflows/caa_build_and_push.yaml
with:
registry: ${{ inputs.registry }}
dev_arches: 'linux/s390x'
release_arches: 'linux/s390x'
dev_tags: ${{ inputs.caa_image_tag }}-s390x-dev
release_tags: ${{ inputs.caa_image_tag }}-s390x
git_ref: ${{ inputs.git_ref }}
runner: 's390x'
secrets: inherit

libvirt_e2e_arch_prep:
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.git_ref }}

- name: Rebase the code
if: github.event_name == 'pull_request_target'
working-directory: ./
run: |
./hack/ci-helper.sh rebase-atop-of-the-latest-target-branch

- name: Define Test Matrix
id: matrix
run: |
echo "matrix=$(jq -c . < ./libvirt/libvirt_e2e_arch_matrix.json)" >> "$GITHUB_OUTPUT"

# Run libvirt amd64 e2e tests, based on the mkosi image, if pull request labeled 'test_e2e_libvirt'
libvirt_amd64:
name: E2E tests on libvirt for the amd64 architecture
if: |
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.labels.*.name, 'test_e2e_libvirt') ||
contains(github.event.pull_request.labels.*.name, 'test_e2e_libvirt_amd64')
needs: [podvm_mkosi_amd64, libvirt_e2e_arch_prep, caa_image_amd64]
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.libvirt_e2e_arch_prep.outputs.matrix) }}
uses: ./.github/workflows/e2e_libvirt.yaml
with:
runner: ubuntu-24.04
caa_image: ${{ inputs.registry }}/cloud-api-adaptor:${{ inputs.caa_image_tag }}-amd64-dev
podvm_image: ${{ needs.podvm_mkosi_amd64.outputs.qcow2_oras_image }}
install_directory_artifact: install_directory
git_ref: ${{ inputs.git_ref }}
oras: true
secrets: inherit

# Run libvirt s390x e2e tests, based on the mkosi image, if pull request labeled 'test_e2e_libvirt'
libvirt_s390x:
name: E2E tests on libvirt for the s390x architecture
if: |
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.labels.*.name, 'test_e2e_libvirt') ||
contains(github.event.pull_request.labels.*.name, 'test_e2e_libvirt_s390x')
needs: [podvm_mkosi_s390x, libvirt_e2e_arch_prep, caa_image_s390x]
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.libvirt_e2e_arch_prep.outputs.matrix) }}
uses: ./.github/workflows/e2e_libvirt.yaml
with:
runner: S390X
caa_image: ${{ inputs.registry }}/cloud-api-adaptor:${{ inputs.caa_image_tag }}-s390x-dev
podvm_image: ${{ needs.podvm_mkosi_s390x.outputs.qcow2_oras_image }}
install_directory_artifact: install_directory
git_ref: ${{ inputs.git_ref }}
oras: true
secrets: inherit
Loading
Loading