diff --git a/README.md b/README.md index cf1f4ab..eca42ef 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,11 @@ Environment variable containing the base64-encoded kubeconfig data. Pay attentio ### `KUBE_YAML` or `FILES_PATH` One of them (or both) must be set.

-KUBE_YAML is the path of file to file used to create/update the resource. This env can be an array with more then 1 file. (I.e. kubernetes/deployment.yml,artifacts/configmap.yaml )
-FILES_PATH is the path of the directory where the files are located. All files in this directory will be applied.

+ +KUBE_YAML is the path of file to file used to create/update the resource. This env can be an array with more then 1 file. (I.e. kubernetes/deployment.yml,artifacts/configmap.yaml )

+ +FILES_PATH is the path of the directory where the files are located. All files in this current directory will be applied.

+ The files must be with *.yaml or *.yml extensions.
@@ -144,7 +147,7 @@ jobs: uses: Pablommr/kubernetes-eks@v2.0.1 env: FILES_PATH: kubernetes - KUBE_YAML: kubernetes/envs/configmap.yaml + KUBE_YAML: kubernetes/envs/prod/configmap.yaml SUBPATH: false #Defaul value ENVSUBST: true KUBE_ROLLOUT: true @@ -157,6 +160,10 @@ In this setup, with FILES_PATH: kubernetes, you will apply all files under the k # Change Log +## v2.0.2 + +- Fix files validation in SUBPATH + ## v2.0.1 - Fix to get resource name diff --git a/entrypoint.sh b/entrypoint.sh index 6504b59..b963411 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -71,11 +71,19 @@ check_directories_and_files() { local dirs=("$@") for dir in "${dirs[@]}"; do if [ -d "$dir" ]; then - # Verifica se há pelo menos um arquivo .yaml ou .yml no diretório - if ! find "$dir" -maxdepth 1 -type f \( -name "*.yaml" -o -name "*.yml" \) | grep -q .; then - echo "No files .yaml or .yml found in dir: $dir" - echo "No files .yaml or .yml found in dir: $dir" >> $GITHUB_STEP_SUMMARY - exit 1 + # Verifica se há pelo menos um arquivo .yaml ou .yml no diretório ou subdiretório + if [ "$SUBPATH" == "true" ]; then + if ! find "$dir" -type f \( -name "*.yaml" -o -name "*.yml" \) | grep -q .; then + echo "No files .yaml or .yml found in dir: $dir" + echo "No files .yaml or .yml found in dir: $dir" >> $GITHUB_STEP_SUMMARY + exit 1 + fi + else + if ! find "$dir" -maxdepth 1 -type f \( -name "*.yaml" -o -name "*.yml" \) | grep -q .; then + echo "No files .yaml or .yml found in dir: $dir" + echo "No files .yaml or .yml found in dir: $dir" >> $GITHUB_STEP_SUMMARY + exit 1 + fi fi else echo "Path $dir doen't exist."