From 0d70dc31c1940095e6f88a6bc16bf9b9402946cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bombo?= Date: Fri, 17 Jan 2025 10:44:43 -0600 Subject: [PATCH] ci: Unify on $GH_PR_NUMBER environment variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While working on #10559, I realized that some parts of the codebase use $GH_PR_NUMBER, while other parts use $PR_NUMBER. Notably, in that PR, since I used $GH_PR_NUMBER for CoCo non-TEE tests without realizing that TEE tests use $PR_NUMBER, the tests on that PR fail on TEEs: https://github.com/kata-containers/kata-containers/actions/runs/12818127344/job/35744760351?pr=10559#step:10:45 ... 44 error: error parsing STDIN: error converting YAML to JSON: yaml: line 90: mapping values are not allowed in this context ... 135 image: ghcr.io/kata-containers/csi-kata-directvolume: ... So let's unify on $GH_PR_NUMBER so that this issue doesn't repro in the future: I replaced all instances of PR_NUMBER with GH_PR_NUMBER. Note that since some test scripts also refer to that variable, the CI for this PR will fail (would have also happened with the converse substitution), hence I'm not adding the ok-to-test label and we should force-merge this after review. Signed-off-by: Aurélien Bombo --- .github/workflows/gatekeeper.yaml | 2 +- .github/workflows/run-k8s-tests-on-amd64.yaml | 2 +- .github/workflows/run-k8s-tests-on-ppc64le.yaml | 2 +- .github/workflows/run-k8s-tests-on-zvsi.yaml | 1 - .github/workflows/run-kata-coco-tests.yaml | 6 +++--- .github/workflows/run-kata-deploy-tests-on-garm.yaml | 2 +- tests/integration/kubernetes/confidential_common.sh | 4 ++-- tools/testing/gatekeeper/jobs.py | 6 +++--- 8 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/gatekeeper.yaml b/.github/workflows/gatekeeper.yaml index 788395f694..d184ecee9b 100644 --- a/.github/workflows/gatekeeper.yaml +++ b/.github/workflows/gatekeeper.yaml @@ -29,7 +29,7 @@ jobs: TARGET_BRANCH: ${{ github.event.pull_request.base.ref }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMIT_HASH: ${{ github.event.pull_request.head.sha }} - PR_NUMBER: ${{ github.event.pull_request.number }} + GH_PR_NUMBER: ${{ github.event.pull_request.number }} run: | #!/usr/bin/env bash -x mapfile -t lines < <(python3 tools/testing/gatekeeper/skips.py -t) diff --git a/.github/workflows/run-k8s-tests-on-amd64.yaml b/.github/workflows/run-k8s-tests-on-amd64.yaml index 8a12687d32..1f8463af81 100644 --- a/.github/workflows/run-k8s-tests-on-amd64.yaml +++ b/.github/workflows/run-k8s-tests-on-amd64.yaml @@ -49,7 +49,7 @@ jobs: DOCKER_REGISTRY: ${{ inputs.registry }} DOCKER_REPO: ${{ inputs.repo }} DOCKER_TAG: ${{ inputs.tag }} - PR_NUMBER: ${{ inputs.pr-number }} + GH_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"' }} diff --git a/.github/workflows/run-k8s-tests-on-ppc64le.yaml b/.github/workflows/run-k8s-tests-on-ppc64le.yaml index d6a4a9d28f..e7bcc3bde4 100644 --- a/.github/workflows/run-k8s-tests-on-ppc64le.yaml +++ b/.github/workflows/run-k8s-tests-on-ppc64le.yaml @@ -36,7 +36,7 @@ jobs: DOCKER_REGISTRY: ${{ inputs.registry }} DOCKER_REPO: ${{ inputs.repo }} DOCKER_TAG: ${{ inputs.tag }} - PR_NUMBER: ${{ inputs.pr-number }} + GH_PR_NUMBER: ${{ inputs.pr-number }} GOPATH: ${{ github.workspace }} KATA_HYPERVISOR: ${{ matrix.vmm }} KUBERNETES: ${{ matrix.k8s }} diff --git a/.github/workflows/run-k8s-tests-on-zvsi.yaml b/.github/workflows/run-k8s-tests-on-zvsi.yaml index 8b18ea8cfe..1866c3b294 100644 --- a/.github/workflows/run-k8s-tests-on-zvsi.yaml +++ b/.github/workflows/run-k8s-tests-on-zvsi.yaml @@ -64,7 +64,6 @@ jobs: DOCKER_REGISTRY: ${{ inputs.registry }} DOCKER_REPO: ${{ inputs.repo }} DOCKER_TAG: ${{ inputs.tag }} - PR_NUMBER: ${{ inputs.pr-number }} GH_PR_NUMBER: ${{ inputs.pr-number }} KATA_HOST_OS: "ubuntu" KATA_HYPERVISOR: ${{ matrix.vmm }} diff --git a/.github/workflows/run-kata-coco-tests.yaml b/.github/workflows/run-kata-coco-tests.yaml index 34956a54d6..8e3d784d14 100644 --- a/.github/workflows/run-kata-coco-tests.yaml +++ b/.github/workflows/run-kata-coco-tests.yaml @@ -49,7 +49,7 @@ jobs: DOCKER_REGISTRY: ${{ inputs.registry }} DOCKER_REPO: ${{ inputs.repo }} DOCKER_TAG: ${{ inputs.tag }} - PR_NUMBER: ${{ inputs.pr-number }} + GH_PR_NUMBER: ${{ inputs.pr-number }} KATA_HYPERVISOR: ${{ matrix.vmm }} KUBERNETES: "vanilla" USING_NFD: "true" @@ -136,7 +136,7 @@ jobs: DOCKER_REGISTRY: ${{ inputs.registry }} DOCKER_REPO: ${{ inputs.repo }} DOCKER_TAG: ${{ inputs.tag }} - PR_NUMBER: ${{ inputs.pr-number }} + GH_PR_NUMBER: ${{ inputs.pr-number }} KATA_HYPERVISOR: ${{ matrix.vmm }} KUBECONFIG: /home/kata/.kube/config KUBERNETES: "vanilla" @@ -202,7 +202,7 @@ jobs: DOCKER_REGISTRY: ${{ inputs.registry }} DOCKER_REPO: ${{ inputs.repo }} DOCKER_TAG: ${{ inputs.tag }} - PR_NUMBER: ${{ inputs.pr-number }} + GH_PR_NUMBER: ${{ inputs.pr-number }} KATA_HYPERVISOR: ${{ matrix.vmm }} KUBECONFIG: /home/kata/.kube/config KUBERNETES: "vanilla" diff --git a/.github/workflows/run-kata-deploy-tests-on-garm.yaml b/.github/workflows/run-kata-deploy-tests-on-garm.yaml index c315bfa3a1..4bfe660c4f 100644 --- a/.github/workflows/run-kata-deploy-tests-on-garm.yaml +++ b/.github/workflows/run-kata-deploy-tests-on-garm.yaml @@ -43,7 +43,7 @@ jobs: DOCKER_REGISTRY: ${{ inputs.registry }} DOCKER_REPO: ${{ inputs.repo }} DOCKER_TAG: ${{ inputs.tag }} - PR_NUMBER: ${{ inputs.pr-number }} + GH_PR_NUMBER: ${{ inputs.pr-number }} KATA_HYPERVISOR: ${{ matrix.vmm }} KUBERNETES: ${{ matrix.k8s }} USING_NFD: "false" diff --git a/tests/integration/kubernetes/confidential_common.sh b/tests/integration/kubernetes/confidential_common.sh index 5b3e59ba71..75fb14e854 100644 --- a/tests/integration/kubernetes/confidential_common.sh +++ b/tests/integration/kubernetes/confidential_common.sh @@ -18,9 +18,9 @@ function setup_unencrypted_confidential_pod() { export SSH_KEY_FILE="${pod_config_dir}/confidential/unencrypted/ssh/unencrypted" - if [ -n "${PR_NUMBER}" ]; then + if [ -n "${GH_PR_NUMBER}" ]; then # Use correct address in pod yaml - sed -i "s/-nightly/-${PR_NUMBER}/" "${pod_config_dir}/pod-confidential-unencrypted.yaml" + sed -i "s/-nightly/-${GH_PR_NUMBER}/" "${pod_config_dir}/pod-confidential-unencrypted.yaml" fi # Set permissions on private key file diff --git a/tools/testing/gatekeeper/jobs.py b/tools/testing/gatekeeper/jobs.py index dadd4f3c00..fc6fbb48e8 100644 --- a/tools/testing/gatekeeper/jobs.py +++ b/tools/testing/gatekeeper/jobs.py @@ -17,7 +17,7 @@ GITHUB_TOKEN="..." REQUIRED_JOBS="skipper / skipper" REQUIRED_REGEXPS=".*" REQUIRED_LABELS="ok-to-test;bar" COMMIT_HASH=b8382cea886ad9a8f77d237bcfc0eba0c98775dd GITHUB_REPOSITORY=kata-containers/kata-containers -PR_NUMBER=123 python3 jobs.py +GH_PR_NUMBER=123 python3 jobs.py """ import os @@ -43,7 +43,7 @@ class Checker: """Object to keep watching required GH action workflows""" def __init__(self): self.latest_commit_sha = os.getenv("COMMIT_HASH") - self.pr_number = os.getenv("PR_NUMBER") + self.pr_number = os.getenv("GH_PR_NUMBER") required_labels = os.getenv("REQUIRED_LABELS") if required_labels: self.required_labels = set(required_labels.split(";")) @@ -213,7 +213,7 @@ class Checker: return True if not self.pr_number: - print("The PR_NUMBER not specified, skipping the " + print("The GH_PR_NUMBER not specified, skipping the " f"required-labels-check ({self.required_labels})") return True