From d6961e94149f46789481a4772535838ab8be96e2 Mon Sep 17 00:00:00 2001 From: John Coffey Date: Wed, 18 Nov 2026 09:55:31 -0700 Subject: [PATCH] Repo setup: chart layout, values schema, CI An empty chart at charts/inbuxa (helpers, install notes, a values schema that refuses keys it doesn't know) and tools/check.sh, which is all of CI: helm lint --strict under Helm 4 and Helm 3, a check that the schema refuses an unknown key, kubeconform against Kubernetes 1.35, 1.36 and 1.37, kube-linter with every built-in check, and helm-unittest. tools/install-tools.sh fetches those tools at pinned versions, each checked against a pinned SHA-256. CONTRIBUTING.md (Sending a change, the checks), issue forms for a bug and a release-candidate report, a PR template and CHANGELOG.md. Closes #1 --- .gitea/ISSUE_TEMPLATE/bug.yaml | 51 +++++++++++++++++ .gitea/ISSUE_TEMPLATE/config.yaml | 8 +++ .gitea/ISSUE_TEMPLATE/rc-report.yaml | 72 +++++++++++++++++++++++ .gitea/PULL_REQUEST_TEMPLATE.md | 26 +++++++++ .gitea/workflows/ci.yml | 44 ++++++++++++++ .gitignore | 2 + .kube-linter.yaml | 8 +++ CHANGELOG.md | 14 +++++ CONTRIBUTING.md | 82 +++++++++++++++++++++++++++ README.md | 17 +++++- charts/inbuxa/.helmignore | 11 ++++ charts/inbuxa/Chart.yaml | 13 +++++ charts/inbuxa/ci/defaults-values.yaml | 6 ++ charts/inbuxa/templates/NOTES.txt | 4 ++ charts/inbuxa/templates/_helpers.tpl | 46 +++++++++++++++ charts/inbuxa/tests/notes_test.yaml | 17 ++++++ charts/inbuxa/values.schema.json | 24 ++++++++ charts/inbuxa/values.yaml | 11 ++++ tools/check.sh | 65 +++++++++++++++++++++ tools/install-tools.sh | 64 +++++++++++++++++++++ 20 files changed, 584 insertions(+), 1 deletion(-) create mode 100644 .gitea/ISSUE_TEMPLATE/bug.yaml create mode 100644 .gitea/ISSUE_TEMPLATE/config.yaml create mode 100644 .gitea/ISSUE_TEMPLATE/rc-report.yaml create mode 100644 .gitea/PULL_REQUEST_TEMPLATE.md create mode 100644 .gitea/workflows/ci.yml create mode 100644 .gitignore create mode 100644 .kube-linter.yaml create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md create mode 100644 charts/inbuxa/.helmignore create mode 100644 charts/inbuxa/Chart.yaml create mode 100644 charts/inbuxa/ci/defaults-values.yaml create mode 100644 charts/inbuxa/templates/NOTES.txt create mode 100644 charts/inbuxa/templates/_helpers.tpl create mode 100644 charts/inbuxa/tests/notes_test.yaml create mode 100644 charts/inbuxa/values.schema.json create mode 100644 charts/inbuxa/values.yaml create mode 100755 tools/check.sh create mode 100755 tools/install-tools.sh diff --git a/.gitea/ISSUE_TEMPLATE/bug.yaml b/.gitea/ISSUE_TEMPLATE/bug.yaml new file mode 100644 index 0000000..1734a3b --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/bug.yaml @@ -0,0 +1,51 @@ +# SPDX-FileCopyrightText: 2026 Coffey Labs LLC +# SPDX-License-Identifier: Apache-2.0 +name: Bug +about: Something in the chart is wrong +title: "" +labels: [] +body: + - type: markdown + attributes: + value: | + For a problem in the server, webmail or console themselves, file it + in that project instead. Leave out passwords, keys and anything else + you'd rather not publish. + - type: textarea + id: what + attributes: + label: What happened + description: What you did, what you expected, and what happened instead. + validations: + required: true + - type: input + id: chart + attributes: + label: Chart version + placeholder: 27.1.0-rc.1 + validations: + required: true + - type: input + id: kubernetes + attributes: + label: Kubernetes version and distribution + placeholder: 1.36.2, k3s + validations: + required: true + - type: input + id: helm + attributes: + label: Helm version + placeholder: 4.3.2 + - type: textarea + id: values + attributes: + label: Your values + description: What you set (helm get values ), with secrets removed. + render: yaml + - type: textarea + id: logs + attributes: + label: Events and logs + description: kubectl describe / kubectl logs for the pods involved. + render: text diff --git a/.gitea/ISSUE_TEMPLATE/config.yaml b/.gitea/ISSUE_TEMPLATE/config.yaml new file mode 100644 index 0000000..1960dab --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/config.yaml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Server, webmail or console problem + url: https://git.coffeylabs.org/inbuxa + about: A problem in inbuxa itself rather than the chart belongs in that project. + - name: Questions + url: https://community.coffeylabs.org + about: How to set something up, or whether the chart fits your cluster. diff --git a/.gitea/ISSUE_TEMPLATE/rc-report.yaml b/.gitea/ISSUE_TEMPLATE/rc-report.yaml new file mode 100644 index 0000000..7a3638a --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/rc-report.yaml @@ -0,0 +1,72 @@ +# SPDX-FileCopyrightText: 2026 Coffey Labs LLC +# SPDX-License-Identifier: Apache-2.0 +name: Release candidate report +about: How a release candidate went on your cluster, good or bad +title: "RC report: " +labels: [] +body: + - type: markdown + attributes: + value: | + Thanks for testing a release candidate. A report that says "it + worked" is as useful as one that doesn't. Leave out passwords, keys + and hostnames you'd rather not publish. + - type: input + id: chart + attributes: + label: Chart version + placeholder: 27.1.0-rc.1 + validations: + required: true + - type: dropdown + id: outcome + attributes: + label: How it went + options: + - Worked + - Worked, with problems + - Didn't work + validations: + required: true + - type: checkboxes + id: tried + attributes: + label: What you tried + options: + - label: Fresh install + - label: Upgrade from the previous release candidate + - label: Mail in (SMTP from outside) + - label: Mail out (delivery to another provider) + - label: Webmail sign-in and use + - label: Console sign-in and use + - label: Killing a pod or draining a node + - label: Backup and restore + - type: input + id: kubernetes + attributes: + label: Kubernetes version and distribution + placeholder: 1.36.2, k3s + validations: + required: true + - type: input + id: data + attributes: + label: Data layer + description: Your PostgreSQL, NATS and S3, and their versions. + placeholder: CloudNativePG 17, NATS 2.11, Garage 2.1 + - type: input + id: network + attributes: + label: Load balancer and ingress + placeholder: MetalLB, Envoy Gateway + - type: textarea + id: notes + attributes: + label: What you saw + description: Anything that went wrong or was unclear, and what you did about it. + - type: textarea + id: values + attributes: + label: Your values + description: helm get values , with secrets removed. + render: yaml diff --git a/.gitea/PULL_REQUEST_TEMPLATE.md b/.gitea/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..451fd72 --- /dev/null +++ b/.gitea/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,26 @@ + + +## Summary + + + +## Related issues + + + +## Values + + + +## Testing + + diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..8a6c022 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,44 @@ +# SPDX-FileCopyrightText: 2026 Coffey Labs LLC +# SPDX-License-Identifier: Apache-2.0 +# +# The chart's checks on every pull request and on main: helm lint under +# Helm 4 and Helm 3, the values schema, kubeconform against the three newest +# Kubernetes minors, kube-linter, and helm-unittest. All of it is +# tools/check.sh, so a contributor runs exactly this before pushing. +# +# Installs on a real cluster are the lab's job (inbuxa-k8s-lab), not this +# one's. The job image is pinned by digest, the only action is +# coffey-labs/actions checkout pinned by SHA, and every tool is pinned by +# version and SHA-256 in tools/install-tools.sh. +name: ci + +on: + push: + branches: [main] + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +defaults: + run: + shell: bash + +jobs: + chart: + runs-on: light + container: + image: mirror.gcr.io/library/debian:trixie-slim@sha256:a72b4433de1cf7d6bae0c4cee74d0547f58601a643b3375f070c51600d63b6b2 # trixie-slim + steps: + - name: Packages + run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update -qq + apt-get install -y -qq --no-install-recommends ca-certificates curl git >/dev/null + - uses: coffey-labs/actions/checkout@fab0c4d45e0162963965f1555df27b7bed5e20ec + - run: tools/install-tools.sh + - run: tools/check.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6d0c0ea --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Tools from tools/install-tools.sh +.tools/ diff --git a/.kube-linter.yaml b/.kube-linter.yaml new file mode 100644 index 0000000..cffc3f7 --- /dev/null +++ b/.kube-linter.yaml @@ -0,0 +1,8 @@ +# SPDX-FileCopyrightText: 2026 Coffey Labs LLC +# SPDX-License-Identifier: Apache-2.0 +# +# Every built-in check, on everything the chart renders. A check is only +# left out here with a line saying why. +checks: + addAllBuiltIn: true + exclude: [] diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5725d94 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +# Changelog + +All notable changes to the inbuxa chart. + +Chart versions follow the inbuxa suite: release candidates `27.1.0-rc.N`, +then `27.1.0`. Each release says which server, webmail and console images it +runs, pinned by digest. + +## Unreleased + +### Added +- The repository: the chart's layout, a values schema that refuses unknown + keys, and CI (`helm lint` under Helm 4 and 3, kubeconform against + Kubernetes 1.35 to 1.37, kube-linter, helm-unittest). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..39f63b6 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,82 @@ +# Contributing to inbuxa-charts + +This repository holds the Helm chart that runs inbuxa on Kubernetes: the +mail server, the webmail and the console. Bug reports, release-candidate +reports and changes are all welcome. + +## Before you start + +- The chart runs the inbuxa images; it doesn't build them. A bug in the + server, the webmail or the console belongs in + [inbuxa-server](https://git.coffeylabs.org/inbuxa/inbuxa-server/issues), + [inbuxa-webmail](https://git.coffeylabs.org/inbuxa/inbuxa-webmail/issues) or + [inbuxa-admin](https://git.coffeylabs.org/inbuxa/inbuxa-admin/issues). +- The data layer (PostgreSQL, NATS, S3) is yours to bring. The chart + connects to it and doesn't install it. +- No operator and no custom resources: a chart and plain manifests only. +- The chart is licensed under **Apache-2.0**, and a change you send is + distributed under it. The images it runs stay under their own licences. + +## Reporting a problem + +Search the [issues](https://git.coffeylabs.org/inbuxa/inbuxa-charts/issues) +first. A new issue offers two forms: **Bug** for something that's wrong, and +**Release candidate report** for how an RC went on your cluster, good or bad. +Both ask for the chart version, your Kubernetes version and distribution, and +what you set in your values. Leave out passwords, keys and hostnames you'd +rather not publish. + +## Sending a change + +New accounts on git.coffeylabs.org can file issues but can't push or fork. +Until you have repository access, open an +[issue](https://git.coffeylabs.org/inbuxa/inbuxa-charts/issues) for the +change, or say hello on [community.coffeylabs.org](https://community.coffeylabs.org), +and attach the change to the issue as a patch: + +```bash +git format-patch origin/main --stdout > my-change.patch +``` + +Repository access goes to volunteers we have worked with; a few good issues +or patches is the usual way in. After that you push a branch here and open a +pull request against `main`. The GitHub copy is a read-only mirror, so pull +requests opened there are not merged. + +A pull request: + +1. Does one thing, on a branch named for it (`fix/probe-timeout`, + `feat/webmail-hpa`). +2. Passes `tools/check.sh` before it's pushed (see below). +3. Adds or updates a test in `charts/inbuxa/tests/` for what it changes. +4. Describes any new value in `values.yaml` and in `values.schema.json`, + with a sensible default. The schema refuses keys it doesn't know, so a + value missing from it can't be set at all. +5. Adds a line to `CHANGELOG.md` under **Unreleased**. + +`main` is protected: a change reaches it through a pull request whose +**chart** check has passed. + +## The checks + +`tools/check.sh` is everything CI runs: + +- `helm lint --strict` under Helm 4 and Helm 3, with each values file in + `charts/inbuxa/ci/` +- that the values schema refuses an unknown key +- kubeconform against the three newest Kubernetes minors +- kube-linter, with every built-in check on +- helm-unittest + +`tools/install-tools.sh` downloads the exact versions CI uses, checked +against pinned SHA-256 hashes, into `.tools/bin` (linux/amd64): + +```bash +tools/install-tools.sh && tools/check.sh +``` + +To check a new set of values, add `charts/inbuxa/ci/-values.yaml`; +every file there is linted, rendered and checked. + +Installing on a real cluster, the mail tests and the upgrade tests live in +[inbuxa-k8s-lab](https://git.coffeylabs.org/inbuxa/inbuxa-k8s-lab). diff --git a/README.md b/README.md index 3029950..ac14c38 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,18 @@ # inbuxa-charts -Helm chart for running inbuxa on Kubernetes \ No newline at end of file +The Helm chart for running inbuxa on Kubernetes: the mail server, the +webmail and the console, against a PostgreSQL, NATS and S3 you provide. + +**Status: in development.** The chart is being built for inbuxa 27.1 and +doesn't install anything yet. Release candidates start with `27.1.0-rc.1`. + +- `charts/inbuxa`: the chart, its values schema and its tests +- `tools/check.sh`: every check CI runs; see [CONTRIBUTING.md](CONTRIBUTING.md) +- [CHANGELOG.md](CHANGELOG.md) + +Installs on real clusters, the mail tests and the upgrade tests are in +[inbuxa-k8s-lab](https://git.coffeylabs.org/inbuxa/inbuxa-k8s-lab). The guide +is at [docs.inbuxa.org](https://docs.inbuxa.org/). + +Licensed under the [Apache License 2.0](LICENSE). The images the chart runs +are licensed separately. diff --git a/charts/inbuxa/.helmignore b/charts/inbuxa/.helmignore new file mode 100644 index 0000000..256b65c --- /dev/null +++ b/charts/inbuxa/.helmignore @@ -0,0 +1,11 @@ +# Kept out of the packaged chart +.git/ +.gitignore +.DS_Store +*.swp +*.bak +*.tmp +*.orig +*~ +ci/ +tests/ diff --git a/charts/inbuxa/Chart.yaml b/charts/inbuxa/Chart.yaml new file mode 100644 index 0000000..ebbb8a8 --- /dev/null +++ b/charts/inbuxa/Chart.yaml @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2026 Coffey Labs LLC +# SPDX-License-Identifier: Apache-2.0 +apiVersion: v2 +name: inbuxa +description: The inbuxa mail server, webmail and console, on Kubernetes +type: application +# Releases are 27.1.0-rc.N, then 27.1.0. Between them this stays a dev version. +version: 0.0.0-dev +appVersion: "27.1" +# The three newest Kubernetes minors at release time (support matrix) +kubeVersion: ">=1.35.0-0" +sources: + - https://git.coffeylabs.org/inbuxa/inbuxa-charts diff --git a/charts/inbuxa/ci/defaults-values.yaml b/charts/inbuxa/ci/defaults-values.yaml new file mode 100644 index 0000000..560a3d2 --- /dev/null +++ b/charts/inbuxa/ci/defaults-values.yaml @@ -0,0 +1,6 @@ +# SPDX-FileCopyrightText: 2026 Coffey Labs LLC +# SPDX-License-Identifier: Apache-2.0 +# +# Each file in ci/ is one set of values tools/check.sh renders and checks. +# This one is the defaults, as they are. +{} diff --git a/charts/inbuxa/templates/NOTES.txt b/charts/inbuxa/templates/NOTES.txt new file mode 100644 index 0000000..cbbfd54 --- /dev/null +++ b/charts/inbuxa/templates/NOTES.txt @@ -0,0 +1,4 @@ +inbuxa {{ .Chart.AppVersion }} is installed as "{{ .Release.Name }}" in namespace "{{ .Release.Namespace }}". + +This chart is in development and creates nothing yet. The guide is at +https://docs.inbuxa.org/ diff --git a/charts/inbuxa/templates/_helpers.tpl b/charts/inbuxa/templates/_helpers.tpl new file mode 100644 index 0000000..cad66ca --- /dev/null +++ b/charts/inbuxa/templates/_helpers.tpl @@ -0,0 +1,46 @@ +{{/* +SPDX-FileCopyrightText: 2026 Coffey Labs LLC +SPDX-License-Identifier: Apache-2.0 +*/}} + +{{/* The chart's name, or nameOverride. */}} +{{- define "inbuxa.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 40 | trimSuffix "-" -}} +{{- end -}} + +{{/* +The prefix of every object's name. Kept to 52 characters, so a suffix such +as "-front" or "-webmail" still fits the 63 a label value allows. +*/}} +{{- define "inbuxa.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 52 | trimSuffix "-" -}} +{{- else -}} +{{- $name := include "inbuxa.name" . -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 52 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 52 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* Chart name and version, as the helm.sh/chart label wants them. */}} +{{- define "inbuxa.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* Labels that select a component's pods. Never change across upgrades. */}} +{{- define "inbuxa.selectorLabels" -}} +app.kubernetes.io/name: {{ include "inbuxa.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* Every object's labels. */}} +{{- define "inbuxa.labels" -}} +helm.sh/chart: {{ include "inbuxa.chart" . }} +{{ include "inbuxa.selectorLabels" . }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +app.kubernetes.io/part-of: inbuxa +{{- end -}} diff --git a/charts/inbuxa/tests/notes_test.yaml b/charts/inbuxa/tests/notes_test.yaml new file mode 100644 index 0000000..559f366 --- /dev/null +++ b/charts/inbuxa/tests/notes_test.yaml @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: 2026 Coffey Labs LLC +# SPDX-License-Identifier: Apache-2.0 +suite: install notes +templates: + - NOTES.txt +release: + name: mail + namespace: inbuxa +tests: + - it: names the release and its namespace + asserts: + - matchRegexRaw: + pattern: 'installed as "mail" in namespace "inbuxa"' + - it: points at the guide + asserts: + - matchRegexRaw: + pattern: https://docs\.inbuxa\.org/ diff --git a/charts/inbuxa/values.schema.json b/charts/inbuxa/values.schema.json new file mode 100644 index 0000000..09c0d35 --- /dev/null +++ b/charts/inbuxa/values.schema.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://json-schema.org/draft-07/schema#", + "title": "Values for the inbuxa chart", + "type": "object", + "additionalProperties": false, + "properties": { + "global": { + "description": "Set by Helm for charts that have subcharts. Unused here.", + "type": "object" + }, + "nameOverride": { + "description": "Replaces \"inbuxa\" in the names of everything the chart creates.", + "type": "string", + "maxLength": 40, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$" + }, + "fullnameOverride": { + "description": "Replaces the whole name: the release name and the chart name.", + "type": "string", + "maxLength": 52, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$" + } + } +} diff --git a/charts/inbuxa/values.yaml b/charts/inbuxa/values.yaml new file mode 100644 index 0000000..29ba627 --- /dev/null +++ b/charts/inbuxa/values.yaml @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2026 Coffey Labs LLC +# SPDX-License-Identifier: Apache-2.0 +# +# Values for the inbuxa chart. Every key here is described in +# values.schema.json, which rejects a key it doesn't know: a typo fails the +# install instead of being ignored. + +# Overrides the "inbuxa" in the names of everything the chart creates. +nameOverride: "" +# Overrides the whole name (release name plus chart name). +fullnameOverride: "" diff --git a/tools/check.sh b/tools/check.sh new file mode 100755 index 0000000..ca6dc72 --- /dev/null +++ b/tools/check.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +# SPDX-FileCopyrightText: 2026 Coffey Labs LLC +# SPDX-License-Identifier: Apache-2.0 +# +# Every check CI runs on the chart, in the order it runs them. Run it before +# you push: tools/install-tools.sh puts the pinned tools in .tools/bin, and +# this script uses them from there when they're present. +# +# tools/install-tools.sh && tools/check.sh +set -euo pipefail + +cd "$(dirname "$0")/.." +[ -d .tools/bin ] && PATH="$PWD/.tools/bin:$PATH" + +CHART=charts/inbuxa +# The three newest Kubernetes minors (support matrix). kubeconform's schema +# set has to have them: a new minor is added here once it does. +KUBE_VERSIONS=(1.35.0 1.36.0 1.37.0) +OUT="$(mktemp -d)" +trap 'rm -rf "$OUT"' EXIT + +step() { printf '\n== %s\n' "$*"; } + +for helm in helm helm3; do + step "$helm lint ($($helm version --short))" + $helm lint --strict "$CHART" + for values in "$CHART"/ci/*-values.yaml; do + $helm lint --strict "$CHART" -f "$values" + done +done + +step "the values schema rejects a key it doesn't know" +if helm lint --strict "$CHART" --set notAValue=1 >"$OUT/reject.log" 2>&1; then + echo "!! an unknown value was accepted" >&2 + exit 1 +fi +grep -q "notAValue" "$OUT/reject.log" || { + echo "!! refused, but not over the unknown value:" >&2 + cat "$OUT/reject.log" >&2 + exit 1 +} +echo "refused, as it should be" + +for values in "$CHART"/ci/*-values.yaml; do + name="$(basename "$values" -values.yaml)" + for kube in "${KUBE_VERSIONS[@]}"; do + step "kubeconform: $name values on Kubernetes $kube" + helm template ci "$CHART" -f "$values" --kube-version "$kube" >"$OUT/$name-$kube.yaml" + kubeconform -strict -summary -kubernetes-version "$kube" \ + -schema-location default "$OUT/$name-$kube.yaml" + done + step "kube-linter: $name values" + rendered="$OUT/$name-${KUBE_VERSIONS[-1]}.yaml" + if grep -q '^kind:' "$rendered"; then + kube-linter lint --config .kube-linter.yaml "$rendered" + else + # kube-linter treats "no objects" as a failure + echo "nothing rendered, nothing to lint" + fi +done + +step "helm-unittest" +helm-unittest --strict "$CHART" + +printf '\nAll checks passed.\n' diff --git a/tools/install-tools.sh b/tools/install-tools.sh new file mode 100755 index 0000000..9cdb9da --- /dev/null +++ b/tools/install-tools.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +# SPDX-FileCopyrightText: 2026 Coffey Labs LLC +# SPDX-License-Identifier: Apache-2.0 +# +# Downloads the tools tools/check.sh uses into DIR (default ./.tools/bin), +# each at a pinned version and checked against a pinned SHA-256, so CI and +# a contributor run the same binaries. linux/amd64 only, which is what CI +# runs on; elsewhere install the same versions yourself. +# +# To move a pin: change the version and its hash together. The hashes are +# the projects' own published ones (CHECKSUMS, *.sha256sum, the release +# asset digest). +set -euo pipefail + +DIR="${1:-.tools/bin}" +mkdir -p "$DIR" +WORK="$(mktemp -d)" +trap 'rm -rf "$WORK"' EXIT + +HELM4_VERSION=v4.3.2 +HELM4_SHA256=d1c0278d46beab79582d7e50f5b3dc206944ba8e577cde618513fd07daa53983 +HELM3_VERSION=v3.22.1 +HELM3_SHA256=896cf63684a42a723d61c980369d6e588330927deb13676ca0d85006dd6da0ea +KUBECONFORM_VERSION=v0.8.0 +KUBECONFORM_SHA256=9bc2bffbf71f261128533edaf912153948b7ff238f9a531ae6d34466ec287883 +KUBE_LINTER_VERSION=v0.8.3 +KUBE_LINTER_SHA256=1a6d8419b11971372971fdbc22682b684ebfb7cf1c39591662d1b6ca736c41df +HELM_UNITTEST_VERSION=1.2.1 +HELM_UNITTEST_SHA256=48e86ecc1467b009630e5954375e5d8494139f73b466df5fe8c04fa45b634939 + +# fetch URL SHA256 FILE: download URL to $WORK/FILE and check its hash +fetch() { + curl -fsSL --retry 3 --proto '=https' -o "$WORK/$3" "$1" + echo "$2 $WORK/$3" | sha256sum -c --quiet - +} + +fetch "https://get.helm.sh/helm-$HELM4_VERSION-linux-amd64.tar.gz" "$HELM4_SHA256" helm4.tgz +tar -xzf "$WORK/helm4.tgz" -C "$WORK" linux-amd64/helm +install -m 0755 "$WORK/linux-amd64/helm" "$DIR/helm" + +fetch "https://get.helm.sh/helm-$HELM3_VERSION-linux-amd64.tar.gz" "$HELM3_SHA256" helm3.tgz +tar -xzf "$WORK/helm3.tgz" -C "$WORK" linux-amd64/helm +install -m 0755 "$WORK/linux-amd64/helm" "$DIR/helm3" + +fetch "https://github.com/yannh/kubeconform/releases/download/$KUBECONFORM_VERSION/kubeconform-linux-amd64.tar.gz" \ + "$KUBECONFORM_SHA256" kubeconform.tgz +tar -xzf "$WORK/kubeconform.tgz" -C "$WORK" kubeconform +install -m 0755 "$WORK/kubeconform" "$DIR/kubeconform" + +fetch "https://github.com/stackrox/kube-linter/releases/download/$KUBE_LINTER_VERSION/kube-linter-linux.tar.gz" \ + "$KUBE_LINTER_SHA256" kube-linter.tgz +tar -xzf "$WORK/kube-linter.tgz" -C "$WORK" kube-linter +install -m 0755 "$WORK/kube-linter" "$DIR/kube-linter" + +fetch "https://github.com/helm-unittest/helm-unittest/releases/download/v$HELM_UNITTEST_VERSION/helm-unittest-linux-amd64-$HELM_UNITTEST_VERSION.tgz" \ + "$HELM_UNITTEST_SHA256" helm-unittest.tgz +tar -xzf "$WORK/helm-unittest.tgz" -C "$WORK" untt-linux-amd64 +install -m 0755 "$WORK/untt-linux-amd64" "$DIR/helm-unittest" + +echo "Tools in $DIR:" +"$DIR/helm" version --short +"$DIR/helm3" version --short +"$DIR/kubeconform" -v +"$DIR/kube-linter" version -- 2.54.0