diff --git a/Dockerfile b/Dockerfile index f73f65f..8f1477b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,9 +20,11 @@ RUN curl -LO "https://get.helm.sh/helm-v3.7.0-linux-amd64.tar.gz" && \ RUN apk add --no-cache git -RUN curl -LO "https://github.com/kubernetes-sigs/kustomize/releases/latest/download/kustomize_linux_amd64" && \ - chmod +x kustomize_linux_amd64 && \ - mv kustomize_linux_amd64 /usr/local/bin/kustomize +RUN curl -LO "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v4.4.0/kustomize_v4.4.0_linux_amd64.tar.gz" && \ + tar xf kustomize_v4.4.0_linux_amd64.tar.gz && \ + rm kustomize_v4.4.0_linux_amd64.tar.gz && \ + mv kustomize /usr/local/bin/kustomize + COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh diff --git a/action.yml b/action.yml index c1e78da..26a7aef 100644 --- a/action.yml +++ b/action.yml @@ -10,4 +10,4 @@ inputs: required: true runs: using: "docker" - image: "Dockerfile" + image: "dhrubajyotichakraborty/kubeval-validation:1.0.2" diff --git a/entrypoint.sh b/entrypoint.sh index 8715043..b5d9520 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,8 +8,12 @@ directory=$INPUT_DIRECTORY # Validate Kubernetes manifest files kubeval --strict $directory/*.yaml -# Validate Helm charts -helm lint $directory/charts +# Validate Helm charts if the 'charts' directory exists +if [ -d "$directory/charts" ]; then + helm lint $directory/charts +fi -# Validate Kustomize overlays -kustomize build $directory/kustomize +# Validate Kustomize overlays if the 'kustomize' directory exists +if [ -d "$directory/kustomize" ]; then + kustomize build $directory/kustomize +fi