From 9cf6049afd11c3dd44b3fc5d3bffa6dda4c2195b Mon Sep 17 00:00:00 2001 From: Marco Franssen Date: Fri, 16 Jun 2023 23:37:06 +0200 Subject: [PATCH] Allow contributors to run linting easily on local Signed-off-by: Marco Franssen --- .github/workflows/helm-chart-ci.yaml | 4 +--- Makefile | 12 ++++++++++++ ct.yaml | 11 +++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 ct.yaml diff --git a/.github/workflows/helm-chart-ci.yaml b/.github/workflows/helm-chart-ci.yaml index 3d5fa50..3210c99 100644 --- a/.github/workflows/helm-chart-ci.yaml +++ b/.github/workflows/helm-chart-ci.yaml @@ -94,9 +94,7 @@ jobs: version: ${{ env.CHART_TESTING_VERSION }} - name: Run chart-testing (lint) - run: | - ct lint --debug ${{ github.base_ref != 'release' && '--check-version-increment=false' || '' }} \ - --target-branch ${{ github.base_ref }} + run: TARGET_BRANCH=${{ github.base_ref }} make lint${{ github.base_ref == 'release' && '-release' || '' }} outputs: changed: ${{ steps.list-changed.outputs.changed }} diff --git a/Makefile b/Makefile index ac98f14..6b550d5 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,20 @@ +TARGET_BRANCH ?= main + .PHONY: help help: ## Display this help. @$(MAKE) help @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) +##@ Linting: + +.PHONY: lint +lint: ## Lint the charts using chart-testing + @echo Linting charts… + @ct lint --config ct.yaml --target-branch $(TARGET_BRANCH) --check-version-increment=false + +lint-release: ## Lint the charts using chart-testing for release + @echo Linting charts… + @ct lint --config ct.yaml --target-branch $(TARGET_BRANCH) ##@ Testing: diff --git a/ct.yaml b/ct.yaml new file mode 100644 index 0000000..affa496 --- /dev/null +++ b/ct.yaml @@ -0,0 +1,11 @@ +remote: origin +target-branch: main +chart-dirs: + - charts +chart-repos: + - spiffe=https://spiffe.github.io/helm-charts/ + - bitnami=https://charts.bitnami.com/bitnami + - ingress-nginx=https://kubernetes.github.io/ingress-nginx +exclude-deprecated: true +debug: true +helm-extra-args: "--timeout 15m"