diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fc230490b..79feb3ce3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -152,21 +152,9 @@ jobs: target-branch: ${{ inputs.target-branch }} secrets: inherit - run-k8s-tests-on-garm: + run-k8s-tests-on-amd64: needs: publish-kata-deploy-payload-amd64 - uses: ./.github/workflows/run-k8s-tests-on-garm.yaml - with: - registry: ghcr.io - repo: ${{ github.repository_owner }}/kata-deploy-ci - tag: ${{ inputs.tag }}-amd64 - commit-hash: ${{ inputs.commit-hash }} - pr-number: ${{ inputs.pr-number }} - target-branch: ${{ inputs.target-branch }} - secrets: inherit - - run-k8s-tests-with-crio-on-garm: - needs: publish-kata-deploy-payload-amd64 - uses: ./.github/workflows/run-k8s-tests-with-crio-on-garm.yaml + uses: ./.github/workflows/run-k8s-tests-on-amd64.yaml with: registry: ghcr.io repo: ${{ github.repository_owner }}/kata-deploy-ci diff --git a/.github/workflows/run-k8s-tests-on-garm.yaml b/.github/workflows/run-k8s-tests-on-amd64.yaml similarity index 75% rename from .github/workflows/run-k8s-tests-on-garm.yaml rename to .github/workflows/run-k8s-tests-on-amd64.yaml index 4736baa07..338e923f2 100644 --- a/.github/workflows/run-k8s-tests-on-garm.yaml +++ b/.github/workflows/run-k8s-tests-on-amd64.yaml @@ -1,4 +1,4 @@ -name: CI | Run kubernetes tests on GARM +name: CI | Run kubernetes tests on amd64 on: workflow_call: inputs: @@ -23,7 +23,7 @@ on: default: "" jobs: - run-k8s-tests: + run-k8s-tests-amd64: strategy: fail-fast: false matrix: @@ -33,19 +33,18 @@ jobs: - fc #firecracker - qemu - cloud-hypervisor + container_runtime: + - containerd snapshotter: - devmapper k8s: - k3s - instance: - - garm-ubuntu-2004 - - garm-ubuntu-2004-smaller include: - - instance: garm-ubuntu-2004 - instance-type: normal - - instance: garm-ubuntu-2004-smaller - instance-type: small - runs-on: ${{ matrix.instance }} + - vmm: qemu + container_runtime: crio + snapshotter: "" + k8s: k0s + runs-on: ubuntu-22.04 env: DOCKER_REGISTRY: ${{ inputs.registry }} DOCKER_REPO: ${{ inputs.repo }} @@ -53,9 +52,10 @@ jobs: PR_NUMBER: ${{ inputs.pr-number }} KATA_HYPERVISOR: ${{ matrix.vmm }} KUBERNETES: ${{ matrix.k8s }} + KUBERNETES_EXTRA_PARAMS: ${{ matrix.container_runtime != 'crio' && '' || '--cri-socket remote:unix:///var/run/crio/crio.sock --kubelet-extra-args --cgroup-driver="systemd"' }} SNAPSHOTTER: ${{ matrix.snapshotter }} USING_NFD: "false" - K8S_TEST_HOST_TYPE: ${{ matrix.instance-type }} + K8S_TEST_HOST_TYPE: all steps: - uses: actions/checkout@v4 with: @@ -68,15 +68,20 @@ jobs: env: TARGET_BRANCH: ${{ inputs.target-branch }} + - name: Configure CRI-O + if: matrix.container_runtime == 'crio' + run: bash tests/integration/kubernetes/gha-run.sh setup-crio + - name: Deploy ${{ matrix.k8s }} run: bash tests/integration/kubernetes/gha-run.sh deploy-k8s - name: Configure the ${{ matrix.snapshotter }} snapshotter + if: matrix.snapshotter != '' run: bash tests/integration/kubernetes/gha-run.sh configure-snapshotter - name: Deploy Kata timeout-minutes: 10 - run: bash tests/integration/kubernetes/gha-run.sh deploy-kata-garm + run: bash tests/integration/kubernetes/gha-run.sh deploy-kata - name: Install `bats` run: bash tests/integration/kubernetes/gha-run.sh install-bats @@ -93,10 +98,10 @@ jobs: - name: Archive artifacts ${{ matrix.vmm }} uses: actions/upload-artifact@v4 with: - name: k8s-tests-garm-${{ matrix.vmm }}-${{ matrix.snapshotter }}-${{ matrix.k8s }}-${{ matrix.instance }}-${{ inputs.tag }} + name: k8s-tests-${{ matrix.vmm }}-${{ matrix.snapshotter }}-${{ matrix.k8s }}-${{ matrix.instance }}-${{ inputs.tag }} path: /tmp/artifacts retention-days: 1 - name: Delete kata-deploy if: always() - run: bash tests/integration/kubernetes/gha-run.sh cleanup-garm + run: bash tests/integration/kubernetes/gha-run.sh cleanup diff --git a/.github/workflows/run-k8s-tests-with-crio-on-garm.yaml b/.github/workflows/run-k8s-tests-with-crio-on-garm.yaml deleted file mode 100644 index 0370e1031..000000000 --- a/.github/workflows/run-k8s-tests-with-crio-on-garm.yaml +++ /dev/null @@ -1,86 +0,0 @@ -name: CI | Run kubernetes tests, using CRI-O, on GARM -on: - workflow_call: - inputs: - registry: - required: true - type: string - repo: - required: true - type: string - tag: - required: true - type: string - pr-number: - required: true - type: string - commit-hash: - required: false - type: string - target-branch: - required: false - type: string - default: "" - -jobs: - run-k8s-tests: - strategy: - fail-fast: false - matrix: - vmm: - - qemu - k8s: - - k0s - instance: - - garm-ubuntu-2204 - - garm-ubuntu-2204-smaller - include: - - instance: garm-ubuntu-2204 - instance-type: normal - - instance: garm-ubuntu-2204-smaller - instance-type: small - - k8s: k0s - k8s-extra-params: '--cri-socket remote:unix:///var/run/crio/crio.sock --kubelet-extra-args --cgroup-driver="systemd"' - runs-on: ${{ matrix.instance }} - env: - DOCKER_REGISTRY: ${{ inputs.registry }} - DOCKER_REPO: ${{ inputs.repo }} - DOCKER_TAG: ${{ inputs.tag }} - PR_NUMBER: ${{ inputs.pr-number }} - KATA_HYPERVISOR: ${{ matrix.vmm }} - KUBERNETES: ${{ matrix.k8s }} - KUBERNETES_EXTRA_PARAMS: ${{ matrix.k8s-extra-params }} - USING_NFD: "false" - K8S_TEST_HOST_TYPE: ${{ matrix.instance-type }} - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.commit-hash }} - fetch-depth: 0 - - - name: Rebase atop of the latest target branch - run: | - ./tests/git-helper.sh "rebase-atop-of-the-latest-target-branch" - env: - TARGET_BRANCH: ${{ inputs.target-branch }} - - - name: Configure CRI-O - run: bash tests/integration/kubernetes/gha-run.sh setup-crio - - - name: Deploy ${{ matrix.k8s }} - run: bash tests/integration/kubernetes/gha-run.sh deploy-k8s - - - name: Deploy Kata - timeout-minutes: 10 - run: bash tests/integration/kubernetes/gha-run.sh deploy-kata-garm - - - name: Install `bats` - run: bash tests/integration/kubernetes/gha-run.sh install-bats - - - name: Run tests - timeout-minutes: 30 - run: bash tests/integration/kubernetes/gha-run.sh run-tests - - - name: Delete kata-deploy - if: always() - run: bash tests/integration/kubernetes/gha-run.sh cleanup-garm diff --git a/tests/integration/kubernetes/gha-run.sh b/tests/integration/kubernetes/gha-run.sh index 4df75441e..fda4d9851 100755 --- a/tests/integration/kubernetes/gha-run.sh +++ b/tests/integration/kubernetes/gha-run.sh @@ -146,7 +146,7 @@ function deploy_coco_kbs() { } function deploy_kata() { - platform="${1}" + platform="${1:-}" ensure_helm ensure_yq @@ -389,7 +389,7 @@ function cleanup_kata_deploy() { } function cleanup() { - platform="${1}" + platform="${1:-}" test_type="${2:-k8s}" ensure_yq @@ -559,6 +559,7 @@ function main() { install-kbs-client) install_kbs_client ;; install-kubectl) install_kubectl ;; get-cluster-credentials) get_cluster_credentials ;; + deploy-kata) deploy_kata ;; deploy-kata-aks) deploy_kata "aks" ;; deploy-kata-kcli) deploy_kata "kcli" ;; deploy-kata-kubeadm) deploy_kata "kubeadm" ;; @@ -571,6 +572,7 @@ function main() { run-tests) run_tests ;; run-tests-kcli) run_tests "kcli" ;; collect-artifacts) collect_artifacts ;; + cleanup) cleanup ;; cleanup-kcli) cleanup "kcli" ;; cleanup-sev) cleanup "sev" ;; cleanup-snp) cleanup "snp" ;;