Skip to content

Commit

Permalink
test/e2e: build podvm on e2e_on_pull
Browse files Browse the repository at this point in the history
Until now the `e2e_on_pull` workflow was using built podvm images, where
the qcow2 files are extracted and uploaded as artifacts which are picked
up by downstream jobs (e.g. `e2e_libvirt`). This changed the workflow to
leverage the new `podvm_builder`, `podvm_binaries` and `podvm` workflows
so that the podvm images are built from the pull request code, pushed to
ghcr.io and the downstream jobs should extract the qcow2 file
themselves.

Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
  • Loading branch information
wainersm committed Nov 15, 2023
1 parent 2a60369 commit 6f6b91d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 41 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/e2e_libvirt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: (Callable) libvirt e2e tests
on:
workflow_call:
inputs:
qcow2_artifact:
podvm_image:
required: true
type: string
install_directory_artifact:
Expand Down Expand Up @@ -47,10 +47,12 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}

- uses: actions/download-artifact@v3
with:
name: ${{ inputs.qcow2_artifact }}
path: podvm
- name: Extract qcow2 from ${{ inputs.podvm_image }}
run: |
qcow2=$(echo ${{ inputs.podvm_image }} | sed -e "s#.*/\(.*\):.*#\1.qcow2#")
./hack/download-image.sh ${{ inputs.podvm_image }} . -o ${qcow2}
echo "PODVM_QCOW2=$(pwd)/${qcow2}" >> "$GITHUB_ENV"
working-directory: podvm

- name: Get the install directory
if: ${{ inputs.install_directory_artifact != '' }}
Expand Down Expand Up @@ -155,7 +157,7 @@ jobs:
export TEST_PROVISION="yes"
export TEST_TEARDOWN="no"
export TEST_PROVISION_FILE="$PWD/libvirt.properties"
export TEST_PODVM_IMAGE="${PWD}/podvm/${{ inputs.qcow2_artifact }}"
export TEST_PODVM_IMAGE="${{ env.PODVM_QCOW2 }}"
export TEST_E2E_TIMEOUT="50m"
make test-e2e
Expand Down
56 changes: 21 additions & 35 deletions .github/workflows/e2e_on_pull.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,43 +43,29 @@ jobs:

# Build the podvm images.
#
# Currently it will not build the podvm, instead it downloads the qcow2 file
# from the built image. The file will be archived so that downstream jobs can
# just download the file on their runners.
podvm:
name: podvm
podvm_builder:
needs: [authorize]
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
os:
- centos
- ubuntu
provider:
- generic
arch:
- amd64
env:
registry: quay.io/confidential-containers
podvm_image: podvm-${{ matrix.provider }}-${{ matrix.os }}-${{ matrix.arch }}
qcow2: podvm-${{ matrix.provider }}-${{ matrix.os }}-${{ matrix.arch }}.qcow2
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
uses: ./.github/workflows/podvm_builder.yaml
with:
registry: ghcr.io/${{ github.repository_owner }}
image_tag: ci-pr${{ github.event.number }}
secrets: inherit

- name: Extract the podvm qcow2
run: ./hack/download-image.sh ${{ env.registry }}/${{ env.podvm_image }} . -o ${{ env.qcow2 }}
working-directory: podvm
podvm_binaries:
needs: [podvm_builder]
uses: ./.github/workflows/podvm_binaries.yaml
with:
registry: ghcr.io/${{ github.repository_owner }}
image_tag: ci-pr${{ github.event.number }}
secrets: inherit

- uses: actions/upload-artifact@v3
with:
name: ${{ env.qcow2 }}
path: podvm/${{ env.qcow2 }}
retention-days: 1
podvm:
needs: [podvm_binaries]
uses: ./.github/workflows/podvm.yaml
with:
registry: ghcr.io/${{ github.repository_owner }}
image_tag: ci-pr${{ github.event.number }}
secrets: inherit

# Build and push the cloud-api-adaptor image
#
Expand Down Expand Up @@ -175,6 +161,6 @@ jobs:
- amd64
uses: ./.github/workflows/e2e_libvirt.yaml
with:
qcow2_artifact: podvm-${{ matrix.provider }}-${{ matrix.os }}-${{ matrix.arch }}.qcow2
podvm_image: ghcr.io/${{ github.repository_owner }}/podvm-${{ matrix.provider }}-${{ matrix.os }}-${{ matrix.arch }}:ci-pr${{ github.event.number }}
install_directory_artifact: install_directory
git_ref: ${{ github.event.pull_request.head.sha }}

0 comments on commit 6f6b91d

Please sign in to comment.