Skip to content
Merged
Show file tree
Hide file tree
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
64 changes: 64 additions & 0 deletions .github/workflows/bump-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Bump Stream version

# Entry point (dispatched from the stream release pipeline). This workflow only
# routes: it resolves which branch the bump belongs on (legacy/stream-X.Y if it
# exists, otherwise master) and dispatches open-bump-pr.yaml on that branch, which
# opens the actual pull request in the context of the target branch.

on:
workflow_dispatch:
inputs:
stream_version:
description: "The released Stream version, without the leading v (e.g. 2.10.7)"
required: true
type: string
migration_version:
description: "The Stream Migration image version (e.g. 1.27.0)"
required: true
type: string

permissions:
id-token: write
contents: read

jobs:
route:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Fetch secrets via Vault
uses: hashicorp/vault-action@v2
with:
url: ${{ vars.VAULT_ADDR }}
method: ${{ vars.VAULT_AUTH_METHOD }}
path: ${{ vars.VAULT_AUTH_PATH }}
secrets: |
ci/data/global/webhooks stream_helm_webhook | EVT_HELM_TOKEN ;

- name: Resolve target branch
id: branch
env:
STREAM_VERSION: ${{ inputs.stream_version }}
run: echo "base=$(make -s resolve-base-branch STREAM_VERSION="$STREAM_VERSION")" >> "$GITHUB_OUTPUT"

- name: Dispatch PR workflow on target branch
env:
BASE: ${{ steps.branch.outputs.base }}
STREAM_VERSION: ${{ inputs.stream_version }}
MIGRATION_VERSION: ${{ inputs.migration_version }}
REPOSITORY: ${{ github.repository }}
run: |
curl -L \
-X POST \
--fail \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${EVT_HELM_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${REPOSITORY}/actions/workflows/open-bump-pr.yaml/dispatches" \
-d "$(jq -n \
--arg ref "$BASE" \
--arg sv "$STREAM_VERSION" \
--arg mv "$MIGRATION_VERSION" \
'{ref: $ref, inputs: {stream_version: $sv, migration_version: $mv}}')"
50 changes: 50 additions & 0 deletions .github/workflows/open-bump-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Open Stream bump PR

# Runs in the context of the branch it is dispatched on (master or a legacy/stream-X.Y
# branch, selected by bump-version.yaml). It bumps that branch's chart versions and opens
# the pull request against it.

on:
workflow_dispatch:
inputs:
stream_version:
description: "The released Stream version, without the leading v (e.g. 2.10.7)"
required: true
type: string
migration_version:
description: "The Stream Migration image version (e.g. 1.27.0)"
required: true
type: string

permissions:
contents: write
pull-requests: write

jobs:
bump:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install yq
run: |
sudo curl -fsSL -o /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.53.3/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq
yq --version

- name: Bump chart versions
env:
STREAM_VERSION: ${{ inputs.stream_version }}
MIGRATION_VERSION: ${{ inputs.migration_version }}
run: make bump STREAM_VERSION="$STREAM_VERSION" MIGRATION_VERSION="$MIGRATION_VERSION"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7.0.8
with:
add-paths: |
Chart.yaml
values.yaml
title: "fix: bump stream to ${{ inputs.stream_version }} and stream-migration to ${{ inputs.migration_version }}"
commit-message: "fix: bump stream to ${{ inputs.stream_version }} and stream-migration to ${{ inputs.migration_version }}"
branch: "bump_stream_${{ inputs.stream_version }}"
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
all: gen-schema dependencies package test setup-unittest

resolve-base-branch:
@if [ -z "$(STREAM_VERSION)" ]; then echo "STREAM_VERSION is not set" >&2; exit 1; fi; \
base_version="$$(echo "$(STREAM_VERSION)" | cut -d. -f1,2)"; \
branch="legacy/stream-$$base_version"; \
if git ls-remote --exit-code --heads origin "$$branch" >/dev/null 2>&1; then \
echo "$$branch"; \
else \
echo "master"; \
fi

bump:
@if [ -z "$(STREAM_VERSION)" ]; then echo "STREAM_VERSION is not set"; exit 1; fi
@if [ -z "$(MIGRATION_VERSION)" ]; then echo "MIGRATION_VERSION is not set"; exit 1; fi
STREAM_VERSION="$(STREAM_VERSION)" yq -i '.appVersion = strenv(STREAM_VERSION) | .appVersion style="double"' Chart.yaml
STREAM_VERSION="$(STREAM_VERSION)" yq -i '.image.tag = strenv(STREAM_VERSION)' values.yaml
MIGRATION_VERSION="$(MIGRATION_VERSION)" yq -i '.upgrade.image.tag = strenv(MIGRATION_VERSION)' values.yaml

gen-schema:
readme-generator -r README.md -v values.yaml -s values.schema.json

Expand All @@ -18,4 +35,4 @@ setup-unittest:
helm plugin install https://github.com/helm-unittest/helm-unittest.git; \
else \
echo "helm unittest plugin already installed"; \
fi
fi
Loading