From c6952943e357f488662124ce54d289c7efd96592 Mon Sep 17 00:00:00 2001 From: marbonilla Date: Wed, 15 May 2024 14:38:33 -0500 Subject: [PATCH 1/3] fix: solve error check k8s workflow --- .github/workflows/kubeconform-validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/kubeconform-validation.yml b/.github/workflows/kubeconform-validation.yml index bcec0fdf..53c88068 100644 --- a/.github/workflows/kubeconform-validation.yml +++ b/.github/workflows/kubeconform-validation.yml @@ -44,4 +44,4 @@ jobs: kubeconform: latest - name: Check k8s manifests run: | - kustomize build $TUTOR_ROOT/env | kubeconform -strict -ignore-missing-schemas -kubernetes-version latest + kustomize build $TUTOR_ROOT/env | kubeconform -strict -ignore-missing-schemas -kubernetes-version master From 8b681f72d5babf9102d5d7c5ae178b3c8b92c9b1 Mon Sep 17 00:00:00 2001 From: marbonilla Date: Wed, 22 May 2024 11:35:04 -0500 Subject: [PATCH 2/3] fix: define specific kubeconform version and include action on push --- .github/workflows/kubeconform-validation.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/kubeconform-validation.yml b/.github/workflows/kubeconform-validation.yml index 53c88068..408e92a6 100644 --- a/.github/workflows/kubeconform-validation.yml +++ b/.github/workflows/kubeconform-validation.yml @@ -2,6 +2,8 @@ name: Kubeconform Validation on: pull_request: + push: + branches: main jobs: load-environments: @@ -41,7 +43,17 @@ jobs: with: kubectl: latest kustomize: latest - kubeconform: latest + kubeconform: v0.6.6 + + - name: Print versions + run: | + echo "Kubectl version installed:" + kubectl version --client + echo "Kustomize version installed:" + kustomize version + echo "Kubeconform version installed:" + kubeconform -v + - name: Check k8s manifests run: | kustomize build $TUTOR_ROOT/env | kubeconform -strict -ignore-missing-schemas -kubernetes-version master From 5abc14b6172c6654849397f62d7aa8a94d413fda Mon Sep 17 00:00:00 2001 From: marbonilla Date: Thu, 23 May 2024 12:57:30 -0500 Subject: [PATCH 3/3] fix: extract and set kubernetes version from kubectl --- .github/workflows/kubeconform-validation.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/kubeconform-validation.yml b/.github/workflows/kubeconform-validation.yml index 408e92a6..fac2b803 100644 --- a/.github/workflows/kubeconform-validation.yml +++ b/.github/workflows/kubeconform-validation.yml @@ -44,7 +44,6 @@ jobs: kubectl: latest kustomize: latest kubeconform: v0.6.6 - - name: Print versions run: | echo "Kubectl version installed:" @@ -53,7 +52,13 @@ jobs: kustomize version echo "Kubeconform version installed:" kubeconform -v - + - name: Extract Kubernetes client version + id: extract_version + run: | + KUBECTL_VERSION=$(kubectl version --client --output=json | jq -r '.clientVersion.gitVersion' | sed 's/^v//') + echo "Extracted KUBECTL_VERSION=${KUBECTL_VERSION}" + echo "k8s_version=${KUBECTL_VERSION}" >> $GITHUB_OUTPUT - name: Check k8s manifests run: | - kustomize build $TUTOR_ROOT/env | kubeconform -strict -ignore-missing-schemas -kubernetes-version master + K8S_VERSION=${{ steps.extract_version.outputs.k8s_version }} + kustomize build $TUTOR_ROOT/env | kubeconform -strict -ignore-missing-schemas -kubernetes-version ${K8S_VERSION}