From 41904a05c9fe813a103b6e2262112ce34c88ce54 Mon Sep 17 00:00:00 2001 From: TobiasCGoetz Date: Fri, 20 Jun 2025 15:28:09 +0200 Subject: [PATCH 1/5] Add simple CI usage documentation --- docs/using-kubelinter.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/using-kubelinter.md b/docs/using-kubelinter.md index 478cf9a55..6037a105f 100644 --- a/docs/using-kubelinter.md +++ b/docs/using-kubelinter.md @@ -60,6 +60,24 @@ includes the following pre-commit hooks: - You must [install Docker](https://docs.docker.com/engine/install/) before running this pre-commit hook. +## Using KubeLinter as part of your CI pipeline + +If you're using Github, there's the [KubeLinter Github Action](README.md##kubelinter-github-action) available. + +Alternatively, you can grab the latest binary release with the following commands +```bash +LOCATION=$(curl -s https://api.github.com/repos/stackrox/kube-linter/releases/latest \ +| grep "tag_name" \ +| awk '{print "https://github.com/stackrox/kube-linter/releases/download/" substr($2, 2, length($2)-3) "/kube-linter-linux.tar.gz"}') +curl -L -o kube-linter-linux.tar.gz $LOCATION +mkdir kube-linter/ +tar -xf kube-linter-linux.tar.gz -C "kube-linter/" +``` +and pass `--fail-on-invalid-resource` as an option to have your pipeline fail if your YAML file can't be parsed. See the following example: +```bash +./kube-linter/kube-linter lint --fail-on-invalid-resource pod.yaml +``` + ## KubeLinter commands This section covers kube-linter command syntax, describes the command From 8cbaa66f9b6efadb1260ea7b8fb9a4627b7f3f45 Mon Sep 17 00:00:00 2001 From: TobiasCGoetz Date: Fri, 20 Jun 2025 15:36:59 +0200 Subject: [PATCH 2/5] Correct GitHub spelling in docs/using-kubelinter.md Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --- docs/using-kubelinter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/using-kubelinter.md b/docs/using-kubelinter.md index 6037a105f..c1d71029f 100644 --- a/docs/using-kubelinter.md +++ b/docs/using-kubelinter.md @@ -62,7 +62,7 @@ includes the following pre-commit hooks: ## Using KubeLinter as part of your CI pipeline -If you're using Github, there's the [KubeLinter Github Action](README.md##kubelinter-github-action) available. +If you're using GitHub, there's the [KubeLinter GitHub Action](README.md##kubelinter-github-action) available. Alternatively, you can grab the latest binary release with the following commands ```bash From 08a371818de29b3be2eb85641f6b03a5810859cd Mon Sep 17 00:00:00 2001 From: TobiasCGoetz Date: Fri, 20 Jun 2025 15:38:46 +0200 Subject: [PATCH 3/5] Remove duplicate # from Markdown anchor --- docs/using-kubelinter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/using-kubelinter.md b/docs/using-kubelinter.md index c1d71029f..b4516b9fb 100644 --- a/docs/using-kubelinter.md +++ b/docs/using-kubelinter.md @@ -62,7 +62,7 @@ includes the following pre-commit hooks: ## Using KubeLinter as part of your CI pipeline -If you're using GitHub, there's the [KubeLinter GitHub Action](README.md##kubelinter-github-action) available. +If you're using GitHub, there's the [KubeLinter GitHub Action](README.md#kubelinter-github-action) available. Alternatively, you can grab the latest binary release with the following commands ```bash From e9de32150c880b3722ae059f2b048b109c71c1e1 Mon Sep 17 00:00:00 2001 From: TobiasCGoetz Date: Fri, 20 Jun 2025 20:16:01 +0200 Subject: [PATCH 4/5] Switch kube-linter latest binary fetch to jq --- docs/using-kubelinter.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/using-kubelinter.md b/docs/using-kubelinter.md index b4516b9fb..14b23b145 100644 --- a/docs/using-kubelinter.md +++ b/docs/using-kubelinter.md @@ -67,11 +67,12 @@ If you're using GitHub, there's the [KubeLinter GitHub Action](README.md#kubelin Alternatively, you can grab the latest binary release with the following commands ```bash LOCATION=$(curl -s https://api.github.com/repos/stackrox/kube-linter/releases/latest \ -| grep "tag_name" \ -| awk '{print "https://github.com/stackrox/kube-linter/releases/download/" substr($2, 2, length($2)-3) "/kube-linter-linux.tar.gz"}') +| jq -r '.tag_name + | "https://github.com/stackrox/kube-linter/releases/download/\(.)/kube-linter-linux.tar.gz"') curl -L -o kube-linter-linux.tar.gz $LOCATION mkdir kube-linter/ tar -xf kube-linter-linux.tar.gz -C "kube-linter/" + ``` and pass `--fail-on-invalid-resource` as an option to have your pipeline fail if your YAML file can't be parsed. See the following example: ```bash From 47a5f8bb1e345916bbdc59950216fd0ad22d0cd6 Mon Sep 17 00:00:00 2001 From: TobiasCGoetz Date: Fri, 20 Jun 2025 20:18:27 +0200 Subject: [PATCH 5/5] Make file name in CI docs consistent with other example --- docs/using-kubelinter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/using-kubelinter.md b/docs/using-kubelinter.md index 14b23b145..18cc06d30 100644 --- a/docs/using-kubelinter.md +++ b/docs/using-kubelinter.md @@ -76,7 +76,7 @@ tar -xf kube-linter-linux.tar.gz -C "kube-linter/" ``` and pass `--fail-on-invalid-resource` as an option to have your pipeline fail if your YAML file can't be parsed. See the following example: ```bash -./kube-linter/kube-linter lint --fail-on-invalid-resource pod.yaml +./kube-linter/kube-linter lint --fail-on-invalid-resource /path/to/yaml-file.yaml ``` ## KubeLinter commands