From 6b9bbb8cbe5bfac59f7c3bf9b7046d7955af82f5 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 1 Jul 2023 13:33:28 -0700 Subject: [PATCH 1/8] Update github action to test each cluster explicitly --- .github/workflows/flux-local-test.yaml | 9 +++++++++ tests/tool/testdata/test_hr6.yaml | 6 ++++++ 2 files changed, 15 insertions(+) create mode 100644 tests/tool/testdata/test_hr6.yaml diff --git a/.github/workflows/flux-local-test.yaml b/.github/workflows/flux-local-test.yaml index 848039ea..00313e31 100644 --- a/.github/workflows/flux-local-test.yaml +++ b/.github/workflows/flux-local-test.yaml @@ -12,6 +12,14 @@ on: jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + cluster_path: + - tests/testdata/cluster + - tests/testdata/cluster2 + - tests/testdata/cluster3 + - tests/testdata/cluster5 + - tests/testdata/cluster6 steps: - uses: actions/checkout@v3 - uses: ./action/test @@ -19,3 +27,4 @@ jobs: enable-helm: true enable-kyverno: false sources: cluster=tests/testdata/cluster3 + path: ${{ matrix.cluster_path }} diff --git a/tests/tool/testdata/test_hr6.yaml b/tests/tool/testdata/test_hr6.yaml new file mode 100644 index 00000000..ca38423f --- /dev/null +++ b/tests/tool/testdata/test_hr6.yaml @@ -0,0 +1,6 @@ +args: +- test +- --enable-helm +- -a +- batch/v1/CronJob +- tests/testdata/cluster6 From 87b6eb9a89e8645fd58040aa6e4bb58c5c0e08d3 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 1 Jul 2023 13:35:50 -0700 Subject: [PATCH 2/8] Add api-versions to ensure cluster6 passes --- .github/workflows/flux-local-test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/flux-local-test.yaml b/.github/workflows/flux-local-test.yaml index 00313e31..2caaa41c 100644 --- a/.github/workflows/flux-local-test.yaml +++ b/.github/workflows/flux-local-test.yaml @@ -28,3 +28,4 @@ jobs: enable-kyverno: false sources: cluster=tests/testdata/cluster3 path: ${{ matrix.cluster_path }} + api-versions: batch/v1/CronJob From c5f5bd8cb196934e74f825acda73069fa51202ff Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 1 Jul 2023 13:37:05 -0700 Subject: [PATCH 3/8] Fix bug in flux test flags Ensure api-versions and kubernetes-version are in kwargs --- flux_local/tool/test.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/flux_local/tool/test.py b/flux_local/tool/test.py index 4385baee..bb719c65 100644 --- a/flux_local/tool/test.py +++ b/flux_local/tool/test.py @@ -389,8 +389,6 @@ async def run( # type: ignore[no-untyped-def] enable_kyverno: bool, test_path: str | None, verbosity: int, - kube_version: str | None, - api_versions: str | None, **kwargs, # pylint: disable=unused-argument ) -> None: """Async Action implementation.""" From 21e846f348aae4a94b43b21bb3162fad71eff26f Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 1 Jul 2023 13:38:10 -0700 Subject: [PATCH 4/8] Remove test_hr6 and rely on github action --- tests/tool/testdata/test_hr6.yaml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 tests/tool/testdata/test_hr6.yaml diff --git a/tests/tool/testdata/test_hr6.yaml b/tests/tool/testdata/test_hr6.yaml deleted file mode 100644 index ca38423f..00000000 --- a/tests/tool/testdata/test_hr6.yaml +++ /dev/null @@ -1,6 +0,0 @@ -args: -- test -- --enable-helm -- -a -- batch/v1/CronJob -- tests/testdata/cluster6 From 0de4c8d548aaa1a57092df487240c7a2dcb59154 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 1 Jul 2023 13:39:09 -0700 Subject: [PATCH 5/8] Update cluster path strategies to include all clusters --- .github/workflows/flux-local-diff.yaml | 5 +++++ .github/workflows/flux-local-test.yaml | 1 + 2 files changed, 6 insertions(+) diff --git a/.github/workflows/flux-local-diff.yaml b/.github/workflows/flux-local-diff.yaml index 5e87bcea..71144d64 100644 --- a/.github/workflows/flux-local-diff.yaml +++ b/.github/workflows/flux-local-diff.yaml @@ -17,6 +17,11 @@ jobs: matrix: cluster_path: - tests/testdata/cluster + - tests/testdata/cluster2 + - tests/testdata/cluster3 + - tests/testdata/cluster4 + - tests/testdata/cluster5 + - tests/testdata/cluster6 resource: - helmrelease - kustomization diff --git a/.github/workflows/flux-local-test.yaml b/.github/workflows/flux-local-test.yaml index 2caaa41c..9c4c79e2 100644 --- a/.github/workflows/flux-local-test.yaml +++ b/.github/workflows/flux-local-test.yaml @@ -19,6 +19,7 @@ jobs: - tests/testdata/cluster2 - tests/testdata/cluster3 - tests/testdata/cluster5 + - tests/testdata/cluster4 - tests/testdata/cluster6 steps: - uses: actions/checkout@v3 From 8f9d61449ad47ea411d1c50c5d1a4b93d4748c03 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 1 Jul 2023 13:41:06 -0700 Subject: [PATCH 6/8] Add api-versions to workflow diffs --- .github/workflows/flux-local-diff.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/flux-local-diff.yaml b/.github/workflows/flux-local-diff.yaml index 71144d64..fddae090 100644 --- a/.github/workflows/flux-local-diff.yaml +++ b/.github/workflows/flux-local-diff.yaml @@ -35,6 +35,7 @@ jobs: resource: ${{ matrix.resource }} debug: true sources: cluster=tests/testdata/cluster3 + api-versions: batch/v1/CronJob - name: PR Comments uses: mshick/add-pr-comment@v2 if: ${{ steps.diff.outputs.diff != '' }} From f7559fd5d4cfb4c3bd8897416b51728edf909616 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 1 Jul 2023 13:47:04 -0700 Subject: [PATCH 7/8] Invert api-versions diff args --- action/diff/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action/diff/action.yml b/action/diff/action.yml index 74512825..bf9364f3 100644 --- a/action/diff/action.yml +++ b/action/diff/action.yml @@ -85,7 +85,7 @@ runs: --${{ inputs.skip-secrets != 'true' && 'no-' || '' }}skip-secrets \ --limit-bytes ${{ inputs.limit-bytes }} \ --all-namespaces \ - ${{ inputs.resource == 'helmrelease' && join('--api-versions=', inputs.api-versions) || '' }} \ + ${{ inputs.resource != 'helmrelease' && '' || join('--api-versions=', inputs.api-versions) }} \ --kustomize-build-flags="${{ inputs.kustomize-build-flags }}" \ --sources "${{ inputs.sources }}" \ >> $GITHUB_OUTPUT From d133bc71b0f75c5bb468321f32d15b801c130108 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 1 Jul 2023 15:17:05 -0700 Subject: [PATCH 8/8] Fix api versions conditional logic --- action/diff/action.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/action/diff/action.yml b/action/diff/action.yml index bf9364f3..61486b60 100644 --- a/action/diff/action.yml +++ b/action/diff/action.yml @@ -73,6 +73,11 @@ runs: run: | delimiter="$(openssl rand -hex 8)" echo "diff<<${delimiter}" >> $GITHUB_OUTPUT + if [[ "${{ inputs.resource }}" == "helmrelease" ]]; then + extra_flags="--api-versions=${{ inputs.api-versions}}" + else + extra_flags="" + fi flux-local \ --log-level ${{ inputs.debug != 'true' && 'INFO' || 'DEBUG' }} \ diff \ @@ -85,9 +90,9 @@ runs: --${{ inputs.skip-secrets != 'true' && 'no-' || '' }}skip-secrets \ --limit-bytes ${{ inputs.limit-bytes }} \ --all-namespaces \ - ${{ inputs.resource != 'helmrelease' && '' || join('--api-versions=', inputs.api-versions) }} \ --kustomize-build-flags="${{ inputs.kustomize-build-flags }}" \ --sources "${{ inputs.sources }}" \ + ${extra_flags} \ >> $GITHUB_OUTPUT echo "${delimiter}" >> $GITHUB_OUTPUT shell: bash