Repository navigation
707 lines (645 loc) · 31.7 KB
/
Copy pathrelease.yml
File metadata and controls
707 lines (645 loc) · 31.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
name: Release
on:
push:
tags:
- 'v*'
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC
workflow_dispatch:
inputs:
docs_tag:
description: 'Regenerate and attach the reference docs asset for this existing release tag (for example v4.113.0), and skip the snapshot build'
required: false
default: ''
jobs:
goreleaser:
if: github.event_name != 'workflow_dispatch' || inputs.docs_tag == ''
runs-on: ubuntu-latest-32
permissions:
id-token: write
contents: write
strategy:
fail-fast: false
matrix:
variant:
- connect-ai
- connect-cgo
- connect-cloud
- connect-fips
- connect-lambda
- connect
steps:
- name: Check Out Repo
uses: actions/checkout@v6.1.0
- name: Configure AWS credentials for access to AWS Secrets Manager
uses: aws-actions/configure-aws-credentials@v6.2.4
with:
aws-region: ${{ vars.RP_AWS_CRED_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.RP_AWS_CRED_ACCOUNT_ID }}:role/${{ vars.RP_AWS_CRED_BASE_ROLE_NAME }}${{ github.event.repository.name }}
- name: Get secrets from AWS Secrets Manager
uses: aws-actions/aws-secretsmanager-get-secrets@v3.0.2
with:
secret-ids: |
,sdlc/prod/github/dockerhub
,sdlc/prod/github/rpm_signing_key
parse-json-secrets: true
- name: Configure AWS credentials for access to Amazon ECR Public
uses: aws-actions/configure-aws-credentials@v6.2.4
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::${{ secrets.RP_AWS_CRED_ACCOUNT_ID }}:role/${{ vars.RP_AWS_CRED_BASE_ROLE_NAME }}${{ github.event.repository.name }}
- name: Login to Amazon ECR Public
uses: aws-actions/amazon-ecr-login@v2.1.7
with:
registry-type: public
- name: Install Go
uses: actions/setup-go@v6.5.0
with:
go-version-file: 'go.mod'
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libzmq3-dev patchelf
- name: Install Microsoft Go
if: ${{ matrix.variant == 'connect-fips' }}
run: |
GO_VERSION=$(go version | cut -d' ' -f3 | cut -d'.' -f1,2)
curl -sSLf -o "$RUNNER_TEMP/msgo.tgz" https://aka.ms/golang/release/latest/${GO_VERSION}.linux-amd64.tar.gz
[[ -d "$RUNNER_TEMP/bin" ]] || install -d -m 0755 "$RUNNER_TEMP/bin"
[[ -d "$RUNNER_TEMP/microsoft" ]] || install -d -m 0755 "$RUNNER_TEMP/microsoft"
tar -C "$RUNNER_TEMP/microsoft" -xf "$RUNNER_TEMP/msgo.tgz"
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
- name: Release Notes
run: ./resources/scripts/release_notes.sh > ./release_notes.md
- name: Authenticate to GCP
if: ${{ github.event_name == 'push' }}
uses: google-github-actions/auth@v3.0.0
with:
workload_identity_provider: projects/606234194099/locations/global/workloadIdentityPools/rp-cicd/providers/gh-connect
service_account: gh-connect@devprod-cicd-infra.iam.gserviceaccount.com
- name: Set up gcloud CLI
if: ${{ github.event_name == 'push' }}
uses: google-github-actions/setup-gcloud@v3.0.1
- name: Exclude GCP credentials from git state
if: ${{ github.event_name == 'push' }}
run: echo 'gha-creds-*.json' >> .git/info/exclude
- name: Login to Docker Hub
uses: docker/login-action@v4.8.0
with:
username: ${{ env.DOCKERHUB_USER }}
password: ${{ env.DOCKERHUB_TOKEN }}
- name: Setup Buildx
uses: docker/setup-buildx-action@v4.4.1
- name: Setup Task
uses: $/.github/actions/setup-task
- name: Initialize Docker buildx with docker-container driver
run: task docker:init
- name: Write telemetry private key
env:
CONNECT_TELEMETRY_PRIV_KEY: ${{ secrets.TELEMETRY_PRIVATE_KEY }}
run: |
git update-index --skip-worktree ./internal/telemetry/key.pem
echo "$CONNECT_TELEMETRY_PRIV_KEY" > ./internal/telemetry/key.pem
- name: Write RPM signing key to temp file for goreleaser
if: ${{ matrix.variant == 'connect' || matrix.variant == 'connect-fips' }}
run: |
tmpkey=$(mktemp --suffix=.asc)
printf '%s\n' "$RPM_SIGNING_KEY_PRIVATE" > "$tmpkey"
echo "RPM_KEY_FILE_PRIVATE=$tmpkey" >> "$GITHUB_ENV"
- name: GoReleaser Release
if: ${{ github.event_name == 'push' }}
uses: goreleaser/goreleaser-action@v7.3.0
with:
args: release --release-notes=./release_notes.md --timeout 120m --config ./.goreleaser/${{ matrix.variant }}.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload rpk connect plugin to S3
if: ${{ github.event_name == 'push' && (matrix.variant == 'connect' || matrix.variant == 'connect-fips') }}
uses: $/.github/actions/upload_managed_plugin
with:
aws_region: "us-west-2"
aws_s3_bucket: "rpk-plugins-repo"
project_root_dir: ${{ github.workspace }}
artifacts_file: ${{ github.workspace }}/target/dist/artifacts.json
metadata_file: ${{ github.workspace }}/target/dist/metadata.json
plugin_name: ${{ matrix.variant }}
goos: ${{ matrix.variant == 'connect' && 'linux,darwin' || 'linux' }}
goarch: ${{ matrix.variant == 'connect' && 'amd64,arm64' || 'amd64' }}
repo_hostname: rpk-plugins.redpanda.com
dry_run: false
- name: Disable checksums for Edge build
if: ${{ github.event_name == 'schedule' }}
run: |
yq eval '.checksum.disable = true' -i .goreleaser/${{ matrix.variant }}.yaml
- name: GoReleaser Edge
if: ${{ github.event_name == 'schedule' }}
uses: goreleaser/goreleaser-action@v7.3.0
with:
args: release --timeout 120m --snapshot --skip archive,nfpm --config ./.goreleaser/${{ matrix.variant }}.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: GoReleaser Edge push docker
if: ${{ github.event_name == 'schedule' && (matrix.variant == 'connect' || matrix.variant == 'connect-ai' || matrix.variant == 'connect-cloud') }}
run: |
IMAGE_BASE=${{ fromJSON('{"connect":"redpandadata/connect:edge","connect-ai":"redpandadata/connect:edge-ai","connect-cloud":"redpandadata/connect:edge-cloud"}')[matrix.variant] }}
docker push ${IMAGE_BASE}-amd64
docker push ${IMAGE_BASE}-arm64
docker buildx imagetools create -t ${IMAGE_BASE} ${IMAGE_BASE}-amd64 ${IMAGE_BASE}-arm64
- name: GoReleaser Test
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: goreleaser/goreleaser-action@v7.3.0
with:
args: release --timeout 120m --snapshot --skip publish --config ./.goreleaser/${{ matrix.variant }}.yaml
- name: Scan docker images for vulnerabilities
if: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && (matrix.variant == 'connect' || matrix.variant == 'connect-cloud') }}
uses: aquasecurity/trivy-action@v0.36.0
with:
image-ref: ${{ fromJSON('{"connect":"redpandadata/connect:edge","connect-ai":"redpandadata/connect:edge-ai","connect-cloud":"redpandadata/connect:edge-cloud"}')[matrix.variant] }}
format: table
ignore-unfixed: true
exit-code: 1
# Attaches the generated reference docs to the release. On a tag push it runs
# after goreleaser publishes the release. To regenerate the asset for an
# existing release, run this workflow with the docs_tag input.
docs-generate:
runs-on: ubuntu-latest
needs: goreleaser
if: >-
!cancelled() && (
(github.event_name == 'push' && needs.goreleaser.result == 'success') ||
(github.event_name == 'workflow_dispatch' && inputs.docs_tag != '')
)
permissions:
contents: read
env:
DOCS_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.docs_tag || github.ref_name }}
steps:
- uses: actions/checkout@v6.1.0
with:
ref: refs/tags/${{ env.DOCS_TAG }}
- uses: actions/setup-go@v6.5.0
with:
go-version-file: 'go.mod'
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libzmq3-dev
# -version also writes the connector data the Bloblang playground and
# other site tools read, attachments/connect-<version>.json. The date is
# the tag commit's, in UTC, so a rerun writes the same file. A tag whose
# docs_gen predates the flag (a docs_tag rerun of an older release) gets
# the partials only. The flag list comes from the built generator's -h
# output, which every docs_gen that writes partials prints with -dir, so
# output without -dir means the probe failed rather than that the flag
# is missing.
- name: Generate the reference docs
id: generate
run: |
set -euo pipefail
args=()
rc=0
usage=$(CGO_ENABLED=1 go run -tags x_benthos_extra ./cmd/tools/docs_gen -h 2>&1) || rc=$?
if [ "$rc" -ne 0 ] || ! grep -qE '^ +-dir( |$)' <<< "$usage"; then
echo "$usage"
echo "::error::Couldn't read the flags of docs_gen at $DOCS_TAG (exit code $rc), so can't tell whether it writes the connector data."
exit 1
fi
if grep -qE '^ +-version( |$)' <<< "$usage"; then
date=$(TZ=UTC git log -1 --format=%cd --date=format-local:%Y-%m-%dT%H:%M:%SZ)
args=(-version "${DOCS_TAG#v}" -date "$date")
echo "connect_json=true" >> "$GITHUB_OUTPUT"
else
echo "::notice::docs_gen at $DOCS_TAG has no -version flag, so the docs asset has no connector data."
fi
CGO_ENABLED=1 go run -tags x_benthos_extra ./cmd/tools/docs_gen "${args[@]}"
# Releases from before the generator wrote partials produce full pages
# instead. Their asset must stay missing, so the docs build falls back
# to a release that has real partials.
- name: Check the layout of the generated docs
env:
CONNECT_JSON: ${{ steps.generate.outputs.connect_json }}
run: |
set -euo pipefail
c=docs/modules/components
if [ -d "$c/pages" ]; then
echo "::error::$DOCS_TAG predates the generated partials (docs_gen wrote $c/pages), so it gets no docs asset."
exit 1
fi
json="$c/attachments/connect-${DOCS_TAG#v}.json"
if [ "${CONNECT_JSON:-}" = true ] && ! jq -e '.version and (.inputs | length > 0) and (.["bloblang-functions"] | length > 0)' "$json" > /dev/null; then
echo "::error::The generated docs have no valid connector data at $json."
exit 1
fi
for d in partials/fields partials/descriptions partials/availability examples/common examples/advanced; do
if [ -z "$(find "$c/$d" -type f -name '*.*' 2>/dev/null | head -1)" ]; then
echo "::error::The generated docs have no files in $c/$d."
exit 1
fi
done
- name: Upload the generated docs
uses: actions/upload-artifact@v4.6.2
with:
name: connect-docs-release
path: docs/modules
retention-days: 30
# The docs site publishes the asset of the latest release, so a release
# whose generated docs break the docs build must not get one: the site
# then keeps the previous release's asset. Rerun this job, or the release
# workflow with docs_tag, after fixing the docs.
docs-check:
needs: docs-generate
if: ${{ !cancelled() && needs.docs-generate.result == 'success' }}
permissions:
contents: read
id-token: write
statuses: write
pull-requests: write
uses: redpanda-data/docs-extensions-and-macros/.github/workflows/connect-docs-check.yml@560c4301d2f98c2e5e158daa70fa2d3760859bda # v5.55.0
with:
docs_artifact: connect-docs-release
aws_region: ${{ vars.RP_AWS_CRED_REGION }}
aws_role_name_prefix: ${{ vars.RP_AWS_CRED_BASE_ROLE_NAME }}
secrets:
aws_cred_account_id: ${{ secrets.RP_AWS_CRED_ACCOUNT_ID }}
docs-asset:
runs-on: ubuntu-latest
needs: [docs-generate, docs-check]
if: ${{ !cancelled() && needs.docs-check.result == 'success' }}
permissions:
contents: write
env:
DOCS_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.docs_tag || github.ref_name }}
steps:
- name: Download the generated docs
uses: actions/download-artifact@v4.3.0
with:
name: connect-docs-release
path: modules
# The docs site reads the reference partials and examples from this
# asset, so it always matches a released version. See docs/README.md.
- name: Attach the reference docs to the release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
run: |
set -euo pipefail
tar -czf redpanda-connect-docs.tar.gz modules
gh release upload "${DOCS_TAG}" redpanda-connect-docs.tar.gz --clobber
update-bundles:
runs-on: ubuntu-latest
needs: goreleaser
if: github.event_name == 'push' && !contains(github.ref_name, '-rc')
concurrency:
group: release-update-bundles-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
pull-requests: write
outputs:
pr_url: ${{ steps.pr.outputs.url }}
steps:
- uses: actions/checkout@v6.1.0
- uses: actions/setup-go@v6.5.0
with:
go-version-file: 'go.mod'
- name: Update bundles and create PR
id: pr
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./resources/scripts/update_bundles.sh
if git diff --quiet; then
echo "No bundle changes detected"
echo ":package: No bundle changes detected for ${{ github.ref_name }}." >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
BRANCH="update-bundles-${{ github.ref_name }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -B "${BRANCH}"
git add -A
git commit -m "chore: update bundle dependencies for ${{ github.ref_name }}"
# On a re-run the branch already exists; fetch it so --force-with-lease
# has a tracking ref to compare against.
git fetch --depth=1 origin "+refs/heads/${BRANCH}:refs/remotes/origin/${BRANCH}" || true
git push --force-with-lease origin "HEAD:refs/heads/${BRANCH}"
PR_URL=$(gh pr list --head "${BRANCH}" --state open --json url --jq '.[0].url // empty')
if [ -z "${PR_URL}" ]; then
PR_URL=$(gh pr create \
--title "chore: update bundle dependencies for ${{ github.ref_name }}" \
--body "Automated bundle dependency update for release ${{ github.ref_name }}.")
fi
echo "url=${PR_URL}" >> "$GITHUB_OUTPUT"
echo ":package: Update Bundles PR: [${PR_URL##*/}](${PR_URL})" >> "$GITHUB_STEP_SUMMARY"
if ! gh pr merge --auto --rebase "${PR_URL}"; then
echo "::warning::Auto-merge unavailable; merge ${PR_URL} manually"
echo ":warning: Auto-merge could not be enabled; merge [${PR_URL##*/}](${PR_URL}) manually." >> "$GITHUB_STEP_SUMMARY"
fi
update-downstream:
runs-on: ubuntu-latest
needs: goreleaser
if: github.event_name == 'push' && !contains(github.ref_name, '-')
permissions:
id-token: write
contents: read
outputs:
helm_pr_url: ${{ steps.helm.outputs.url }}
operator_pr_url: ${{ steps.operator.outputs.url }}
steps:
- uses: aws-actions/configure-aws-credentials@v6.2.4
with:
aws-region: ${{ vars.RP_AWS_CRED_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.RP_AWS_CRED_ACCOUNT_ID }}:role/${{ vars.RP_AWS_CRED_BASE_ROLE_NAME }}${{ github.event.repository.name }}
- uses: aws-actions/aws-secretsmanager-get-secrets@v3.0.2
with:
secret-ids: |
,sdlc/prod/github/actions_bot_token
parse-json-secrets: true
- name: Trigger docs updates
env:
GH_TOKEN: ${{ env.ACTIONS_BOT_TOKEN }}
run: |
gh api repos/redpanda-data/docs-ui/dispatches -f event_type=update-go-mod
gh api repos/redpanda-data/rp-connect-docs/dispatches -f event_type=generate-rpcn-docs
gh api repos/redpanda-data/rp-connect-docs/dispatches -f event_type=test-cookbook-examples
# Regenerate the rpk connect plugin docs in redpanda-data/docs. The
# docs workflow (update-rpk-plugin-docs.yml) installs this version
# of the plugin from the manifest that goreleaser published above,
# refreshes only the connect subtree of its rpk command snapshot,
# and opens a PR. It reads client_payload.plugin (the rpk command
# name) and client_payload.version (tag without the v prefix, the
# same shape the rpk check and rpk ai senders use).
gh api repos/redpanda-data/docs/dispatches \
-f event_type=update-rpk-plugin-docs \
-f 'client_payload[plugin]=connect' \
-f "client_payload[version]=${GITHUB_REF_NAME#v}"
- name: Update helm chart and create PR
id: helm
env:
GH_TOKEN: ${{ env.ACTIONS_BOT_TOKEN }}
run: |
VERSION="${GITHUB_REF_NAME#v}"
BRANCH="auto/bump-connect"
git clone --depth 1 "https://x-access-token:${ACTIONS_BOT_TOKEN}@github.com/redpanda-data/helm-charts.git" helm-charts
cd helm-charts
CHART="charts/connect/Chart.yaml"
CURRENT=$(yq '.version' "$CHART")
CHART_VERSION="${CURRENT%.*}.$((${CURRENT##*.} + 1))"
yq -i ".version = \"$CHART_VERSION\" | .appVersion = \"$VERSION\"" "$CHART"
sed -Ei "s|connect:[0-9]+\.[0-9]+\.[0-9]+|connect:${VERSION}|" "$CHART"
sed -Ei \
-e "s|Version-[0-9]+\.[0-9]+\.[0-9]+|Version-${CHART_VERSION}|g" \
-e "s|Version: [0-9]+\.[0-9]+\.[0-9]+|Version: ${CHART_VERSION}|g" \
-e "s|AppVersion-[0-9]+\.[0-9]+\.[0-9]+|AppVersion-${VERSION}|g" \
-e "s|AppVersion: [0-9]+\.[0-9]+\.[0-9]+|AppVersion: ${VERSION}|g" \
charts/connect/README.md
git config user.name "vbotbuildovich"
git config user.email "62446873+vbotbuildovich@users.noreply.github.com"
git checkout -B "$BRANCH"
git add charts/connect/
git commit -m "connect: bump version to $VERSION"
git push -f origin "$BRANCH"
BODY=$(printf 'Automated bump of Redpanda Connect to %s.\n\nUpdates:\n- `appVersion` → `%s`\n- Chart `version` → `%s`\n- ArtifactHub image tag → `connect:%s`\n' \
"$VERSION" "$VERSION" "$CHART_VERSION" "$VERSION")
EXISTING_PR=$(gh pr list --repo redpanda-data/helm-charts --head "$BRANCH" --json number,url -q '.[0]')
if [ -n "$EXISTING_PR" ]; then
PR_NUMBER=$(echo "$EXISTING_PR" | jq -r '.number')
PR_URL=$(echo "$EXISTING_PR" | jq -r '.url')
gh pr edit "$PR_NUMBER" --repo redpanda-data/helm-charts \
--title "connect: bump version to $VERSION" \
--body "$BODY"
else
PR_URL=$(gh pr create --repo redpanda-data/helm-charts \
--title "connect: bump version to $VERSION" \
--body "$BODY" \
--base main \
--head "$BRANCH")
fi
echo "url=${PR_URL}" >> "$GITHUB_OUTPUT"
echo ":helm: Update Helm Chart PR: [${PR_URL##*/}](${PR_URL})" >> "$GITHUB_STEP_SUMMARY"
- name: Update operator default image and create PR
id: operator
env:
GH_TOKEN: ${{ env.ACTIONS_BOT_TOKEN }}
# Downstream repository receiving the bump PR; override via the
# OPERATOR_REPO repository variable.
OPERATOR_REPO: ${{ vars.OPERATOR_REPO || 'redpanda-data/operator-enterprise' }}
run: |
VERSION="${GITHUB_REF_NAME#v}"
BRANCH="auto/bump-connect"
git clone --depth 1 "https://x-access-token:${ACTIONS_BOT_TOKEN}@github.com/${OPERATOR_REPO}.git" redpanda-operator
cd redpanda-operator
CONST="operator/api/redpanda/v1alpha2/pipeline_types.go"
CURRENT=$(sed -nE 's|.*PipelineDefaultImage *= *".*connect:([0-9]+\.[0-9]+\.[0-9]+)".*|\1|p' "$CONST")
if [ -z "$CURRENT" ]; then
echo "::error::PipelineDefaultImage not found in $CONST"
exit 1
fi
# A patch release on an older line must not downgrade the default.
if [ "$(printf '%s\n' "$CURRENT" "$VERSION" | sort -V | tail -n1)" = "$CURRENT" ]; then
echo "Operator default Connect image is already $CURRENT, skipping"
exit 0
fi
sed -Ei "s|connect:[0-9]+\.[0-9]+\.[0-9]+|connect:${VERSION}|g" \
"$CONST" \
operator/chart/values.yaml \
operator/internal/controller/pipeline/README.md \
operator/internal/controller/pipeline/testdata/controller-tests.golden.txtar
sed -Ei "/redpandadata\/connect\$/,/tag:/ s|tag: \"[0-9]+\.[0-9]+\.[0-9]+\"|tag: \"${VERSION}\"|" \
operator/chart/values.yaml
# Reuse a bump entry that hasn't shipped in an operator release yet,
# so consecutive bumps produce one changelog line. Main keeps entries
# in unreleased/ after a release branch ships them, so check those too.
RELEASED=$(mktemp)
for REF in $(git ls-remote --heads origin | sed -n 's|.*refs/heads/\(release/.*\)|\1|p'); do
gh api -H 'Accept: application/vnd.github.raw' \
"repos/${OPERATOR_REPO}/contents/operator/CHANGELOG.md?ref=${REF}" >> "$RELEASED"
done
ENTRY=""
for F in $(grep -lF 'Bumped the default Redpanda Connect image' .changes/unreleased/operator-*.yaml 2>/dev/null | sort -r || true); do
V=$(sed -nE 's|.*resources to ([0-9]+\.[0-9]+\.[0-9]+).*|\1|p' "$F")
if [ -n "$V" ] && ! grep -qF "resources to ${V}." "$RELEASED"; then
ENTRY="$F"
break
fi
done
if [ -n "$ENTRY" ]; then
sed -Ei "s|resources to [0-9]+\.[0-9]+\.[0-9]+|resources to ${VERSION}|" "$ENTRY"
else
printf 'project: operator\nkind: Changed\nbody: Bumped the default Redpanda Connect image for `Pipeline` resources to %s.\ntime: %s\n' \
"$VERSION" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
> ".changes/unreleased/operator-Changed-$(date -u +%Y%m%d-%H%M%S).yaml"
fi
git config user.name "vbotbuildovich"
git config user.email "62446873+vbotbuildovich@users.noreply.github.com"
git checkout -B "$BRANCH"
git add -A
git commit -m "operator: bump default Connect image to $VERSION"
git push -f origin "$BRANCH"
TITLE="operator: bump default Connect image to $VERSION"
BODY=$(printf 'Automated bump of `PipelineDefaultImage` (the default Redpanda Connect image for `Pipeline` resources) from `connect:%s` to `connect:%s`.\n' \
"$CURRENT" "$VERSION")
EXISTING_PR=$(gh pr list --repo "$OPERATOR_REPO" --head "$BRANCH" --json number,url -q '.[0]')
if [ -n "$EXISTING_PR" ]; then
PR_NUMBER=$(echo "$EXISTING_PR" | jq -r '.number')
PR_URL=$(echo "$EXISTING_PR" | jq -r '.url')
gh pr edit "$PR_NUMBER" --repo "$OPERATOR_REPO" \
--title "$TITLE" \
--body "$BODY"
else
PR_URL=$(gh pr create --repo "$OPERATOR_REPO" \
--title "$TITLE" \
--body "$BODY" \
--base main \
--head "$BRANCH")
fi
echo "url=${PR_URL}" >> "$GITHUB_OUTPUT"
echo ":gear: Update Operator PR: [${PR_URL##*/}](${PR_URL})" >> "$GITHUB_STEP_SUMMARY"
# Sync the Connect component stubs in redpanda-data/cloud-docs with this
# release. Its update-connect-stubs workflow reads catalog.json from the
# redpanda-connect-docs.tar.gz asset of client_payload.tag, so this waits
# for docs-asset rather than running with update-downstream: a dispatch
# sent before the asset exists makes cloud-docs fall back to info.csv,
# which has no component summaries.
update-cloud-docs:
runs-on: ubuntu-latest
needs: docs-asset
if: github.event_name == 'push' && !contains(github.ref_name, '-')
permissions:
id-token: write
contents: read
steps:
- uses: aws-actions/configure-aws-credentials@v6.2.4
with:
aws-region: ${{ vars.RP_AWS_CRED_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.RP_AWS_CRED_ACCOUNT_ID }}:role/${{ vars.RP_AWS_CRED_BASE_ROLE_NAME }}${{ github.event.repository.name }}
- uses: aws-actions/aws-secretsmanager-get-secrets@v3.0.2
with:
secret-ids: |
,sdlc/prod/github/actions_bot_token
parse-json-secrets: true
- name: Trigger the Connect stub sync in redpanda-data/cloud-docs
env:
GH_TOKEN: ${{ env.ACTIONS_BOT_TOKEN }}
run: |
gh api repos/redpanda-data/cloud-docs/dispatches \
-f event_type=connect-release \
-f "client_payload[tag]=$GITHUB_REF_NAME"
notify-slack:
runs-on: ubuntu-latest
needs: [goreleaser, docs-generate, docs-check, docs-asset, update-bundles, update-downstream, update-cloud-docs]
# always() is required because update-bundles/update-downstream/update-cloud-docs may be skipped
# (pre-release/RC), and by default a skipped dependency skips this job too.
if: always() && github.event_name == 'push' && endsWith(github.ref_name, '.0') && !contains(github.ref_name, '-rc')
permissions:
contents: read
steps:
- name: Get release info
id: release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUNDLE_PR: ${{ needs.update-bundles.outputs.pr_url }}
HELM_PR: ${{ needs.update-downstream.outputs.helm_pr_url }}
OPERATOR_PR: ${{ needs.update-downstream.outputs.operator_pr_url }}
GORELEASER_RESULT: ${{ needs.goreleaser.result }}
DOCS_GENERATE_RESULT: ${{ needs.docs-generate.result }}
DOCS_CHECK_RESULT: ${{ needs.docs-check.result }}
DOCS_ASSET_RESULT: ${{ needs.docs-asset.result }}
BUNDLES_RESULT: ${{ needs.update-bundles.result }}
DOWNSTREAM_RESULT: ${{ needs.update-downstream.result }}
CLOUD_DOCS_RESULT: ${{ needs.update-cloud-docs.result }}
run: |
# Build follow-up PR links and failure notices
LINKS=""
FAILURES=""
if [ -n "$BUNDLE_PR" ]; then
LINKS="${LINKS}:package: <${BUNDLE_PR}|Bundles PR> "
fi
if [ -n "$HELM_PR" ]; then
LINKS="${LINKS}:helm: <${HELM_PR}|Helm Chart PR> "
fi
if [ -n "$OPERATOR_PR" ]; then
LINKS="${LINKS}:gear: <${OPERATOR_PR}|Operator PR> "
fi
if [ "$GORELEASER_RESULT" = "failure" ]; then
FAILURES="${FAILURES}:red_circle: goreleaser failed "
fi
if [ "$DOCS_GENERATE_RESULT" = "failure" ] || [ "$DOCS_ASSET_RESULT" = "failure" ]; then
FAILURES="${FAILURES}:red_circle: docs-asset failed (rerun it, or run the release workflow with docs_tag) "
fi
if [ "$DOCS_CHECK_RESULT" = "failure" ]; then
FAILURES="${FAILURES}:red_circle: docs-check failed, so this release has no docs asset and the docs site keeps the previous one (fix the docs, then run the release workflow with docs_tag) "
fi
if [ "$BUNDLES_RESULT" = "failure" ]; then
FAILURES="${FAILURES}:red_circle: update-bundles failed "
fi
if [ "$DOWNSTREAM_RESULT" = "failure" ]; then
FAILURES="${FAILURES}:red_circle: update-downstream failed "
fi
if [ "$CLOUD_DOCS_RESULT" = "failure" ]; then
FAILURES="${FAILURES}:red_circle: update-cloud-docs failed, so cloud-docs did not sync its Connect stubs "
fi
HEADER_ICON=":green_alert:"
if [ -n "$FAILURES" ]; then
HEADER_ICON=":red_circle:"
fi
RELEASE_URL=""
BODY=""
if RELEASE_JSON=$(gh api repos/${{ github.repository }}/releases/tags/${{ github.ref_name }} 2>/dev/null); then
RELEASE_URL=$(echo "$RELEASE_JSON" | jq -r '.html_url')
echo "$RELEASE_JSON" | jq -r '.body' | tr -d '\r' > "$RUNNER_TEMP/release_body.md"
sed -i -E \
-e 's/^### (.*)$/*\1*/' \
-e 's/\[([^]]*)\]\(([^)]*)\)/<\2|\1>/g' \
-e 's/^(- )([^:]+):/\1*\2*:/' \
"$RUNNER_TEMP/release_body.md"
BODY=$(cat "$RUNNER_TEMP/release_body.md")
fi
VERSION="${{ github.ref_name }}"
COMPARE_URL="${{ github.server_url }}/${{ github.repository }}/compare/${{ github.ref_name }}"
STATUS="${FAILURES}${LINKS}"
# Slack rejects section blocks whose text exceeds 3000 chars, so the
# release body is split across multiple section blocks. Empty
# sections are dropped (Slack rejects those too).
jq -n \
--arg body "$BODY" \
--arg release_url "$RELEASE_URL" \
--arg version "$VERSION" \
--arg compare_url "$COMPARE_URL" \
--arg header_icon "$HEADER_ICON" \
--arg status "$STATUS" \
'def chunk_lines(limit):
split("\n") | reduce .[] as $line ([];
if length > 0 and ((.[-1] + "\n" + $line) | length) <= limit
then .[0:-1] + [.[-1] + "\n" + $line]
else . + [$line]
end)
# a single line longer than limit lands above as an oversized
# chunk; hard-split those so every emitted chunk is bounded
| map(. as $chunk | ($chunk | length) as $len |
if $len <= limit then [$chunk]
else [range(0; $len; limit) as $i | $chunk[$i:$i+limit]]
end)
| add // [];
{
text: ("New Redpanda Connect release: " + $version),
unfurl_links: false,
unfurl_media: false,
blocks: ([
{type: "header", text: {type: "plain_text", text: ($header_icon + " Redpanda Connect " + $version), emoji: true}},
{type: "section", text: {type: "mrkdwn", text: ("*Release:* <" + $release_url + "|" + $version + ">")}},
{type: "divider"}
]
+ ($body | chunk_lines(3000) | map(select(length > 0) | {type: "section", text: {type: "mrkdwn", text: .}}))
+ (if $status == "" then [] else [{type: "section", text: {type: "mrkdwn", text: $status}}] end)
+ [{type: "actions", elements: [
{type: "button", text: {type: "plain_text", text: ":github: View Release", emoji: true}, url: $release_url},
{type: "button", text: {type: "plain_text", text: ":page_facing_up: Full Changelog", emoji: true}, url: $compare_url}
]}]
)
}' > "$RUNNER_TEMP/slack_payload.json"
- name: Post changelog to Slack
uses: slackapi/slack-github-action@v3.0.1
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload-file-path: ${{ runner.temp }}/slack_payload.json
# Fail the job when the webhook post fails; the default silently
# swallows errors and reports success.
errors: true