Skip to content

Commit 52c73e5

Browse files
author
osmo-devops
committed
fix: simplify helm.yaml — use GITHUB_OUTPUT file directly
Previous meta step used bash variable capture inside a pipe block which silently failed to set GITHUB_OUTPUT vars, causing empty artifact names downstream. New approach: python3 script writes directly to $GITHUB_OUTPUT using the file-append pattern. Clean, reliable, no shell escaping issues.
1 parent 6f09abd commit 52c73e5

File tree

1 file changed

+36
-43
lines changed

1 file changed

+36
-43
lines changed

.github/workflows/helm.yaml

Lines changed: 36 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ env:
2020
OCI_REGISTRY: ghcr.io
2121

2222
jobs:
23-
# Lint
2423
lint:
2524
name: Lint Helm chart
2625
runs-on: ubuntu-latest
@@ -32,16 +31,13 @@ jobs:
3231
with:
3332
version: v3.17.0
3433

35-
- name: Add Bitnami repo
36-
run: |
37-
helm repo add bitnami https://charts.bitnami.com/bitnami --force-update
38-
helm repo update
39-
4034
- name: Helm lint
4135
run: |
42-
helm lint --strict --set profile=full --set tempo.image=ghcr.io/tempoxyz/tempo:1.4.1 ./helm
36+
helm lint --strict \
37+
--set profile=full \
38+
--set tempo.image=ghcr.io/tempoxyz/tempo:1.4.1 \
39+
./helm
4340
44-
# Validate (dry-run install)
4541
validate:
4642
name: Validate Kubernetes install (dry-run)
4743
runs-on: ubuntu-latest
@@ -56,8 +52,7 @@ jobs:
5652
- name: Create genesis placeholder
5753
run: |
5854
mkdir -p consensus
59-
echo '{"config":{},"genesis_time":"","nonce":"0x0000000000000000","extradata":"","alloc":{},"number":"0","gas_limit":"0","difficulty":"0"}' \
60-
> consensus/genesis.json
55+
echo '{"config":{},"genesis_time":"","nonce":"0x0","extradata":"","alloc":{},"number":"0","gas_limit":"0","difficulty":"0"}' > consensus/genesis.json
6156
6257
- name: Helm dry-run (consensus profile)
6358
run: |
@@ -70,7 +65,7 @@ jobs:
7065
--set rpc.count=1 \
7166
--set faucet.enabled=true \
7267
--set monitoring.enabled=false \
73-
--debug --dry-run=server 2>&1 | head -200
68+
--dry-run=server 2>&1 | head -100
7469
7570
- name: Helm dry-run (full profile)
7671
run: |
@@ -82,16 +77,15 @@ jobs:
8277
--set validators.count=4 \
8378
--set rpc.count=2 \
8479
--set monitoring.enabled=true \
85-
--debug --dry-run=server 2>&1 | head -200
80+
--dry-run=server 2>&1 | head -100
8681
87-
# Package
8882
package:
8983
name: Package Helm chart
9084
runs-on: ubuntu-latest
9185
needs: [lint, validate]
9286
outputs:
93-
chart_version: ${{ steps.meta.outputs.version }}
94-
chart_basename: ${{ steps.meta.outputs.basename }}
87+
version: ${{ steps.meta.outputs.version }}
88+
filename: ${{ steps.meta.outputs.filename }}
9589
steps:
9690
- uses: actions/checkout@v4
9791

@@ -100,17 +94,24 @@ jobs:
10094
with:
10195
version: v3.17.0
10296

103-
- name: Copy genesis placeholder into chart
104-
run: |
105-
mkdir -p consensus
106-
echo '{"config":{},"genesis_time":"","nonce":"0x0000000000000000","extradata":"","alloc":{},"number":"0","gas_limit":"0","difficulty":"0"}' \
107-
> consensus/genesis.json
97+
- name: Create genesis placeholder
98+
run: mkdir -p consensus && echo '{"config":{},"genesis_time":"","nonce":"0x0","extradata":"","alloc":{},"number":"0","gas_limit":"0","difficulty":"0"}' > consensus/genesis.json
10899

