From 18f42310fc86d8cf39607f29017be97cdded1fb1 Mon Sep 17 00:00:00 2001 From: Clayton Kehoe Date: Mon, 22 Jul 2024 12:27:06 -0500 Subject: [PATCH 1/5] updating to support v1.6.0 of the validator --- .github/workflows/test.yml | 2 +- Dockerfile | 10 +++++----- README.md | 35 ++++++++++++++++++++++++++--------- action.yaml | 5 +++++ entrypoint.sh | 2 +- 5 files changed, 38 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d4625b..307bc49 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Test Defaults - uses: kehoecj/validate-configs-action@v1 + uses: kehoecj/validate-configs-action@v2 with: exclude-dirs: failing search-paths: test/good.ini test/good.json test/good.toml test/good.xml test/good.yaml diff --git a/Dockerfile b/Dockerfile index 2278d93..2369af7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ -FROM alpine:3.18 +FROM alpine:3.20 COPY entrypoint.sh /entrypoint.sh RUN apk --no-cache add curl tar && \ - curl https://github.com/Boeing/config-file-validator/releases/download/v1.5.0/validator-v1.5.0-linux-386.tar.gz \ - -o /tmp/validator-v1.5.0-linux-386.tar.gz -s -L && \ - tar -xvf /tmp/validator-v1.5.0-linux-386.tar.gz -C /tmp && \ + curl https://github.com/Boeing/config-file-validator/releases/download/v1.6.0/validator-v1.6.0-linux-386.tar.gz \ + -o /tmp/validator-v1.6.0-linux-386.tar.gz -s -L && \ + tar -xvf /tmp/validator-v1.6.0-linux-386.tar.gz -C /tmp && \ mv /tmp/validator /usr/local/bin && \ rm -rf /tmp/* && \ chmod 0755 /usr/local/bin/validator && \ chmod 0755 /entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/entrypoint.sh"] diff --git a/README.md b/README.md index d64330a..003e5df 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,9 @@ * Apple PList XML * CSV +* ENV * HCL +* HOCON * INI * JSON * Properties @@ -13,6 +15,7 @@ * YAML + Each file will get validated for the correct syntax and the results collected into a report showing the path of the file and if it is invalid or valid. If the file is invalid an error will be displayed along with the line number and column where the error ocurred. By default the `$GITHUB_WORKDIR` is scanned. ![Standard Run](./img/standard_run.png) @@ -21,11 +24,12 @@ Each file will get validated for the correct syntax and the results collected in | Input | Required | Default Value | Description | | ------------------ | -------- | ------------- | ----------- | -| search-paths | false | `"."` | The path that will be recursively searched for configuration files | +| search-paths | false | `"."` | The path that will be recursively searched for configuration files | | exclude-dirs | false | `""` | A comma-separated list of subdirectories to exclude from validation | | exclude-file-types | false | `""` | A comma-separated list of file extensions to exclude. Possible values are `xml`, `ini`, `yaml`, `yml`, `toml`, and `json` | | depth | false | `""` | An integer value limiting the depth of recursion for the search paths. For example, setting depth to 0 would disable recursion | -| reporter | false | `"standard"` | Format of the report printed to stdout. Options are `standard` and `json` | +| reporter | false | `"standard"` | Format of the report printed to stdout. Options are `standard` and `json` | +| group-by | false | `""` | Group output by filetype, directory, pass-fail | ## Outputs @@ -41,7 +45,7 @@ jobs: validate-config-files: runs-on: ubuntu-latest steps: - - uses: kehoe/validate-configs-action@v1 + - uses: kehoe/validate-configs-action@v3 ``` ### Custom search path @@ -51,7 +55,7 @@ jobs: validate-config-files: runs-on: ubuntu-latest steps: - - uses: kehoe/validate-configs-action@v1 + - uses: kehoe/validate-configs-action@v3 with: search-path: ./project/configs ``` @@ -63,7 +67,7 @@ jobs: validate-config-files: runs-on: ubuntu-latest steps: - - uses: kehoe/validate-configs-action@v1 + - uses: kehoe/validate-configs-action@v3 with: search-path: ./project/configs ./project/devops ``` @@ -75,7 +79,7 @@ jobs: validate-config-files: runs-on: ubuntu-latest steps: - - uses: kehoe/validate-configs-action@v1 + - uses: kehoe/validate-configs-action@v3 with: exclude-dirs: "tests,vendor" ``` @@ -87,7 +91,7 @@ jobs: validate-config-files: runs-on: ubuntu-latest steps: - - uses: kehoe/validate-configs-action@v1 + - uses: kehoe/validate-configs-action@v3 with: exclude-file-types: "json,xml" ``` @@ -99,7 +103,7 @@ jobs: validate-config-files: runs-on: ubuntu-latest steps: - - uses: kehoe/validate-configs-action@v1 + - uses: kehoe/validate-configs-action@v3 with: depth: 0 ``` @@ -111,7 +115,20 @@ jobs: validate-config-files: runs-on: ubuntu-latest steps: - - uses: kehoe/validate-configs-action@v1 + - uses: kehoe/validate-configs-action@v3 + with: + reporter: "json" +``` + +### Group By Pass/Fail + +```yml +jobs: + validate-config-files: + runs-on: ubuntu-latest + steps: + - uses: kehoe/validate-configs-action@v3 with: reporter: "json" ``` + diff --git a/action.yaml b/action.yaml index fe99d77..c60a420 100644 --- a/action.yaml +++ b/action.yaml @@ -24,6 +24,10 @@ inputs: description: 'Format of the printed report. Options are standard and json (default "standard")' required: false default: "standard" + group-by: + description: A comman separated list of how to group the output. Options are file type, directory, or pass-fail. + required: false + default: "" runs: using: 'docker' @@ -34,6 +38,7 @@ runs: - ${{ inputs.exclude-file-types }} - ${{ inputs.depth }} - ${{ inputs.reporter }} + - ${{ inputs.group-by }} branding: color: 'blue' diff --git a/entrypoint.sh b/entrypoint.sh index 6a045fd..95d23fc 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,4 +6,4 @@ set -e SEARCH_PATHS=$1 -validator --exclude-dirs=$2 --exclude-file-types=$3 --depth=$4 --reporter=$5 ${SEARCH_PATHS} \ No newline at end of file +validator --exclude-dirs=$2 --exclude-file-types=$3 --depth=$4 --reporter=$5 --group-by=$6 ${SEARCH_PATHS} \ No newline at end of file From 17fdc39b9780d4362764691c9d27000d1fc52ca4 Mon Sep 17 00:00:00 2001 From: Clayton Kehoe Date: Mon, 22 Jul 2024 14:03:01 -0500 Subject: [PATCH 2/5] update entrypoint --- .github/workflows/test.yml | 2 +- entrypoint.sh | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 307bc49..09becdb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Test Defaults - uses: kehoecj/validate-configs-action@v2 + uses: kehoecj/validate-configs-action with: exclude-dirs: failing search-paths: test/good.ini test/good.json test/good.toml test/good.xml test/good.yaml diff --git a/entrypoint.sh b/entrypoint.sh index 95d23fc..35c2b6d 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,4 +6,32 @@ set -e SEARCH_PATHS=$1 -validator --exclude-dirs=$2 --exclude-file-types=$3 --depth=$4 --reporter=$5 --group-by=$6 ${SEARCH_PATHS} \ No newline at end of file +EXCLUDE_DIRS=$2 +EXCLUDE_FILE_TYPES=$3 +DEPTH=$4 +REPORTER=$5 +GROUP_BY=$6 + +CMD=validator + +if [ -n "$EXCLUDE_DIRS" ]; then + CMD="$CMD --exclude-dirs=$EXCLUDE_DIRS" +fi + +if [ -n "$EXCLUDE_FILE_TYPES" ]; then + CMD="$CMD --exclude-file-types=$EXCLUDE_FILE_TYPES" +fi + +if [ -n "$DEPTH" ]; then + CMD="$CMD --depth=$DEPTH" +fi + +if [ -n "$REPORTER" ]; then + CMD="$CMD --reporter=$REPORTER" +fi + +if [ -n "$GROUP_BY" ]; then + CMD="$CMD --group-by=$GROUP_BY" +fi + +( "${CMD}" "${SEARCH_PATHS}" ) From 96bcbbabe6ffd419056b0d20fc5e58e68627e728 Mon Sep 17 00:00:00 2001 From: Clayton Kehoe <118750525+kehoecj@users.noreply.github.com> Date: Mon, 22 Jul 2024 14:04:28 -0500 Subject: [PATCH 3/5] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 09becdb..64dc27e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Test Defaults - uses: kehoecj/validate-configs-action + uses: kehoecj/validate-configs-action@main with: exclude-dirs: failing search-paths: test/good.ini test/good.json test/good.toml test/good.xml test/good.yaml From 29e001299ebcca2ba60351b8217c93c226472231 Mon Sep 17 00:00:00 2001 From: Clayton Kehoe <118750525+kehoecj@users.noreply.github.com> Date: Mon, 22 Jul 2024 14:07:49 -0500 Subject: [PATCH 4/5] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 64dc27e..b23ccfb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Test Defaults - uses: kehoecj/validate-configs-action@main + uses: kehoecj/validate-configs-action@support_v1_6_0 with: exclude-dirs: failing search-paths: test/good.ini test/good.json test/good.toml test/good.xml test/good.yaml From 85026873a05b48a0fe7695454814e331ac6ce9f1 Mon Sep 17 00:00:00 2001 From: Clayton Kehoe <118750525+kehoecj@users.noreply.github.com> Date: Mon, 22 Jul 2024 14:10:50 -0500 Subject: [PATCH 5/5] Update entrypoint.sh --- entrypoint.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 35c2b6d..e81678b 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -34,4 +34,7 @@ if [ -n "$GROUP_BY" ]; then CMD="$CMD --group-by=$GROUP_BY" fi -( "${CMD}" "${SEARCH_PATHS}" ) +# add search paths +CMD="$CMD $SEARCH_PATHS" + +( ${CMD} )