Skip to content

Commit

Permalink
fix: solve error check k8s workflow main (#102)
Browse files Browse the repository at this point in the history
* fix: solve error check k8s workflow

* fix: define specific kubeconform version and include action on push

* fix: extract and set kubernetes version from kubectl
  • Loading branch information
marbonilla authored May 24, 2024
1 parent c01f238 commit e6a4e91
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/kubeconform-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Kubeconform Validation

on:
pull_request:
push:
branches: main

jobs:
load-environments:
Expand Down Expand Up @@ -41,7 +43,22 @@ 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: 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 latest
K8S_VERSION=${{ steps.extract_version.outputs.k8s_version }}
kustomize build $TUTOR_ROOT/env | kubeconform -strict -ignore-missing-schemas -kubernetes-version ${K8S_VERSION}

0 comments on commit e6a4e91

Please sign in to comment.