Fix up chart linting, add docs and lint script (#146)

This updates the Helm linting system with the following changes:

- Import lintconf.yaml with small change to comment distance in order to
match existing values.yaml standards
- Update Chart.yaml and values.yaml in each chart to pass linting
standards
- Maintainers added to each chart from OWNERS + CODEOWNERS, the linter
requires GitHub usernames so argo-events maintainer names were converted
- README updated with documentation around chart standards and testing
- A local shell script added for running lint tests locally
This commit is contained in:
Sean Johnson 2019-11-06 08:08:17 +11:00 committed by GitHub
parent 30889df476
commit 5f33036890
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 112 additions and 13 deletions

View file

@ -5,7 +5,7 @@ jobs:
- image: gcr.io/kubernetes-charts-ci/test-image:v3.0.1
steps:
- checkout
- run: ct lint --config .circleci/chart-testing.yaml
- run: ct lint --config .circleci/chart-testing.yaml --lint-conf .circleci/lintconf.yaml
# Technically this only needs to be run on master, but it's good to have it run on every PR
# so that it is regularly tested.
publish:

42
.circleci/lintconf.yaml Normal file
View file

@ -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: 1
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: enable
truthy:
level: warning

View file

@ -51,6 +51,33 @@ argocd app create guestbook --dest-namespace default --dest-server https://kuber
argocd app sync guestbook
```
## New Application Versions
When raising application versions ensure you make the following changes:
- `values.yaml`: Bump all instances of the container image version
- `Chart.yaml`: Ensure `appVersion` matches the above container image and bump `version`
Please ensure chart version changes adhere to semantic versioning standards:
- Patch: App version patch updates, backwards compatible optional chart features
- Minor: New chart functionality (sidecars), major application updates or minor non-backwards compatible changes
- Major: Large chart rewrites, major non-backwards compatible or destructive changes
## Testing Charts
As part of the Continous Intergration system we run Helm's [Chart Testing](https://github.com/helm/chart-testing) tool.
The checks for this tool are stricter than the standard Helm requirements, where fields normally considered optional like `maintainer` are required in the standard spec and must be valid GitHub usernames.
Linting configuration can be found in [lintconf.yaml](.circleci/lintconf.yaml)
The linting can be invoked manually with the following command:
```
./scripts/lint.sh
```
## Publishing Changes
Changes are automatically publish whenever a commit is merged to master. The CI job (see `.circleci/config.yaml`) runs this:

View file

@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "1.2.4"
description: A Helm chart for ArgoCD, a declarative, GitOps continuous delivery tool for Kubernetes.
name: argo-cd
version: 1.0.0
version: 1.0.1
home: https://github.com/argoproj/argo-helm
icon: https://raw.githubusercontent.com/argoproj/argo/master/argo.png
keywords:

View file

@ -1,5 +1,11 @@
apiVersion: v1
description: A Helm chart for Argo-CI
name: argo-ci
version: 0.1.4
version: 0.1.5
icon: https://raw.githubusercontent.com/argoproj/argo/master/argo.png
appVersion: v1.0.0-alpha2
home: https://github.com/argoproj/argo-helm
maintainers:
- name: alexec
- name: alexmt
- name: jessesuen

View file

@ -9,4 +9,3 @@ argo:
installMinio: true
minioBucketName: argo-artifacts
useReleaseAsInstanceID: true

View file

@ -1,7 +1,7 @@
apiVersion: v1
description: A Helm chart to install Argo-Events in k8s Cluster
name: argo-events
version: 0.5.1
version: 0.5.2
keywords:
- argo-events
- sensor-controller
@ -10,6 +10,7 @@ sources:
- https://github.com/argoproj/argo-events
maintainers:
- name: VaibhavPage
- name: Matt Magaldi
- name: magaldima
appVersion: 0.10
icon: https://raw.githubusercontent.com/argoproj/argo/master/argo.png
home: https://github.com/argoproj/argo-helm

View file

@ -2,5 +2,11 @@ apiVersion: v1
appVersion: "v2.4.2"
description: A Helm chart for Argo Workflows
name: argo
version: 0.6.2
version: 0.6.3
icon: https://raw.githubusercontent.com/argoproj/argo/master/argo.png
home: https://github.com/argoproj/argo-helm
maintainers:
- name: alexec
- name: alexmt
- name: jessesuen
- name: benjaminws

18
scripts/lint.sh Executable file
View file

@ -0,0 +1,18 @@
#!/bin/bash
set -eux
SRCROOT="$(cd "$(dirname "$0")/.." && pwd)"
for dir in $(find $SRCROOT/charts -mindepth 1 -maxdepth 1 -type d);
do
name=$(basename $dir)
echo "Running Helm linting for $name"
docker run \
-v "$SRCROOT:/workdir" \
gcr.io/kubernetes-charts-ci/test-image:v3.0.1 \
ct \
lint \
--config .circleci/chart-testing.yaml \
--lint-conf .circleci/lintconf.yaml \
--charts "/workdir/charts/${name}"
done