109-
- id: meta
100+
- name: Extract chart version
101+
id: meta
110102
run: |
111-
VERSION=$(grep '^version:' helm/Chart.yaml | awk '{print $2}')
112-
echo "version=${VERSION}" >> $GITHUB_OUTPUT
113-
echo "basename=tempo-monitor-${VERSION}.tgz" >> $GITHUB_OUTPUT
103+
python3 -c "
104+
import yaml, os
105+
with open('./helm/Chart.yaml') as f:
106+
doc = yaml.safe_load(f)
107+
v = doc['version']
108+
fname = 'tempo-monitor-' + v + '.tgz'
109+
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
110+
f.write(f'version={v}\n')
111+
f.write(f'filename={fname}\n')
112+
print(f'Chart version: {v}')
113+
print(f'Package filename: {fname}')
114+
"
114115
115116
- name: Helm package
116117
run: |
@@ -120,11 +121,10 @@ jobs:
120121
- name: Upload chart artifact
121122
uses: actions/upload-artifact@v4
122123
with:
123-
name: ${{ steps.meta.outputs.chart_basename }}
124-
path: /tmp/helm-charts/${{ steps.meta.outputs.chart_basename }}
124+
name: ${{ steps.meta.outputs.filename }}
125+
path: /tmp/helm-charts/${{ steps.meta.outputs.filename }}
125126
retention-days: 5
126127

127-
# Publish to GHCR (on main / release only)
128128
publish:
129129
name: Publish Helm chart to GHCR
130130
runs-on: ubuntu-latest
@@ -154,30 +154,23 @@ jobs:
154154
- name: Download chart artifact
155155
uses: actions/download-artifact@v4
156156
with:
157-
name: ${{ needs.package.outputs.chart_basename }}
157+
name: ${{ needs.package.outputs.filename }}
158158
path: /tmp/helm-charts/
159159

160160
- name: Push chart to GHCR
161-
env:
162-
HELM_EXPERIMENTAL_OCI: 1
163161
run: |
164162
CHART_REF="${{ env.OCI_REGISTRY }}/${{ github.repository_owner }}/${{ env.CHART_NAME }}"
165-
VERSION="${{ needs.package.outputs.chart_version }}"
166-
FILE="${{ needs.package.outputs.chart_basename }}"
167-
168-
helm chart save /tmp/helm-charts/${FILE} ${CHART_REF}:${VERSION}
169-
helm chart push ${CHART_REF}:${VERSION}
170-
helm chart save /tmp/helm-charts/${FILE} ${CHART_REF}:latest
171-
helm chart push ${CHART_REF}:latest
163+
FILE="/tmp/helm-charts/${{ needs.package.outputs.filename }}"
164+
helm chart save "${FILE}" "${CHART_REF}:${{ needs.package.outputs.version }}"
165+
helm chart push "${CHART_REF}:${{ needs.package.outputs.version }}"
166+
helm chart save "${FILE}" "${CHART_REF}:latest"
167+
helm chart push "${CHART_REF}:latest"
172168
173169
- name: Show published tags
174170
run: |
175-
CHART_REF="${{ env.OCI_REGISTRY }}/${{ github.repository_owner }}/${{ env.CHART_NAME }}"
176-
VERSION="${{ needs.package.outputs.chart_version }}"
177-
echo "Published: ${CHART_REF}:${VERSION}"
178-
echo "Published: ${CHART_REF}:latest"
171+
echo "Published: ${{ env.OCI_REGISTRY }}/${{ github.repository_owner }}/${{ env.CHART_NAME }}:${{ needs.package.outputs.version }}"
172+
echo "Published: ${{ env.OCI_REGISTRY }}/${{ github.repository_owner }}/${{ env.CHART_NAME }}:latest"
179173
180-
# SLSA provenance
181174
provenance:
182175
name: Generate SLSA provenance
183176
runs-on: ubuntu-latest
@@ -193,7 +186,7 @@ jobs:
193186
- name: Download chart artifact
194187
uses: actions/download-artifact@v4
195188
with:
196-
name: ${{ needs.package.outputs.chart_basename }}
189+
name: ${{ needs.package.outputs.filename }}
197190
path: /tmp/
198191

199192
- name: Generate SLSA provenance

0 commit comments

Comments
 (0)