Skip to content
Closed
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
83 changes: 83 additions & 0 deletions .github/workflows/helm-template-smoke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Helm Template Smoke

on:
pull_request:
branches: [ main ]
paths:
- 'internal/embed/infrastructure/**'
- '.github/workflows/helm-template-smoke.yml'
push:
branches: [ main ]
paths:
- 'internal/embed/infrastructure/**'
- '.github/workflows/helm-template-smoke.yml'

jobs:
helm-template-smoke:
name: helm template embedded chart
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Set up Helm
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1
with:
version: v3.20.1 # match obolup.sh pinned version

- name: helm template ./base
run: |
# Render the embedded `base` chart and fail on Go-template parse
# errors. Catches bugs like the unescaped `{{ $labels }}` in
# PrometheusRule annotations that broke `helm upgrade base` on
# every `obol stack up` (see PR #527). `go test ./...` does not
# exercise Helm rendering, so this is the only pre-merge gate
# for chart parse errors.
#
# The base chart contains `{{PLACEHOLDER}}` strings (e.g.
# `{{OLLAMA_HOST_IP}}`, `{{CLUSTER_ID}}`) that are substituted
# by `internal/defaults/defaults.go::InfrastructureReplacements`
# before helmfile runs. Helm's Go-template parser would treat
# them as actions and fail, so we substitute stub values into
# a working copy first — mirroring what `obol stack init` does.
set -euo pipefail
workdir="$(mktemp -d)"
cp -R internal/embed/infrastructure/base "$workdir/base"
# Mirror internal/defaults InfrastructureReplacements with CI stubs.
find "$workdir/base" -type f -name '*.yaml' -print0 \
| xargs -0 sed -i \
-e 's/{{OLLAMA_HOST_IP}}/127.0.0.1/g' \
-e 's/{{OLLAMA_HOST}}/localhost/g' \
-e 's/{{CLUSTER_ID}}/ci-helm-smoke/g'
# Match values passed by helmfile.yaml `releases[base]`.
helm template base "$workdir/base" \
--set dataDir=/data \
--set network=mainnet \
> /dev/null

- name: helm template ./cloudflared
run: |
# The cloudflared chart has no placeholder substitution and uses
# default values from values.yaml.
set -euo pipefail
helm template cloudflared internal/embed/infrastructure/cloudflared \
> /dev/null

- name: helm lint ./base
run: |
set -euo pipefail
workdir="$(mktemp -d)"
cp -R internal/embed/infrastructure/base "$workdir/base"
find "$workdir/base" -type f -name '*.yaml' -print0 \
| xargs -0 sed -i \
-e 's/{{OLLAMA_HOST_IP}}/127.0.0.1/g' \
-e 's/{{OLLAMA_HOST}}/localhost/g' \
-e 's/{{CLUSTER_ID}}/ci-helm-smoke/g'
helm lint "$workdir/base" \
--set dataDir=/data \
--set network=mainnet

- name: helm lint ./cloudflared
run: |
set -euo pipefail
helm lint internal/embed/infrastructure/cloudflared

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Comment on lines +17 to +83
Loading