From e270e801e49717a43d017cd5527cdbbc07ef027c Mon Sep 17 00:00:00 2001 From: Mauro Morales Date: Fri, 6 Jan 2023 10:06:23 +0100 Subject: [PATCH] Use ct to lint charts (#9) * Use ct to lint charts Signed-off-by: Mauro Morales * Lint all Signed-off-by: Mauro Morales * Lint Signed-off-by: Mauro Morales * Do not raise for trailing spaces Signed-off-by: Mauro Morales * pass config file Signed-off-by: Mauro Morales * Wrong flag name Signed-off-by: Mauro Morales * Lint Signed-off-by: Mauro Morales * Add validate-maintainers: false to lint conf Signed-off-by: Mauro Morales * same Signed-off-by: Mauro Morales * revert Signed-off-by: Mauro Morales * Only run for changed files Signed-off-by: Mauro Morales Signed-off-by: Mauro Morales --- .github/workflows/lint.yml | 35 ++++++++++++++++ charts/cluster-api-provider-kairos/Chart.yaml | 2 +- .../cluster-api-provider-kairos/values.yaml | 3 +- charts/entangle-proxy/values.yaml | 3 +- charts/entangle/values.yaml | 1 - charts/kcrypt-challenger/values.yaml | 3 +- charts/osbuilder/values.yaml | 1 - ct.yaml | 1 + lintconf.yaml | 42 +++++++++++++++++++ 9 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 ct.yaml create mode 100644 lintconf.yaml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..131f40e --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,35 @@ +name: Lint and Test Charts + +on: pull_request + +jobs: + lint-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v3 + with: + version: v3.10.0 + + - uses: actions/setup-python@v4 + with: + python-version: '3.9' + check-latest: true + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.3.1 + + - name: Run chart-testing (list-changed) + id: list-changed + run: | + changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) + if [[ -n "$changed" ]]; then + echo "::set-output name=changed::true" + fi + - name: Run chart-testing (lint) + run: ct lint --lint-conf=lintconf.yaml --validate-maintainers=false --target-branch ${{ github.event.repository.default_branch }} diff --git a/charts/cluster-api-provider-kairos/Chart.yaml b/charts/cluster-api-provider-kairos/Chart.yaml index ff25064..c8b1497 100644 --- a/charts/cluster-api-provider-kairos/Chart.yaml +++ b/charts/cluster-api-provider-kairos/Chart.yaml @@ -9,4 +9,4 @@ maintainers: email: mudler@kairos.io version: 0.0.1 -appVersion: "v0.0.1" \ No newline at end of file +appVersion: "v0.0.1" diff --git a/charts/cluster-api-provider-kairos/values.yaml b/charts/cluster-api-provider-kairos/values.yaml index 58be43c..5d5ddc3 100755 --- a/charts/cluster-api-provider-kairos/values.yaml +++ b/charts/cluster-api-provider-kairos/values.yaml @@ -1,4 +1,3 @@ - # Settings for the chart. # nameOverride Replaces the release name of the chart in Chart.yaml file when @@ -42,4 +41,4 @@ resources: memory: 50Mi requests: cpu: 250m - memory: 50Mi \ No newline at end of file + memory: 50Mi diff --git a/charts/entangle-proxy/values.yaml b/charts/entangle-proxy/values.yaml index 8412719..f210a35 100644 --- a/charts/entangle-proxy/values.yaml +++ b/charts/entangle-proxy/values.yaml @@ -1,4 +1,3 @@ - # Settings for entangle. # nameOverride Replaces the release name of the chart in Chart.yaml file when @@ -47,4 +46,4 @@ resources: memory: 50Mi requests: cpu: 250m - memory: 50Mi \ No newline at end of file + memory: 50Mi diff --git a/charts/entangle/values.yaml b/charts/entangle/values.yaml index 263730b..c42f15e 100644 --- a/charts/entangle/values.yaml +++ b/charts/entangle/values.yaml @@ -1,4 +1,3 @@ - # Settings for entangle. # nameOverride Replaces the release name of the chart in Chart.yaml file when diff --git a/charts/kcrypt-challenger/values.yaml b/charts/kcrypt-challenger/values.yaml index 67ab3d5..d41eca9 100755 --- a/charts/kcrypt-challenger/values.yaml +++ b/charts/kcrypt-challenger/values.yaml @@ -1,4 +1,3 @@ - # Settings for the chart. # nameOverride Replaces the release name of the chart in Chart.yaml file when @@ -58,4 +57,4 @@ resources: memory: 50Mi requests: cpu: 250m - memory: 50Mi \ No newline at end of file + memory: 50Mi diff --git a/charts/osbuilder/values.yaml b/charts/osbuilder/values.yaml index 7da57e0..082512e 100644 --- a/charts/osbuilder/values.yaml +++ b/charts/osbuilder/values.yaml @@ -1,4 +1,3 @@ - # Settings for the chart. # nameOverride Replaces the release name of the chart in Chart.yaml file when diff --git a/ct.yaml b/ct.yaml new file mode 100644 index 0000000..da6d1b5 --- /dev/null +++ b/ct.yaml @@ -0,0 +1 @@ +validate-maintainers: false diff --git a/lintconf.yaml b/lintconf.yaml new file mode 100644 index 0000000..ff61c46 --- /dev/null +++ b/lintconf.yaml @@ -0,0 +1,42 @@ +--- +rules: + braces: + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + brackets: + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + colons: + max-spaces-before: 0 + max-spaces-after: 1 + commas: + max-spaces-before: 0 + min-spaces-after: 1 + max-spaces-after: 1 + comments: + require-starting-space: true + min-spaces-from-content: 2 + document-end: disable + document-start: disable # No --- to start a file + empty-lines: + max: 2 + max-start: 0 + max-end: 0 + hyphens: + max-spaces-after: 1 + indentation: + spaces: consistent + indent-sequences: whatever # - list indentation will handle both indentation and without + check-multi-line-strings: false + key-duplicates: enable + line-length: disable # Lines can be any length + new-line-at-end-of-file: enable + new-lines: + type: unix + trailing-spaces: disable + truthy: + level: warning