From e43c59a2c6c4449e703e50e00099d92d282be1da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bombo?= Date: Thu, 21 Nov 2024 16:06:55 -0600 Subject: [PATCH 1/3] ci: Add no-op step to compile CSI driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds a no-op build step to compile the CSI driver. The actual compilation will be implemented in an ulterior PR, so as to ensure we don't break the CI. Addresses: #10560 Signed-off-by: Aurélien Bombo --- .github/workflows/build-kata-static-tarball-amd64.yaml | 1 + tools/packaging/kata-deploy/local-build/Makefile | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/build-kata-static-tarball-amd64.yaml b/.github/workflows/build-kata-static-tarball-amd64.yaml index 3c38b8bcb0..f635413ff1 100644 --- a/.github/workflows/build-kata-static-tarball-amd64.yaml +++ b/.github/workflows/build-kata-static-tarball-amd64.yaml @@ -37,6 +37,7 @@ jobs: - cloud-hypervisor - cloud-hypervisor-glibc - coco-guest-components + - csi-kata-directvolume - firecracker - genpolicy - kata-ctl diff --git a/tools/packaging/kata-deploy/local-build/Makefile b/tools/packaging/kata-deploy/local-build/Makefile index ced6a4e7e2..a4827a699d 100644 --- a/tools/packaging/kata-deploy/local-build/Makefile +++ b/tools/packaging/kata-deploy/local-build/Makefile @@ -92,6 +92,9 @@ cloud-hypervisor-tarball: cloud-hypervisor-glibc-tarball: ${MAKE} $@-build +csi-kata-directvolume-tarball: copy-scripts-for-the-tools-build + exit 0 + firecracker-tarball: ${MAKE} $@-build From 893f6a4ca05c44bf6375c12e9d47bf6005ee7b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bombo?= Date: Thu, 21 Nov 2024 16:07:59 -0600 Subject: [PATCH 2/3] ci: Introduce job to publish CSI driver image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds a new job to build and publish the CSI driver Docker image. Of course this job will fail after we merge this PR because the CSI driver compilation job hasn't been implemented yet. However that will be implemented directly after in #10561. Signed-off-by: Aurélien Bombo --- .github/workflows/ci.yaml | 11 ++++ .../workflows/publish-csi-driver-amd64.yaml | 66 +++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 .github/workflows/publish-csi-driver-amd64.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 72f516343d..9c72ed83b0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -135,6 +135,17 @@ jobs: platforms: linux/amd64, linux/s390x file: tests/integration/kubernetes/runtimeclass_workloads/confidential/unencrypted/Dockerfile + publish-csi-driver-amd64: + needs: publish-kata-deploy-payload-amd64 + uses: ./.github/workflows/publish-csi-driver-amd64.yaml + with: + commit-hash: ${{ inputs.commit-hash }} + pr-number: ${{ inputs.pr-number }} + registry: ghcr.io + tarball-suffix: -${{ inputs.tag }} + target-branch: ${{ inputs.target-branch }} + secrets: inherit + run-kata-monitor-tests: if: ${{ inputs.skip-test != 'yes' }} needs: build-kata-static-tarball-amd64 diff --git a/.github/workflows/publish-csi-driver-amd64.yaml b/.github/workflows/publish-csi-driver-amd64.yaml new file mode 100644 index 0000000000..877f5ba024 --- /dev/null +++ b/.github/workflows/publish-csi-driver-amd64.yaml @@ -0,0 +1,66 @@ +name: CI | Publish CSI driver for amd64 +on: + workflow_call: + inputs: + pr-number: + required: true + type: string + tarball-suffix: + required: false + type: string + registry: + required: true + type: string + commit-hash: + required: false + type: string + target-branch: + required: false + type: string + default: "" + +jobs: + publish-csi-driver: + runs-on: ubuntu-22.04 + steps: + - name: Checkout code + 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: get-kata-tarball + uses: actions/download-artifact@v4 + with: + name: kata-static-tarball-amd64${{ inputs.tarball-suffix }} + path: kata-artifacts + + - name: Install tools + run: bash tests/integration/kubernetes/gha-run.sh install-kata-tools kata-artifacts + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Kata Containers ghcr.io + uses: docker/login-action@v3 + with: + registry: ${{ inputs.registry }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker build and push + uses: docker/build-push-action@v5 + with: + tags: ghcr.io/kata-containers/csi-kata-directvolume:${{ inputs.pr-number }} + push: true + context: src/tools/csi-kata-directvolume/ + platforms: linux/amd64 + file: src/tools/csi-kata-directvolume/Dockerfile + build-args: | + binary=/opt/kata/bin/csi-kata-directvolume From 5e4990bcf50fb19b890f2f725bfe46e92b50bf4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bombo?= Date: Tue, 19 Nov 2024 16:30:44 -0600 Subject: [PATCH 3/3] coco: ci: Add no-op steps to deploy CSI driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds no-op steps that'll be used to deploy and clean up the CSI driver used for testing. Signed-off-by: Aurélien Bombo --- .github/workflows/run-kata-coco-tests.yaml | 28 ++++++++++++++++++++++ tests/integration/kubernetes/gha-run.sh | 2 ++ 2 files changed, 30 insertions(+) diff --git a/.github/workflows/run-kata-coco-tests.yaml b/.github/workflows/run-kata-coco-tests.yaml index 2710641ed7..85dd43dded 100644 --- a/.github/workflows/run-kata-coco-tests.yaml +++ b/.github/workflows/run-kata-coco-tests.yaml @@ -86,6 +86,10 @@ jobs: timeout-minutes: 10 run: bash tests/integration/kubernetes/gha-run.sh install-kbs-client + - name: Deploy CSI driver + timeout-minutes: 5 + run: bash tests/integration/kubernetes/gha-run.sh deploy-csi-driver + - name: Run tests timeout-minutes: 100 run: bash tests/integration/kubernetes/gha-run.sh run-tests @@ -102,6 +106,10 @@ jobs: if: always() run: bash tests/integration/kubernetes/gha-run.sh delete-coco-kbs + - name: Delete CSI driver + timeout-minutes: 5 + run: bash tests/integration/kubernetes/gha-run.sh delete-csi-driver + run-k8s-tests-on-sev: strategy: fail-fast: false @@ -148,10 +156,18 @@ jobs: timeout-minutes: 10 run: bash tests/integration/kubernetes/gha-run.sh deploy-kata-sev + - name: Deploy CSI driver + timeout-minutes: 5 + run: bash tests/integration/kubernetes/gha-run.sh deploy-csi-driver + - name: Run tests timeout-minutes: 50 run: bash tests/integration/kubernetes/gha-run.sh run-tests + - name: Delete CSI driver + timeout-minutes: 5 + run: bash tests/integration/kubernetes/gha-run.sh delete-csi-driver + - name: Delete kata-deploy if: always() run: bash tests/integration/kubernetes/gha-run.sh cleanup-sev @@ -220,6 +236,10 @@ jobs: timeout-minutes: 10 run: bash tests/integration/kubernetes/gha-run.sh install-kbs-client + - name: Deploy CSI driver + timeout-minutes: 5 + run: bash tests/integration/kubernetes/gha-run.sh deploy-csi-driver + - name: Run tests timeout-minutes: 50 run: bash tests/integration/kubernetes/gha-run.sh run-tests @@ -236,6 +256,10 @@ jobs: if: always() run: bash tests/integration/kubernetes/gha-run.sh delete-coco-kbs + - name: Delete CSI driver + timeout-minutes: 5 + run: bash tests/integration/kubernetes/gha-run.sh delete-csi-driver + # Generate jobs for testing CoCo on non-TEE environments run-k8s-tests-coco-nontee: strategy: @@ -327,6 +351,10 @@ jobs: timeout-minutes: 10 run: bash tests/integration/kubernetes/gha-run.sh install-kbs-client + - name: Deploy CSI driver + timeout-minutes: 5 + run: bash tests/integration/kubernetes/gha-run.sh deploy-csi-driver + - name: Run tests timeout-minutes: 80 run: bash tests/integration/kubernetes/gha-run.sh run-tests diff --git a/tests/integration/kubernetes/gha-run.sh b/tests/integration/kubernetes/gha-run.sh index 8d2e998add..1fd5747e48 100755 --- a/tests/integration/kubernetes/gha-run.sh +++ b/tests/integration/kubernetes/gha-run.sh @@ -578,6 +578,7 @@ function main() { install-kbs-client) install_kbs_client ;; install-kubectl) install_kubectl ;; get-cluster-credentials) get_cluster_credentials ;; + deploy-csi-driver) return 0 ;; deploy-kata) deploy_kata ;; deploy-kata-aks) deploy_kata "aks" ;; deploy-kata-kcli) deploy_kata "kcli" ;; @@ -599,6 +600,7 @@ function main() { cleanup-garm) cleanup "garm" ;; cleanup-zvsi) cleanup "zvsi" ;; cleanup-snapshotter) cleanup_snapshotter ;; + delete-csi-driver) return 0 ;; delete-coco-kbs) delete_coco_kbs ;; delete-cluster) cleanup "aks" ;; delete-cluster-kcli) delete_cluster_kcli ;;