From e6445c358f279a696d325d4c0c91a6a6d14e2c4c Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Wed, 7 Dec 2022 23:24:36 -0500 Subject: [PATCH] replace kubeval with kubeconform Signed-off-by: Rui Chen Signed-off-by: Brett Logan --- .automation/test/kubernetes_kubeval/README.md | 4 ++-- Dockerfile | 4 +--- README.md | 4 ++-- lib/functions/buildFileList.sh | 2 +- lib/linter.sh | 12 ++++++------ test/inspec/super-linter/controls/super_linter.rb | 2 +- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.automation/test/kubernetes_kubeval/README.md b/.automation/test/kubernetes_kubeval/README.md index 8ed5df62..41ae4fcc 100644 --- a/.automation/test/kubernetes_kubeval/README.md +++ b/.automation/test/kubernetes_kubeval/README.md @@ -1,6 +1,6 @@ -# Kubeval Test Cases +# Kubeconform Test Cases -This folder holds the test cases for **Kubeval**. +This folder holds the test cases for **Kubeconform**. ## Additional Docs diff --git a/Dockerfile b/Dockerfile index 80b9a9dd..318d2ca9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,8 +45,6 @@ ARG KTLINT_VERSION='0.47.1' ARG PSSA_VERSION='1.21.0' ARG PWSH_DIRECTORY='/usr/lib/microsoft/powershell' ARG PWSH_VERSION='v7.3.1' -# Kubeval Version -ARG KUBEVAL_VERSION='v0.16.1' #################### # Run APK installs # @@ -195,7 +193,7 @@ RUN /install-lintr.sh && rm -rf /install-lintr.sh COPY dependencies/sgerrand.rsa.pub /etc/apk/keys/sgerrand.rsa.pub ################### -# Install Kubeval # +# Install Kubeconform # ################### COPY scripts/install-kubeval.sh / RUN --mount=type=secret,id=GITHUB_TOKEN /install-kubeval.sh && rm -rf /install-kubeval.sh diff --git a/README.md b/README.md index 5145b3c4..25448d62 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their codebase w | **JavaScript** | [ESLint](https://eslint.org/) / [standard js](https://standardjs.com/) | | **JSON** | [eslint-plugin-json](https://www.npmjs.com/package/eslint-plugin-json) | | **JSONC** | [eslint-plugin-jsonc](https://www.npmjs.com/package/eslint-plugin-jsonc) | -| **Kubernetes** | [kubeval](https://github.com/instrumenta/kubeval) | +| **Kubernetes** | [kubeconform]https://github.com/yannh/kubeconform) | | **Kotlin** | [ktlint](https://github.com/pinterest/ktlint) | | **LaTeX** | [ChkTex](https://www.nongnu.org/chktex/) | | **Lua** | [luacheck](https://github.com/luarocks/luacheck) | @@ -273,7 +273,7 @@ But if you wish to select or exclude specific linters, we give you full control | **ACTIONS_RUNNER_DEBUG** | `false` | Flag to enable additional information about the linter, versions, and additional output. | | **ANSIBLE_CONFIG_FILE** | `.ansible-lint.yml` | Filename for [Ansible-lint configuration](https://ansible-lint.readthedocs.io/en/latest/configuring.html#configuration-file) (ex: `.ansible-lint`, `.ansible-lint.yml`) | | **ANSIBLE_DIRECTORY** | `/ansible` | Flag to set the root directory for Ansible file location(s), relative to `DEFAULT_WORKSPACE`. Set to `.` to use the top-level of the `DEFAULT_WORKSPACE`. | -| **CREATE_LOG_FILE** | `false` | If set to `true`, it creates the log file. You can set the log filename using the `LOG_FILE` environment variable. | +| **CREATE_LOG_FILE** | `false` | If set to `true`, it creates the log file. You can set the log filename using the `LOG_FILE` environment variable. | | **CSS_FILE_NAME** | `.stylelintrc.json` | Filename for [Stylelint configuration](https://github.com/stylelint/stylelint) (ex: `.stylelintrc.yml`, `.stylelintrc.yaml`) | | **DEFAULT_BRANCH** | `master` | The name of the repository default branch. | | **DEFAULT_WORKSPACE** | `/tmp/lint` | The location containing files to lint if you are running locally. | diff --git a/lib/functions/buildFileList.sh b/lib/functions/buildFileList.sh index 731ecb27..9e2568a1 100755 --- a/lib/functions/buildFileList.sh +++ b/lib/functions/buildFileList.sh @@ -821,7 +821,7 @@ function BuildFileList() { ################################ # Append the file to the array # ################################ - FILE_ARRAY_KUBERNETES_KUBEVAL+=("${FILE}") + FILE_ARRAY_KUBERNETES_KUBECONFORM+=("${FILE}") fi ######################################################################## # We have something that we need to try to check file type another way # diff --git a/lib/linter.sh b/lib/linter.sh index 683dfcb9..7be066d7 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -130,7 +130,7 @@ JSCPD_FILE_NAME="${JSCPD_CONFIG_FILE:-.jscpd.json}" # shellcheck disable=SC2034 # Variable is referenced indirectly JSX_FILE_NAME="${JAVASCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}" # shellcheck disable=SC2034 # Variable is referenced indirectly -KUBERNETES_KUBEVAL_OPTIONS="${KUBERNETES_KUBEVAL_OPTIONS:-null}" +KUBERNETES_kubeconform_OPTIONS="${KUBERNETES_KUBECONFORM_OPTIONS:-null}" # shellcheck disable=SC2034 # Variable is referenced indirectly LATEX_FILE_NAME=".chktexrc" # shellcheck disable=SC2034 # Variable is referenced indirectly @@ -255,7 +255,7 @@ LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'BASH_EXEC' 'CLANG_FORMAT' 'DOCKERFILE_HADOLINT' 'EDITORCONFIG' 'ENV' 'GITHUB_ACTIONS' 'GITLEAKS' 'GHERKIN' 'GO' 'GOOGLE_JAVA_FORMAT' 'GROOVY' 'HTML' 'JAVA' 'JAVASCRIPT_ES' "${JAVASCRIPT_STYLE_NAME}" 'JSCPD' 'JSON' 'JSONC' 'JSX' - 'KUBERNETES_KUBEVAL' 'KOTLIN' 'KOTLIN_ANDROID' 'LATEX' 'LUA' 'MARKDOWN' + 'KUBERNETES_KUBECONFORM' 'KOTLIN' 'KOTLIN_ANDROID' 'LATEX' 'LUA' 'MARKDOWN' 'NATURAL_LANGUAGE' 'OPENAPI' 'PERL' 'PHP_BUILTIN' 'PHP_PHPCS' 'PHP_PHPSTAN' 'PHP_PSALM' 'POWERSHELL' 'PROTOBUF' 'PYTHON_BLACK' 'PYTHON_PYLINT' 'PYTHON_FLAKE8' 'PYTHON_ISORT' 'PYTHON_MYPY' 'R' 'RAKU' 'RUBY' 'RUST_2015' @@ -299,7 +299,7 @@ LINTER_NAMES_ARRAY['JSONC']="eslint" LINTER_NAMES_ARRAY['JSX']="eslint" LINTER_NAMES_ARRAY['KOTLIN']="ktlint" LINTER_NAMES_ARRAY['KOTLIN_ANDROID']="ktlint" -LINTER_NAMES_ARRAY['KUBERNETES_KUBEVAL']="kubeval" +LINTER_NAMES_ARRAY['KUBERNETES_KUBECONFORM']="kubeconform" LINTER_NAMES_ARRAY['LATEX']="chktex" LINTER_NAMES_ARRAY['LUA']="lua" LINTER_NAMES_ARRAY['MARKDOWN']="markdownlint" @@ -924,10 +924,10 @@ LINTER_COMMANDS_ARRAY['JSONC']="eslint --no-eslintrc -c ${JAVASCRIPT_ES_LINTER_R LINTER_COMMANDS_ARRAY['JSX']="eslint --no-eslintrc -c ${JSX_LINTER_RULES}" LINTER_COMMANDS_ARRAY['KOTLIN']="ktlint" LINTER_COMMANDS_ARRAY['KOTLIN_ANDROID']="ktlint --android" -if [ "${KUBERNETES_KUBEVAL_OPTIONS}" == "null" ] || [ -z "${KUBERNETES_KUBEVAL_OPTIONS}" ]; then - LINTER_COMMANDS_ARRAY['KUBERNETES_KUBEVAL']="kubeval --strict" +if [ "${KUBERNETES_KUBECONFORM_OPTIONS}" == "null" ] || [ -z "${KUBERNETES_KUBECONFORM_OPTIONS}" ]; then + LINTER_COMMANDS_ARRAY['KUBERNETES_KUBECONFORM']="kubeconform --strict" else - LINTER_COMMANDS_ARRAY['KUBERNETES_KUBEVAL']="kubeval --strict ${KUBERNETES_KUBEVAL_OPTIONS}" + LINTER_COMMANDS_ARRAY['KUBERNETES_KUBECONFORM']="kubeconform --strict ${KUBERNETES_KUBECONFORM_OPTIONS}" fi LINTER_COMMANDS_ARRAY['LATEX']="chktex -q -l ${LATEX_LINTER_RULES}" LINTER_COMMANDS_ARRAY['LUA']="luacheck --config ${LUA_LINTER_RULES}" diff --git a/test/inspec/super-linter/controls/super_linter.rb b/test/inspec/super-linter/controls/super_linter.rb index 698ef311..53053b67 100644 --- a/test/inspec/super-linter/controls/super_linter.rb +++ b/test/inspec/super-linter/controls/super_linter.rb @@ -119,7 +119,7 @@ control "super-linter-installed-commands" do { linter_name: "isort"}, { linter_name: "jscpd"}, { linter_name: "ktlint"}, - { linter_name: "kubeval"}, + { linter_name: "kubeconform"}, { linter_name: "lua", version_option: "-v"}, { linter_name: "markdownlint"}, { linter_name: "mypy"},