Skip to content

Commit 132c1ac

Browse files
committed
add validate and secrets workflows
1 parent 127178d commit 132c1ac

5 files changed

Lines changed: 174 additions & 0 deletions

File tree

.github/workflows/secrets.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: secrets
2+
3+
# Server-side complement to the gitleaks pre-commit hook in .pre-commit-config.yaml.
4+
#
5+
# Why both:
6+
# - Pre-commit runs locally and is bypassable (`git commit --no-verify`),
7+
# skippable (if `pre-commit install` was never run), and doesn't fire for
8+
# commits authored via the GitHub web UI, mobile app, or REST API.
9+
# - This workflow runs in CI on every PR + push, can be enforced via branch
10+
# protection ("required check"), and is the last line before merge.
11+
#
12+
# Both use the same gitleaks engine, so detection rules are consistent.
13+
14+
on:
15+
push:
16+
branches: [main]
17+
pull_request:
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
gitleaks:
24+
name: gitleaks
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
# Fetch the full history so gitleaks can scan all commits in the PR,
30+
# not just the tip. Catches secrets that were committed and then
31+
# "deleted" (still in history) without being rotated.
32+
fetch-depth: 0
33+
34+
- uses: gitleaks/gitleaks-action@v2
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
# GITLEAKS_LICENSE is required only for org-owned private repos.
38+
# This repo is public, so the license check is skipped automatically.

.github/workflows/validate.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: validate
2+
3+
# Pre-merge validation: yamllint, kustomize rendering, kubeconform, shellcheck.
4+
# Calls the same script developers can run locally — see ci/validate.sh and
5+
# the README "Optional, for running CI checks locally" line in Prerequisites.
6+
7+
on:
8+
push:
9+
branches: [main]
10+
pull_request:
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
validate:
17+
name: validate
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.x'
25+
- run: pip install --quiet yamllint
26+
27+
- name: Install kustomize
28+
run: |
29+
curl -sfL "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
30+
sudo mv kustomize /usr/local/bin/
31+
32+
# helm is required for kustomize's `--enable-helm` flag (renders the
33+
# helmCharts: block in manifests/quine-enterprise/).
34+
- uses: azure/setup-helm@v4
35+
with:
36+
version: v3.16.0
37+
38+
- name: Install kubeconform
39+
run: |
40+
curl -sfL "https://github.com/yannh/kubeconform/releases/latest/download/kubeconform-linux-amd64.tar.gz" \
41+
| sudo tar -xz -C /usr/local/bin kubeconform
42+
43+
# shellcheck is pre-installed on ubuntu-latest runners.
44+
45+
- name: Run validation
46+
run: ./ci/validate.sh

.yamllint.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# yamllint config — relaxed preset, with rules tuned for this repo.
2+
#
3+
# We disable line-length because Kustomize patches, Helm values, and operator
4+
# CRs commonly carry long URLs or composite identifiers. We disable
5+
# `truthy.check-keys` because Kubernetes manifests use `on:` (workflow trigger)
6+
# and similar field names that yamllint would otherwise flag.
7+
#
8+
# What still fires (and should):
9+
# - syntax errors
10+
# - duplicate keys
11+
# - inconsistent indentation
12+
# - trailing whitespace
13+
# - missing document start where required by surrounding context
14+
15+
extends: relaxed
16+
17+
rules:
18+
line-length: disable
19+
truthy:
20+
check-keys: false
21+
22+
ignore: |
23+
charts/
24+
**/charts/
25+
tmp/
26+
temp/
27+
.pre-commit-cache/

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ export THATDOT_REGISTRY_USERNAME="..."
1717
export THATDOT_REGISTRY_PASSWORD="..."
1818
```
1919

20+
Optional — for reproducing the CI validation checks locally before pushing (`./ci/validate.sh` runs the same checks `.github/workflows/validate.yml` runs):
21+
22+
```bash
23+
brew install yamllint shellcheck kustomize helm kubeconform
24+
```
25+
2026
## First-time setup
2127

2228
```bash

ci/validate.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
set -uo pipefail
3+
4+
# Validates the manifest tree, Kustomize rendering, and helper scripts.
5+
# Same checks the .github/workflows/validate.yml workflow runs — install the
6+
# tools locally and you can reproduce CI before pushing.
7+
#
8+
# Tools required:
9+
# yamllint, shellcheck, kustomize, helm, kubeconform
10+
#
11+
# macOS install:
12+
# brew install yamllint shellcheck kustomize helm kubeconform
13+
#
14+
# Usage: ./ci/validate.sh
15+
16+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
17+
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
18+
cd "$PROJECT_DIR" || exit 1
19+
20+
# ---- Tool check ----
21+
missing=()
22+
for tool in yamllint shellcheck kustomize helm kubeconform; do
23+
command -v "$tool" >/dev/null 2>&1 || missing+=("$tool")
24+
done
25+
if [[ ${#missing[@]} -gt 0 ]]; then
26+
echo "ERROR: missing required tools: ${missing[*]}"
27+
echo " macOS install: brew install ${missing[*]}"
28+
exit 1
29+
fi
30+
31+
# Run all checks, collecting failures rather than aborting on the first one —
32+
# so the developer sees the full picture in a single run.
33+
failed=()
34+
35+
echo "==> yamllint"
36+
yamllint . || failed+=("yamllint")
37+
38+
echo ""
39+
echo "==> shellcheck scripts/*.sh ci/*.sh"
40+
shellcheck scripts/*.sh ci/*.sh || failed+=("shellcheck")
41+
42+
echo ""
43+
echo "==> kustomize + kubeconform per leaf"
44+
for leaf in manifests/root manifests/platform manifests/product manifests/cassandra manifests/keycloak manifests/quine-enterprise; do
45+
echo " --- $leaf ---"
46+
if ! kustomize build --enable-helm "$leaf" \
47+
| kubeconform --strict --ignore-missing-schemas --summary; then
48+
failed+=("$leaf")
49+
fi
50+
done
51+
52+
echo ""
53+
if [[ ${#failed[@]} -gt 0 ]]; then
54+
echo "FAILED: ${failed[*]}"
55+
exit 1
56+
fi
57+
echo "All checks passed."

0 commit comments

Comments
 (0)