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: Enhance s390x mkosi workflow #2019

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
116 changes: 116 additions & 0 deletions .github/workflows/e2e_docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# (C) Copyright Confidential Containers Contributors 2024.
# SPDX-License-Identifier: Apache-2.0
#
# Run docker e2e tests.
name: (Callable) docker e2e tests

on:
workflow_call:
inputs:
podvm_image:
required: true
type: string
caa_image:
required: true
type: string
caa_image_tag:
required: false
default: "latest"
type: string
install_directory_artifact:
description: The archive name of the install directory
default: ''
required: false
type: string
git_ref:
default: 'main'
description: Git ref to checkout the cloud-api-adaptor repository. Defaults to main.
required: false
type: string

env:
CLOUD_PROVIDER: docker
DEBIAN_FRONTEND: noninteractive

defaults:
run:
working-directory: src/cloud-api-adaptor

jobs:
test-docker:
runs-on: ubuntu-22.04
# TODO: remove this when the job gets stable
continue-on-error: true
steps:
- name: Checkout Code
uses: actions/checkout@v3
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: Login to quay Container Registry
if: ${{ startsWith(inputs.podvm_image, 'quay.io') }}
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Login to the ghcr Container registry
if: ${{ startsWith(inputs.podvm_image, 'ghcr.io') }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- 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"

- name: Setup Golang version ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Get the install directory
if: ${{ inputs.install_directory_artifact != '' }}
uses: actions/download-artifact@v3
with:
name: ${{ inputs.install_directory_artifact }}
path: src/cloud-api-adaptor/install

- name: Config docker
run: |
cat <<- EOF > docker.properties
CAA_IMAGE="${{ inputs.caa_image }}"
CAA_IMAGE_TAG="${{ inputs.caa_image_tag }}"
CLUSTER_NAME="peer-pods"
DOCKER_PODVM_IMAGE="${{ inputs.podvm_image }}"
DOCKER_HOST="unix:///var/run/docker.sock"
DOCKER_NETWORK_NAME="kind"
EOF
# For debugging
cat docker.properties

- name: run tests
id: runTests
run: |
export CLOUD_PROVIDER=docker
export DEPLOY_KBS=false
export TEST_PROVISION=yes
export TEST_TEARDOWN=no
export TEST_PROVISION_FILE="$PWD/docker.properties"
export TEST_PODVM_IMAGE="${{ inputs.podvm_image }}"
export TEST_E2E_TIMEOUT="50m"

make test-e2e
21 changes: 20 additions & 1 deletion .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: 'az-ubuntu-2204'
description: The runner to execute the workflow on. Defaults to 'az-ubuntu-2204'.
required: false
type: string
podvm_image:
required: true
type: string
Expand Down Expand Up @@ -34,7 +39,7 @@ defaults:

jobs:
test:
runs-on: az-ubuntu-2204
runs-on: ${{ inputs.runner }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
Expand Down Expand Up @@ -116,6 +121,10 @@ jobs:
AUTHENTICATED_REGISTRY_IMAGE: ${{ vars.AUTHENTICATED_REGISTRY_IMAGE }}
REGISTRY_CREDENTIAL_ENCODED: ${{ secrets.REGISTRY_CREDENTIAL_ENCODED }}
run: |
# s390x on non-TEE need a dummy directory for the KBS
if [[ "${{ inputs.runner }}" == "S390X" ]]; then
export IBM_SE_CREDS_DIR="$(mktemp -d -t ibmse.creds.XXXXXXXXXX)"
fi
export CLOUD_PROVIDER=libvirt
export DEPLOY_KBS=true
export TEST_PROVISION="yes"
Expand All @@ -131,8 +140,14 @@ jobs:
run: |
export KUBECONFIG="${HOME}/.kcli/clusters/peer-pods/auth/kubeconfig"

echo "::group::KBS installation"
kubectl get pods -n coco-tenant
kubectl describe pods -n coco-tenant
echo "::endgroup::"

echo "::group::CoCo and Peer Pods installation"
kubectl get pods -n confidential-containers-system
kubectl describe pods -n confidential-containers-system
echo "::endgroup::"

echo "::group::cloud-api-adaptor logs"
Expand Down Expand Up @@ -166,3 +181,7 @@ jobs:
echo "::endgroup::"
# Avoid running with `set -e` as command fails should be allowed
shell: bash {0}

- name: Clean-up cluster
if: always()
run: ./libvirt/kcli_cluster.sh delete
47 changes: 41 additions & 6 deletions .github/workflows/e2e_run_all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ jobs:
git_ref: ${{ inputs.git_ref }}
secrets: inherit

podvm-mkosi:
uses: ./.github/workflows/podvm_mkosi.yaml
with:
registry: ${{ inputs.registry }}
image_tag: ${{ inputs.podvm_image_tag }}
git_ref: ${{ inputs.git_ref }}
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 @@ -100,7 +109,7 @@ jobs:
needs: [image]
runs-on: ubuntu-latest
env:
PROVIDERS: "libvirt"
PROVIDERS: "docker libvirt"
steps:
- name: Checkout Code
uses: actions/checkout@v3
Expand Down Expand Up @@ -156,19 +165,45 @@ jobs:
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.labels.*.name, 'test_e2e_libvirt')
needs: [podvm, image, prep_install]
strategy:
fail-fast: false
matrix:
platforms: [
{ os: ubuntu, provider: generic, arch: "amd64", runner: "az-ubuntu-2204", debug_flag: ""},
{ os: fedora, provider: generic, arch: "amd64", runner: "az-ubuntu-2204", debug_flag: "-debug"},
{ os: ubuntu, provider: generic, arch: "s390x", runner: "S390X", debug_flag: "" },
{ os: fedora, provider: generic,arch: "s390x", runner: "S390X", debug_flag: "-debug" },
]
uses: ./.github/workflows/e2e_libvirt.yaml
with:
runner: ${{ matrix.platforms.runner }}
caa_image: ${{ inputs.registry }}/cloud-api-adaptor:${{ inputs.caa_image_tag }}-dev
podvm_image: ${{ inputs.registry }}/podvm-${{ matrix.platforms.provider }}-${{ matrix.platforms.os }}-${{ matrix.platforms.arch }}:${{ inputs.podvm_image_tag }}${{ matrix.platforms.debug_flag }}
install_directory_artifact: install_directory
git_ref: ${{ inputs.git_ref }}
secrets: inherit

# Run docker e2e tests if pull request labeled 'test_e2e_docker'
docker:
name: docker
if: |
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch'
needs: [podvm, image, prep_install]
strategy:
fail-fast: false
matrix:
os:
- ubuntu
- fedora
provider:
- generic
- docker
arch:
- amd64
uses: ./.github/workflows/e2e_libvirt.yaml
uses: ./.github/workflows/e2e_docker.yaml
with:
caa_image: ${{ inputs.registry }}/cloud-api-adaptor:${{ inputs.caa_image_tag }}-dev
podvm_image: ${{ inputs.registry }}/podvm-${{ matrix.provider }}-${{ matrix.os }}-${{ matrix.arch }}:${{ inputs.podvm_image_tag }}
caa_image: ${{ inputs.registry }}/cloud-api-adaptor
caa_image_tag: ${{ inputs.caa_image_tag }}
podvm_image: ${{ inputs.registry }}/podvm-${{ matrix.provider }}-image:${{ inputs.podvm_image_tag }}
install_directory_artifact: install_directory
git_ref: ${{ inputs.git_ref }}
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/podvm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defaults:
jobs:
build:
name: Create pod vm image
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand Down
Loading
Loading