Skip to content

Commit

Permalink
workflows: add daily e2e tests for libvirt
Browse files Browse the repository at this point in the history
Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
  • Loading branch information
wainersm committed Nov 20, 2023
1 parent a818375 commit db9a17b
Showing 1 changed file with 141 additions and 0 deletions.
141 changes: 141 additions & 0 deletions .github/workflows/daily-e2e-tests-libvirt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# (C) Copyright Confidential Containers Contributors 2023.
# SPDX-License-Identifier: Apache-2.0
#
# Daily run the e2e tests for libvirt.
---
name: daily e2e tests for libvirt

on:
schedule:
# Runs "at 04:00(UTC time) every day" (see https://crontab.guru)
# will base on default branch `main`
- cron: '0 * * * *'
workflow_dispatch:

env:
# cloud-api-adaptor image registry
E2E_IMG_REGISTRY: ghcr.io/${{ github.repository_owner }}
# cloud-api-adaptor: image release tag
E2E_IMG_RELEASE_TAG: latest
# cloud-api-adaptor image dev tag
E2E_IMG_DEV_TAG: latest-dev

jobs:

# Build the podvm images.
#
podvm_builder:
uses: ./.github/workflows/podvm_builder.yaml
with:
registry: ghcr.io/${{ github.repository_owner }}
image_tag: latest
secrets: inherit

podvm_binaries:
needs: [podvm_builder]
uses: ./.github/workflows/podvm_binaries.yaml
with:
registry: ghcr.io/${{ github.repository_owner }}
image_tag: latest
secrets: inherit

podvm:
needs: [podvm_binaries]
uses: ./.github/workflows/podvm.yaml
with:
registry: ghcr.io/${{ github.repository_owner }}
image_tag: latest
secrets: inherit

# Build and push the cloud-api-adaptor image
#
# By using a reusable `workflow_call` workflow we are hitting two
# GHA limitations here:
#
# - Cannot access the `env` context from the `with` so that it cannot
# reuse the E2E_IMG_* environment variables set at this workflow level.
# - Cannot call a reusable workflow from a job's step, so the we cannot
# merge the `image` and `prep_env` into a single one (unless we create
# another reusable workflow and, well, likely hit another limitation...).
#
# Reference: https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations
#
image:
uses: ./.github/workflows/caa_build_and_push.yaml
with:
registry: ghcr.io/${{ github.repository_owner }}
dev_tags: latest-dev
release_tags: latest
git_ref: main
secrets: inherit

# Edit the kustomize files under the install directory to reference the
# built cloud-api-adaptor images. The entire directory is archived so that
# downstream jobs can simply download and use the prepared installation
# files.
#
# IMPORTANT: If you are enabling e2e tests for a given provider,
# then please update the PROVIDERS list (space-separated names, e.g.,
# "aws libvirt").
prep_install:
needs: [image]
runs-on: ubuntu-latest
env:
PROVIDERS: "libvirt"
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Install kustomize
run: |
command -v kustomize >/dev/null || \
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | \
bash -s /usr/local/bin
- name: Update kustomization configuration
run: |
providers=(${{ env.PROVIDERS }})
# If there aren't providers then something is wrong
[[ ${#providers[@]} -gt 0 ]] || exit 1
for provider in ${providers[@]}; do
img="${E2E_IMG_REGISTRY}/cloud-api-adaptor"
tag="${E2E_IMG_RELEASE_TAG}"
[[ "$provider" = "libvirt" ]] && tag="${E2E_IMG_DEV_TAG}"
echo "::group::Update ${provider}"
pushd "install/overlays/${provider}"
kustomize edit set image "cloud-api-adaptor=${img}:${tag}"
# Print for debugging
cat kustomization.yaml
echo "::endgroup::"
# Validate the file to avoid it silently testing with a wrong image
grep "newName: ${img}" kustomization.yaml
grep "newTag: ${tag}" kustomization.yaml
popd
done
- uses: actions/upload-artifact@v3
with:
name: install_directory
path: install/
retention-days: 7

# Run libvirt e2e tests if pull request labeled 'test_e2e_libvirt'
libvirt:
name: libvirt
needs: [podvm, image, prep_install]
strategy:
fail-fast: false
matrix:
os:
- centos
- ubuntu
provider:
- generic
arch:
- amd64
uses: ./.github/workflows/e2e_libvirt.yaml
with:
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: main

0 comments on commit db9a17b

Please sign in to comment.