From cad7d73e9f20225d5fd85626fe020c864de57bbe Mon Sep 17 00:00:00 2001 From: John Ko <279736+johnko@users.noreply.github.com> Date: Sun, 8 Feb 2026 06:09:07 -0500 Subject: [PATCH 01/12] Add .github/workflows/shell-checks.yml --- .github/workflows/shell-checks.yml | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/shell-checks.yml diff --git a/.github/workflows/shell-checks.yml b/.github/workflows/shell-checks.yml new file mode 100644 index 0000000..46f2fd8 --- /dev/null +++ b/.github/workflows/shell-checks.yml @@ -0,0 +1,32 @@ +concurrency: + cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} +jobs: + shellcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + show-progress: false + - name: Test with shellcheck + run: | + bash -ex .github/shellcheck.sh + timeout-minutes: 10 + shfmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + show-progress: false + - name: Apply shfmt and find unformatted files + run: | + bash -ex .github/shfmt.sh + timeout-minutes: 10 +name: shell-checks +on: + pull_request: + paths: + - .github/shellcheck.sh + - .github/shfmt.sh + - .github/workflows/shell-checks.yml + - '**.sh' From f981ff449e43db24981d8ecb7f7bc057a65b4027 Mon Sep 17 00:00:00 2001 From: John Ko <279736+johnko@users.noreply.github.com> Date: Sun, 8 Feb 2026 06:09:09 -0500 Subject: [PATCH 02/12] Add .github/pre-commit.sh --- .github/pre-commit.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/pre-commit.sh diff --git a/.github/pre-commit.sh b/.github/pre-commit.sh new file mode 100644 index 0000000..6b6c2e9 --- /dev/null +++ b/.github/pre-commit.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -euxo pipefail + +ANY_ERROR=false + +set +e + +if type tofu &>/dev/null; then + bash -ex .github/opentofu-fmt.sh + # shellcheck disable=SC2181 + [[ $? -ne 0 ]] && ANY_ERROR=true + bash -ex .github/opentofu-validate.sh + # shellcheck disable=SC2181 + [[ $? -ne 0 ]] && ANY_ERROR=true +fi + +if type terraform &>/dev/null; then + bash -ex .github/terraform-fmt.sh + # shellcheck disable=SC2181 + [[ $? -ne 0 ]] && ANY_ERROR=true + bash -ex .github/terraform-validate.sh + # shellcheck disable=SC2181 + [[ $? -ne 0 ]] && ANY_ERROR=true +fi + +if type shellcheck &>/dev/null; then + bash -ex .github/shellcheck.sh + # shellcheck disable=SC2181 + [[ $? -ne 0 ]] && ANY_ERROR=true +fi + +if type shfmt &>/dev/null; then + bash -ex .github/shfmt.sh + # shellcheck disable=SC2181 + [[ $? -ne 0 ]] && ANY_ERROR=true +fi + +set -e + +if [[ "true" == "$ANY_ERROR" ]]; then + exit 1 +fi From 2b6a11a1c3e30d63385a570c4f9af47b0ed95376 Mon Sep 17 00:00:00 2001 From: John Ko <279736+johnko@users.noreply.github.com> Date: Sun, 8 Feb 2026 06:09:18 -0500 Subject: [PATCH 03/12] Add .github/workflows/yaml-checks.yml --- .github/workflows/yaml-checks.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/yaml-checks.yml diff --git a/.github/workflows/yaml-checks.yml b/.github/workflows/yaml-checks.yml new file mode 100644 index 0000000..38203f0 --- /dev/null +++ b/.github/workflows/yaml-checks.yml @@ -0,0 +1,23 @@ +concurrency: + cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} +jobs: + yq-pretty: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + show-progress: false + - name: Apply yq --prettyPrint and find unformatted files + run: | + bash -ex .github/yq-pretty.sh + timeout-minutes: 10 +name: yaml-checks +on: + pull_request: + paths: + - .github/git-has-uncommited-changes.sh + - .github/workflows/yaml-checks.yml + - .github/yq-pretty.sh + - '**.yaml' + - '**.yml' From dba8e39f5a134781df28336161c3620573dc57de Mon Sep 17 00:00:00 2001 From: John Ko <279736+johnko@users.noreply.github.com> Date: Sun, 8 Feb 2026 06:09:56 -0500 Subject: [PATCH 04/12] Add .github/workflows/renovate.yml --- .github/workflows/renovate.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/renovate.yml diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml new file mode 100644 index 0000000..c941ed5 --- /dev/null +++ b/.github/workflows/renovate.yml @@ -0,0 +1,26 @@ +concurrency: + cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} +jobs: + call-workflow: + secrets: inherit + uses: johnko/renovate-config/.github/workflows/renovate-shared.yml@main + with: + logLevel: ${{ inputs.logLevel }} + overrideSchedule: ${{ inputs.overrideSchedule == 'true' && 'true' || '' }} +name: Renovate +on: + schedule: + - cron: 30 12 * * SUN,SAT # UTC + workflow_dispatch: + inputs: + logLevel: + default: info + description: Override default log level + required: false + type: string + overrideSchedule: + default: "false" + description: Override all schedules + required: false + type: string From 36c6007713181832ba1c685c6525d1a70958b614 Mon Sep 17 00:00:00 2001 From: John Ko <279736+johnko@users.noreply.github.com> Date: Sun, 8 Feb 2026 06:10:05 -0500 Subject: [PATCH 05/12] Add .github/renovate.json --- .github/renovate.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/renovate.json diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..f25ae81 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,14 @@ +{ + "allowedCommands": [ + "/bin/bash .github/helm-dep.sh" + ], + "extends": [ + "github>johnko/renovate-config" + ], + "postUpgradeTasks": { + "commands": [ + "/bin/bash .github/helm-dep.sh" + ], + "executionMode": "branch" + } +} From a2f106aedb5baceaa0150233f45026367c389441 Mon Sep 17 00:00:00 2001 From: John Ko <279736+johnko@users.noreply.github.com> Date: Sun, 8 Feb 2026 06:10:26 -0500 Subject: [PATCH 06/12] Add .github/setup-git-pre-commit-hooks.sh --- .github/setup-git-pre-commit-hooks.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/setup-git-pre-commit-hooks.sh diff --git a/.github/setup-git-pre-commit-hooks.sh b/.github/setup-git-pre-commit-hooks.sh new file mode 100644 index 0000000..e73a4d0 --- /dev/null +++ b/.github/setup-git-pre-commit-hooks.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -euxo pipefail + +SCRIPT_DIR=$(dirname "$0") +pushd "$SCRIPT_DIR" + +if [[ -e ./pre-commit.sh ]] && [[ -d ../.git/hooks ]]; then + install -m 700 ./pre-commit.sh ../.git/hooks/pre-commit +fi From b6d9bec3c31f809c46c73ba2f4b4b3adf1bb2c07 Mon Sep 17 00:00:00 2001 From: John Ko <279736+johnko@users.noreply.github.com> Date: Sun, 8 Feb 2026 06:10:54 -0500 Subject: [PATCH 07/12] Add .github/yq-pretty.sh --- .github/yq-pretty.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/yq-pretty.sh diff --git a/.github/yq-pretty.sh b/.github/yq-pretty.sh new file mode 100644 index 0000000..318a0e0 --- /dev/null +++ b/.github/yq-pretty.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euxo pipefail + +yq --version + +find . -type f \( -name '*.yaml' -o -name '*.yml' \) -not -path '*/lab/charts/*' -not -path '*/lab/traefik/*' -not -path '*/docker-files/squid/ref/*' -print0 | xargs -0 --max-procs=2 --verbose -I{} yq --exit-status --inplace --no-colors --prettyPrint 'sort_keys(..)' {} + +bash -ex ./.github/git-has-uncommited-changes.sh From 3536b290d694eedbfc70a07a2b1d2c60f33a9db8 Mon Sep 17 00:00:00 2001 From: John Ko <279736+johnko@users.noreply.github.com> Date: Sun, 8 Feb 2026 06:11:16 -0500 Subject: [PATCH 08/12] Add .github/git-has-uncommited-changes.sh --- .github/git-has-uncommited-changes.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/git-has-uncommited-changes.sh diff --git a/.github/git-has-uncommited-changes.sh b/.github/git-has-uncommited-changes.sh new file mode 100644 index 0000000..371a9d3 --- /dev/null +++ b/.github/git-has-uncommited-changes.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euxo pipefail + +git version + +git diff --exit-code From 693c4c81b6e335deb10f3362e779aebbe0076358 Mon Sep 17 00:00:00 2001 From: John Ko <279736+johnko@users.noreply.github.com> Date: Sun, 8 Feb 2026 06:11:33 -0500 Subject: [PATCH 09/12] Add .github/shellcheck.sh --- .github/shellcheck.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/shellcheck.sh diff --git a/.github/shellcheck.sh b/.github/shellcheck.sh new file mode 100644 index 0000000..5c32d7e --- /dev/null +++ b/.github/shellcheck.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -exo pipefail + +# when running in CI and shellcheck doesn't exist, install it +if [[ "true" == "$CI" ]]; then + if ! type shellcheck &>/dev/null; then + SUDO='' + if type sudo &>/dev/null; then + SUDO=sudo + fi + if type brew &>/dev/null; then + brew install shellcheck + elif type snap &>/dev/null; then + INSTALL_COMMAND="snap install shellcheck" + # shellcheck disable=SC2086 + $INSTALL_COMMAND || $SUDO $INSTALL_COMMAND + elif type apt &>/dev/null; then + SUDO='' + if type sudo &>/dev/null; then + SUDO=sudo + fi + INSTALL_COMMAND="apt install --yes shellcheck" + # shellcheck disable=SC2086 + $INSTALL_COMMAND || $SUDO $INSTALL_COMMAND + fi + fi +fi +set -u + +shellcheck --version + +set +e + +# git submodule status | awk '{print "-a -not -path **/"$2"/**"}' | tr "\n" " " | sed "s,\*\*/,'*/,g" | sed "s,/\*\*,/*',g" ; echo "\\" + +find . -type f \( -name '*.sh' -o -name '*.envrc' \) \ + -a -not -path '*/.terraform/modules/*' \ + \ + -a -not -path '*/.bash-git-prompt/*' -a -not -path '*/.zsh/kube-ps1/*' -a -not -path '*/.zsh/pure/*' -a -not -path '*/.zsh/zsh-colored-man-pages/*' -a -not -path '*/.zsh/zsh-command-time/*' -a -not -path '*/docker-files/squid/ref/docker-squid-cache-all/*' -a -not -path '*/docker-files/squid/ref/squid-in-a-can/*' -a -not -path '*/docker-files/squid/ref/squid-npm/*' \ + \ + -a -not -name 'macos-homebrew.sh' \ + -print0 | xargs -0 --max-procs=2 --verbose -I{} shellcheck --check-sourced --external-sources {} From 650bad80c7926bb3de96682f9d65e5f73a889638 Mon Sep 17 00:00:00 2001 From: John Ko <279736+johnko@users.noreply.github.com> Date: Sun, 8 Feb 2026 06:11:35 -0500 Subject: [PATCH 10/12] Add .github/workflows/renovate-config.yml --- .github/workflows/renovate-config.yml | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/renovate-config.yml diff --git a/.github/workflows/renovate-config.yml b/.github/workflows/renovate-config.yml new file mode 100644 index 0000000..86ffc8d --- /dev/null +++ b/.github/workflows/renovate-config.yml @@ -0,0 +1,43 @@ +# THIS FILE'S LICENSE: +# Copyright 2020 WhiteSource Ltd + +# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +concurrency: + cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} +jobs: + preset: + container: + image: ghcr.io/renovatebot/renovate:42.1.3 + # github hosted runners are running as `1001:127` (ubuntu:docker) + options: -u 1001:0 --group-add 1000 --group-add 12021 --group-add 127 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + show-progress: false + - name: testing ${{ matrix.file }} + run: | + if [ -e ${{ matrix.file }}.json ]; then + renovate-config-validator ${{ matrix.file }}.json + fi + strategy: + matrix: + file: + - .github/renovate + - default + timeout-minutes: 10 +name: renovate-config +on: + pull_request: + paths: + - .github/renovate.json + - .github/workflows/renovate-config.yml + - default.json +permissions: + contents: read From f7d04e2a9687d43c484ade1260940770cc799349 Mon Sep 17 00:00:00 2001 From: John Ko <279736+johnko@users.noreply.github.com> Date: Sun, 8 Feb 2026 06:11:42 -0500 Subject: [PATCH 11/12] Add .github/CODEOWNERS --- .github/CODEOWNERS | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..2b78a90 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,7 @@ +# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#example-of-a-codeowners-file +# This is a comment. +# Each line is a file pattern followed by one or more owners. + +# These owners will be the default owners for everything in +# the repo. +* @johnko From 9c353c921c4e40fe8e05dac29c3d967bc7b8acf8 Mon Sep 17 00:00:00 2001 From: John Ko <279736+johnko@users.noreply.github.com> Date: Sun, 8 Feb 2026 06:11:50 -0500 Subject: [PATCH 12/12] Add .github/shfmt.sh --- .github/shfmt.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/shfmt.sh diff --git a/.github/shfmt.sh b/.github/shfmt.sh new file mode 100644 index 0000000..2f3b2d3 --- /dev/null +++ b/.github/shfmt.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +set -exo pipefail + +# when running in CI and shfmt doesn't exist, install it +if [[ "true" == "$CI" ]]; then + if ! type shfmt &>/dev/null; then + SUDO='' + if type sudo &>/dev/null; then + SUDO=sudo + fi + if type brew &>/dev/null; then + brew install shfmt + elif type snap &>/dev/null; then + INSTALL_COMMAND="snap install shfmt" + # shellcheck disable=SC2086 + $INSTALL_COMMAND || $SUDO $INSTALL_COMMAND + elif type go &>/dev/null; then + if [[ ! -d "$HOME/bin" ]]; then + mkdir -p "$HOME/bin" + fi + export GOBIN="$HOME/bin" + export PATH="$GOBIN:$PATH" + go install mvdan.cc/sh/v3/cmd/shfmt@v3.11.0 + ls -l "$GOBIN/shfmt" + elif type apt &>/dev/null; then + SUDO='' + if type sudo &>/dev/null; then + SUDO=sudo + fi + INSTALL_COMMAND="apt install --yes shfmt" + # shellcheck disable=SC2086 + $INSTALL_COMMAND || $SUDO $INSTALL_COMMAND + fi + fi +fi +set -u + +shfmt --version + +# Diff with +shfmt --diff --simplify --indent 2 --case-indent ./ +find . -type f -name '*.envrc' -print0 | xargs -0 --max-procs=2 --verbose -I{} shfmt --diff --simplify --indent 2 --case-indent {} + +# Fix with +# shfmt --write --simplify --indent 2 --case-indent ./ +# find . -type f -name '*.envrc' -print0 | xargs -0 --max-procs=2 --verbose -I{} shfmt --write --simplify --indent 2 --case-indent {} +# bash -ex ./.github/git-has-uncommited-changes.sh