From a818375ba1fdc512c2223948cdbfaa03e49e76ad Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Tue, 12 Sep 2023 11:43:36 -0300 Subject: [PATCH] test/e2e: build podvm on e2e_on_pull 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 --- .github/workflows/e2e_libvirt.yaml | 14 ++++---- .github/workflows/e2e_on_pull.yaml | 56 +++++++++++------------------- 2 files changed, 29 insertions(+), 41 deletions(-) diff --git a/.github/workflows/e2e_libvirt.yaml b/.github/workflows/e2e_libvirt.yaml index 8f311a8e9..5aaa60495 100644 --- a/.github/workflows/e2e_libvirt.yaml +++ b/.github/workflows/e2e_libvirt.yaml @@ -7,7 +7,7 @@ name: (Callable) libvirt e2e tests on: workflow_call: inputs: - qcow2_artifact: + podvm_image: required: true type: string install_directory_artifact: @@ -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 != '' }} @@ -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 diff --git a/.github/workflows/e2e_on_pull.yaml b/.github/workflows/e2e_on_pull.yaml index 270eb426e..eb2211e91 100644 --- a/.github/workflows/e2e_on_pull.yaml +++ b/.github/workflows/e2e_on_pull.yaml @@ -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 # @@ -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 }} \ No newline at end of file