-
Notifications
You must be signed in to change notification settings - Fork 94
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
Daily Libvirt CI #1595
Merged
wainersm
merged 3 commits into
confidential-containers:main
from
wainersm:daily_libvirt_ci
Dec 6, 2023
Merged
Daily Libvirt CI #1595
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# (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:15(UTC time) every day" (see https://crontab.guru) | ||
# will base on default branch `main` | ||
- cron: '15 4 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
e2e: | ||
uses: ./.github/workflows/e2e_run_all.yaml | ||
with: | ||
caa_image_tag: latest | ||
git_ref: refs/heads/main | ||
podvm_image_tag: latest | ||
registry: ghcr.io/${{ github.repository_owner }} | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
# (C) Copyright Confidential Containers Contributors 2023. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Run end-to-end (e2e) tests. | ||
--- | ||
name: (Callable) Run all e2e tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
caa_image_tag: | ||
description: set the cloud-api-adaptor image tag | ||
required: true | ||
type: string | ||
git_ref: | ||
default: 'main' | ||
description: Git ref to checkout the cloud-api-adaptor repository. Defaults to main. | ||
required: false | ||
type: string | ||
podvm_image_tag: | ||
description: set the podvm_builder/podvm_binaries/podvm image tag | ||
required: true | ||
type: string | ||
registry: | ||
description: the container registry where built images will be pushed to | ||
required: true | ||
type: string | ||
env: | ||
# cloud-api-adaptor image registry | ||
E2E_IMG_REGISTRY: ${{ inputs.registry }} | ||
# cloud-api-adaptor: image release tag | ||
E2E_IMG_RELEASE_TAG: ${{ inputs.caa_image_tag }} | ||
# cloud-api-adaptor image dev tag | ||
E2E_IMG_DEV_TAG: ${{ inputs.caa_image_tag }}-dev | ||
|
||
jobs: | ||
# Build the podvm images. | ||
# | ||
podvm_builder: | ||
uses: ./.github/workflows/podvm_builder.yaml | ||
with: | ||
registry: ${{ inputs.registry }} | ||
image_tag: ${{ inputs.podvm_image_tag }} | ||
git_ref: ${{ inputs.git_ref }} | ||
secrets: inherit | ||
|
||
podvm_binaries: | ||
needs: [podvm_builder] | ||
uses: ./.github/workflows/podvm_binaries.yaml | ||
with: | ||
registry: ${{ inputs.registry }} | ||
image_tag: ${{ inputs.podvm_image_tag }} | ||
git_ref: ${{ inputs.git_ref }} | ||
secrets: inherit | ||
|
||
podvm: | ||
needs: [podvm_binaries] | ||
uses: ./.github/workflows/podvm.yaml | ||
with: | ||
registry: ${{ inputs.registry }} | ||
image_tag: ${{ inputs.podvm_image_tag }} | ||
git_ref: ${{ inputs.git_ref }} | ||
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: ${{ inputs.registry }} | ||
dev_tags: ${{ inputs.caa_image_tag }}-dev | ||
release_tags: ${{ inputs.caa_image_tag }} | ||
git_ref: ${{ inputs.git_ref }} | ||
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 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ inputs.git_ref }} | ||
|
||
- 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 | ||
if: | | ||
github.event_name == 'schedule' || | ||
github.event_name == 'workflow_dispatch' || | ||
contains(github.event.pull_request.labels.*.name, 'test_e2e_libvirt') | ||
ldoktor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
needs: [podvm, image, prep_install] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
# FIXME: temporarily disable CentOS tests as the CentOS podvm builds | ||
# are disabled due https://github.com/confidential-containers/cloud-api-adaptor/issues/1558 | ||
#- centos | ||
- ubuntu | ||
provider: | ||
- generic | ||
arch: | ||
- amd64 | ||
uses: ./.github/workflows/e2e_libvirt.yaml | ||
with: | ||
podvm_image: ${{ inputs.registry }}/podvm-${{ matrix.provider }}-${{ matrix.os }}-${{ matrix.arch }}:${{ inputs.podvm_image_tag }} | ||
install_directory_artifact: install_directory | ||
git_ref: ${{ inputs.git_ref }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if github supports
H
but with cronjobs it's usually adviced to useH
rather than picking up random minute values so that cron can distribute the workflows throughout the hour (H 4 * * *
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I learned something new today :)
But I don't know whether github supports
H
or not. It claims to use the POSIX cron syntax (https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule) but not sure if all expressions.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jenkins knows it ;-)