From c6055c4a3d450e13d398b8e4ab824eb9c077ae5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Tue, 8 Oct 2024 12:47:24 +0200 Subject: [PATCH] chore: merge e2e tests with cel e2e tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- .github/workflows/cel-test.yml | 66 ------- .github/workflows/test.yml | 333 +++++++++++++++++++++++++++++++++ .hack/restructure.sh | 42 ----- 3 files changed, 333 insertions(+), 108 deletions(-) delete mode 100644 .github/workflows/cel-test.yml delete mode 100644 .hack/restructure.sh diff --git a/.github/workflows/cel-test.yml b/.github/workflows/cel-test.yml deleted file mode 100644 index 578358566..000000000 --- a/.github/workflows/cel-test.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: E2E Tests - CEL - -permissions: {} - -on: - pull_request: - branches: - - main - - release-* - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - chainsaw: - strategy: - fail-fast: false - matrix: - k8s-version: - - name: v1.28 - version: v1.28.13 - - name: v1.29 - version: v1.29.8 - - name: v1.30 - version: v1.30.4 - - name: v1.31 - version: v1.31.0 - tests: - - ^argo-cel$ - - ^aws-cel$ - - ^best-practices-cel$ - - ^consul-cel$ - - ^flux-cel$ - - ^istio-cel$ - - ^kasten-cel$ - - ^kubecost-cel$ - - ^linkerd-cel$ - - ^nginx-ingress-cel$ - - ^openshift-cel$ - - ^other-cel$/^a - - ^other-cel$/^[b-d] - - ^other-cel$/^[e-l] - - ^other-cel$/^[m-q] - - ^other-cel$/^re[c-q] - - ^other-cel$/^res - - ^other-cel$/^[s-z] - - ^pod-security-cel$ - - ^psa-cel$ - - ^psp-migration-cel$ - - ^traefik-cel$ - - ^tekton-cel$ - - ^velero-cel$ - runs-on: ubuntu-latest - name: ${{ matrix.k8s-version.name }} - ${{ matrix.tests }} - steps: - - name: Checkout - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - name: Setup Environment - uses: ./.github/actions/setup-env - with: - k8s-version: ${{ matrix.k8s-version.version }} - - name: Run CEL Tests - uses: ./.github/actions/run-tests - with: - tests: ${{ matrix.tests }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c286d54a0..c4304856c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,6 +34,24 @@ jobs: with: path: argo + argo-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: argo-cel + aws: strategy: fail-fast: false @@ -52,6 +70,24 @@ jobs: with: path: aws + aws-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: aws-cel + best-practices: strategy: fail-fast: false @@ -73,6 +109,27 @@ jobs: shard-index: ${{ matrix.shard-index }} shard-count: 2 + best-practices-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + shard-index: [0,1] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: best-practices-cel + shard-index: ${{ matrix.shard-index }} + shard-count: 2 + castai: strategy: fail-fast: false @@ -145,6 +202,24 @@ jobs: with: path: consul + consul-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: consul-cel + external-secret-operator: strategy: fail-fast: false @@ -181,6 +256,24 @@ jobs: with: path: flux + flux-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: flux-cel + istio: strategy: fail-fast: false @@ -199,6 +292,24 @@ jobs: with: path: istio + istio-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: istio-cel + karpenter: strategy: fail-fast: false @@ -235,6 +346,24 @@ jobs: with: path: kasten + kasten-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: kasten-cel + kubecost: strategy: fail-fast: false @@ -253,6 +382,24 @@ jobs: with: path: kubecost + kubecost-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: kubecost-cel + kubeops: strategy: fail-fast: false @@ -307,6 +454,24 @@ jobs: with: path: linkerd + linkerd-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: linkerd-cel + nginx-ingress: strategy: fail-fast: false @@ -325,6 +490,24 @@ jobs: with: path: nginx-ingress + nginx-ingress-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: nginx-ingress-cel + openshift: strategy: fail-fast: false @@ -343,6 +526,24 @@ jobs: with: path: openshift + openshift-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: openshift-cel + other: strategy: fail-fast: false @@ -364,6 +565,27 @@ jobs: shard-index: ${{ matrix.shard-index }} shard-count: 9 + other-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + shard-index: [0,1,2,3,4,5,6,7,8] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: other-cel + shard-index: ${{ matrix.shard-index }} + shard-count: 9 + pod-security: strategy: fail-fast: false @@ -385,6 +607,27 @@ jobs: shard-index: ${{ matrix.shard-index }} shard-count: 3 + pod-security-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + shard-index: [0,1,2] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: pod-security-cel + shard-index: ${{ matrix.shard-index }} + shard-count: 3 + psa: strategy: fail-fast: false @@ -403,6 +646,24 @@ jobs: with: path: psa + psa-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: psa-cel + psp-migration: strategy: fail-fast: false @@ -421,6 +682,24 @@ jobs: with: path: psp-migration + psp-migration-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: psp-migration-cel + tekton: strategy: fail-fast: false @@ -439,6 +718,24 @@ jobs: with: path: tekton + tekton-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: tekton-cel + traefik: strategy: fail-fast: false @@ -457,6 +754,24 @@ jobs: with: path: traefik + traefik-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: traefik-cel + velero: strategy: fail-fast: false @@ -475,6 +790,24 @@ jobs: with: path: velero + velero-cel: + strategy: + fail-fast: false + matrix: + k8s-version: [v1.28.13,v1.29.8,v1.30.4,v1.31.0] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + k8s-version: ${{ matrix.k8s-version }} + - name: Run Tests + uses: ./.github/actions/run-tests + with: + path: velero-cel + windows-security: strategy: fail-fast: false diff --git a/.hack/restructure.sh b/.hack/restructure.sh deleted file mode 100644 index 93f207c7c..000000000 --- a/.hack/restructure.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -SED=sed - -if [[ "$OSTYPE" == "darwin"* ]]; then - SED=gsed -fi - -rm -rf ".policies/" -rm -rf ".kyverno-tests/" - -# for FILE in $(find . -name "artifacthub-pkg.yml") -# do -# FOLDER=$(dirname "$FILE") -# POLICY=$(basename "$FOLDER") -# POLICY_FILE="$FOLDER/$POLICY.yaml" -# mkdir -p ".policies/${FOLDER/.\//}" -# cp $POLICY_FILE ".policies/${FOLDER/.\//}" -# cp $FILE ".policies/${FOLDER/.\//}" -# done - -for FILE in $(find . -name "kyverno-test.yaml") -do - FOLDER=$(dirname "$FILE") - TARGET_FOLDER="$FOLDER/.kyverno-test" - POLICY=$(basename "$FOLDER") - POLICY_FILE="$POLICY.yaml" - echo "$TARGET_FOLDER" - rm -rf "$TARGET_FOLDER" - mkdir -p $TARGET_FOLDER - mv $FILE $TARGET_FOLDER - for NEEDED in $(cat "$TARGET_FOLDER/kyverno-test.yaml" | grep -oE "(\w|-)+\.yaml") - do - if [[ $NEEDED == $POLICY_FILE ]]; then - $SED -i "s@$POLICY_FILE@../$POLICY_FILE@" "$TARGET_FOLDER/kyverno-test.yaml" - else - mv "$FOLDER/$NEEDED" $TARGET_FOLDER || true - fi - done -done \ No newline at end of file