Skip to content

Commit d9e61fa

Browse files
committed
ci: Convert Helm chart packaging/publishing to buildkite
1 parent 45e80f5 commit d9e61fa

File tree

4 files changed

+97
-152
lines changed

4 files changed

+97
-152
lines changed

.github/workflows/helm_release.yaml

-152
This file was deleted.

ci/builder/Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,12 @@ RUN curl -fsSL https://releases.hashicorp.com/terraform/1.9.8/terraform_1.9.8_li
382382
&& chmod +x /usr/local/bin/terraform \
383383
&& rm terraform.zip
384384

385+
RUN curl -fsSL https://github.com/mikefarah/yq/releases/download/v4.45.1/yq_linux_$ARCH_GO.zip > yq \
386+
&& if [ $ARCH_GO = amd64 ]; then echo '654d2943ca1d3be2024089eb4f270f4070f491a0610481d128509b2834870049 yq' | sha256sum --check; fi \
387+
&& if [ $ARCH_GO = arm64 ]; then echo 'ceea73d4c86f2e5c91926ee0639157121f5360da42beeb8357783d79c2cc6a1d yq' | sha256sum --check; fi \
388+
&& chmod +x yq \
389+
&& mv yq /usr/local/bin
390+
385391
# Hardcode some known SSH hosts, or else SSH will ask whether the host is
386392
# trustworthy on the first connection.
387393

ci/test/pipeline.template.yml

+14
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,20 @@ steps:
158158
- exit_status: 1
159159
limit: 2
160160

161+
- id: helm-charts-publish
162+
label: Publish Helm Charts
163+
command: bin/ci-builder run stable misc/helm-charts/publish.sh
164+
timeout_in_minutes: 10
165+
inputs:
166+
- "*"
167+
depends_on: []
168+
agents:
169+
queue: linux-aarch64-small
170+
# TODO: Uncomment before merging
171+
#branches: main
172+
coverage: skip
173+
sanitizer: skip
174+
161175
- group: Lints
162176
key: lints
163177
steps:

misc/helm-charts/publish.sh

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/bash
2+
3+
# Copyright Materialize, Inc. and contributors. All rights reserved.
4+
#
5+
# Use of this software is governed by the Business Source License
6+
# included in the LICENSE file at the root of this repository.
7+
#
8+
# As of the Change Date specified in that file, in accordance with
9+
# the Business Source License, use of this software will be governed
10+
# by the Apache License, Version 2.0.
11+
12+
set -euo pipefail
13+
14+
. misc/shlib/shlib.bash
15+
16+
CHARTS_DIR=misc/helm-charts
17+
# TODO: Switch back to gh-pages before merging
18+
# GITHUB_PAGES_BRANCH=gh-pages
19+
GITHUB_PAGES_BRANCH=gh-pages-test
20+
RELEASE_DIR=.cr-release-packages
21+
22+
# Find directories containing Chart.yaml
23+
CHARTS=""
24+
for dir in "$CHARTS_DIR"/*/; do
25+
if [ -f "${dir}Chart.yaml" ]; then
26+
chart_name=$(basename "$dir")
27+
CHARTS="${CHARTS:+${CHARTS} }$chart_name"
28+
fi
29+
done
30+
if [ -z "$CHARTS" ]; then
31+
echo "No valid Helm charts found"
32+
exit 0
33+
fi
34+
echo "Found valid charts: $CHARTS"
35+
36+
git fetch origin
37+
git checkout $GITHUB_PAGES_BRANCH
38+
39+
mkdir -p $RELEASE_DIR
40+
CHANGES_MADE=0
41+
for CHART in $CHARTS; do
42+
CHART_PATH="$CHARTS_DIR/$CHART"
43+
VERSION=$(yq eval '.version' "$CHART_PATH"/Chart.yaml)
44+
echo "Processing chart: $CHART version: $VERSION"
45+
# Check if version already exists
46+
if [ -f "gh-pages/$CHART-$VERSION.tgz" ]; then
47+
echo "Chart $CHART version $VERSION already exists, skipping"
48+
continue
49+
fi
50+
# Lint chart
51+
if ! helm lint "$CHART_PATH"; then
52+
echo "Linting failed for $CHART"
53+
exit 1
54+
fi
55+
# Package chart
56+
helm package "$CHART_PATH" --destination $RELEASE_DIR
57+
CHANGES_MADE=1
58+
done
59+
# Only proceed if we have new packages
60+
if [ $CHANGES_MADE -eq 1 ]; then
61+
# Copy new charts to gh-pages
62+
cp $RELEASE_DIR/*.tgz gh-pages/
63+
# Update the repository index
64+
cd gh-pages
65+
REPO_URL="https://materialize.github.io/materialize"
66+
if [ -f index.yaml ]; then
67+
helm repo index . --url "$REPO_URL" --merge index.yaml
68+
else
69+
helm repo index . --url "$REPO_URL"
70+
fi
71+
# Commit and push changes
72+
git add .
73+
git commit -m "helm-charts: publish updated charts"
74+
git push origin $GITHUB_PAGES_BRANCH
75+
else
76+
echo "No new chart versions to publish"
77+
fi

0 commit comments

Comments
 (0)