Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions .github/actions/utils/setup-helm-tools/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,24 @@
# under the License.

name: setup-helm-tools
description: Install pinned Helm and optionally kind for Helm chart CI jobs
description: Install pinned Helm and optionally kind, helm-docs, and yamllint for Helm chart CI jobs
inputs:
install-kind:
description: "Whether to install kind in addition to Helm"
required: false
default: "false"
install-helm-docs:
description: "Whether to install helm-docs for README generation"
required: false
default: "false"
install-yamllint:
description: "Whether to install yamllint for YAML linting"
required: false
default: "false"
install-helmfmt:
description: "Whether to install helmfmt for Helm template formatting"
required: false
default: "false"
helm-version:
description: "Helm release version"
required: false
Expand All @@ -38,6 +50,18 @@ inputs:
description: "SHA256 checksum for the kind binary"
required: false
default: "eb244cbafcc157dff60cf68693c14c9a75c4e6e6fedaf9cd71c58117cb93e3fa"
helm-docs-version:
description: "helm-docs release version"
required: false
default: "v1.14.2"
helm-docs-checksum:
description: "SHA256 checksum for the helm-docs tarball"
required: false
default: "a8cf72ada34fad93285ba2a452b38bdc5bd52cc9a571236244ec31022928d6cc"
helmfmt-checksum:
description: "SHA256 checksum for the helmfmt Linux x86_64 tarball"
required: false
default: "17e6de3266b7bfeb50f4e425736d3362c3c7a01bf9756710b1d350f9ced78fb2"

runs:
using: "composite"
Expand All @@ -51,17 +75,40 @@ runs:
exit 1
fi

- name: Install Helm and optional kind
- name: Install Helm and optional kind/helm-docs
shell: bash
env:
HELM_VERSION: ${{ inputs.helm-version }}
HELM_CHECKSUM: ${{ inputs.helm-checksum }}
KIND_VERSION: ${{ inputs.kind-version }}
KIND_CHECKSUM: ${{ inputs.kind-checksum }}
HELM_DOCS_VERSION: ${{ inputs.helm-docs-version }}
HELM_DOCS_CHECKSUM: ${{ inputs.helm-docs-checksum }}
run: |
set -euo pipefail
args=()
if [[ "${{ inputs.install-kind }}" == "true" ]]; then
args+=(--install-kind)
fi
if [[ "${{ inputs.install-helm-docs }}" == "true" ]]; then
args+=(--install-helm-docs)
fi
scripts/ci/setup-helm-tools.sh "${args[@]}"

- name: Install yamllint
if: inputs.install-yamllint == 'true'
shell: bash
run: pip install "yamllint==1.38.0"

- name: Install helmfmt
if: inputs.install-helmfmt == 'true'
shell: bash
env:
HELMFMT_CHECKSUM: ${{ inputs.helmfmt-checksum }}
run: |
set -euo pipefail
HELMFMT_VERSION="v0.5.0"
wget -qO /tmp/helmfmt.tar.gz "https://github.com/digitalstudium/helmfmt/releases/download/${HELMFMT_VERSION}/helmfmt_Linux_x86_64.tar.gz"
echo "${HELMFMT_CHECKSUM} /tmp/helmfmt.tar.gz" | sha256sum -c -
tar -xzf /tmp/helmfmt.tar.gz -C /tmp helmfmt
sudo install -m 0755 /tmp/helmfmt /usr/local/bin/helmfmt
3 changes: 3 additions & 0 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ jobs:
uses: ./.github/actions/utils/setup-helm-tools
with:
install-kind: ${{ inputs.task == 'smoke' }}
install-helm-docs: ${{ inputs.task == 'validate' }}
install-yamllint: ${{ inputs.task == 'validate' }}
install-helmfmt: ${{ inputs.task == 'validate' }}

- name: Setup Helm smoke cluster
if: inputs.component == 'helm' && inputs.task == 'smoke'
Expand Down
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,27 @@ repos:
files: ^(foreign|examples)/csharp/.*\.cs$
pass_filenames: false
stages: [pre-push]

# Helm chart formatting and linting
- repo: local
hooks:
- id: helmfmt
name: helmfmt
entry: helmfmt
language: system
files: ^helm/charts/.*/templates/.*\.(yaml|tpl)$
pass_filenames: true

- id: yamllint-helm
name: yamllint (helm)
entry: yamllint -c helm/charts/iggy/.yamllint.yml
language: system
files: ^helm/charts/iggy/(values\.yaml|Chart\.yaml)$
pass_filenames: true

- id: helm-docs
name: helm-docs
entry: bash -c 'cd helm/charts/iggy && helm-docs'
language: system
files: ^helm/charts/iggy/(values\.yaml|README\.md\.gotmpl)$
pass_filenames: false
65 changes: 65 additions & 0 deletions helm/charts/iggy/.yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# yamllint configuration for Helm charts
# Note: templates/ contains Go templating which yamllint cannot parse,
# so we only lint values.yaml and Chart.yaml

yaml-files:
- '*.yaml'
- '*.yml'

ignore: |
templates/

rules:
braces:
min-spaces-inside: 0
max-spaces-inside: 1
brackets:
min-spaces-inside: 0
max-spaces-inside: 0
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: 1
document-end: disable
document-start: disable
empty-lines:
max: 2
max-start: 0
max-end: 1
indentation:
spaces: 2
indent-sequences: true
key-duplicates: enable
line-length:
max: 200
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
new-line-at-end-of-file: enable
new-lines:
type: unix
trailing-spaces: enable
truthy:
allowed-values: ['true', 'false', 'yes', 'no']
Loading
Loading