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
2 changes: 1 addition & 1 deletion .changie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ projects:
# Update operator's Chart.yaml
- path: operator/chart/Chart.yaml
find: '^version: .*$'
replace: 'version: {{.Version}}'
replace: 'version: {{.VersionNoPrefix}}'
- path: operator/chart/Chart.yaml
find: '^appVersion: .*$'
replace: 'appVersion: {{.Version}}'
Expand Down
106 changes: 106 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Release On Tag

on:
push:
tags:
# Only match tags that look like go module tags.
# This way we explicitly ignore our legacy tagging of the operator.
- '*/v*'
workflow_dispatch:
inputs:
ref_name:
description: "The ref name to process (e.g., 'operator/v1.2.3')"
required: false
default: ""

jobs:
release:
name: Create Release on GitHub
runs-on: ubuntu-latest

steps:
# for testing purposes and to allow updating of pre-existing releases,
# this workflow can be triggered by a tag being pushed or directly. This
# step normalized the possible inputs into a single variable.
- name: get ref
id: get_ref
run: |
if [[ -n "${{ inputs.ref_name }}" ]]; then
tag="${{ inputs.ref_name }}"
else
tag="${{ github.ref_name }}"
fi
echo "using ref name: $tag"
echo "ref_name=$tag" >> "$GITHUB_OUTPUT"

- name: checkout code
uses: actions/checkout@v4
with:
ref: ${{ steps.get_ref.outputs.ref_name }}

- uses: nixbuild/nix-quick-install-action@v30
with:
github_access_token: ${{ secrets.github_token }}

# cache the nix store.
- uses: nix-community/cache-nix-action@v6
with:
primary-key: nix-${{ runner.os }}-${{ runner.arch }}-${{ hashfiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-${{ runner.arch }}

- name: build release name
id: release_name
run: |
# turn refs into slightly friendlier names. e.g. operator/v1.2.3 -> operator: v1.2.3
release_name="$(echo "${{ steps.get_ref.outputs.ref_name }}" | sed 's|/v|: v|')"
echo "release_name=$release_name" >> "$GITHUB_OUTPUT"

- name: package helm chart
run: |
set -ex
tag="${{ steps.get_ref.outputs.ref_name }}"
# extract the directory from the tag (e.g., "operator" from "operator/v1.2.3")
dir="$(dirname "$tag")"
# search for chart.yaml in $dir or one directory deep (e.g., operator/chart)
chart_path=$(find "$dir" -maxdepth 2 -type f -name "Chart.yaml" | head -n 1)
# exit early if no chart.yaml file is found
if [[ -z "$chart_path" ]]; then
echo "no chart.yaml found for $tag. skipping step."
exit 0
fi

# Explicitly set the version based on the tag, stripping the leading
# v. This is done due to a mishap in managing the operator's version.
# All our charts specify `version` without a leading v but the
# operator's chart accidentally began doing so when binding version
# and appVersion.
# We enforce uniformity here, which retroactively corrects this
# issue.
version="$(basename "$tag")"
version="${version#v}"

echo "packaging chart at $chart_path"
helm package -u --version "$version" "$(dirname "$chart_path")"

- name: reformat change log
run: |
# Our CHANGE LOGS begin with '## VERSION - DATE', which is
# duplicative to include in the GH release body. tail -n +2 will
# remove the first line.
tail -n +2 .changes/${{ steps.get_ref.outputs.ref_name }}.md > RELEASE_BODY.md

# create github release and upload file
- name: create github release
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.release_name.outputs.release_name }}
tag_name: ${{ steps.get_ref.outputs.ref_name }}
draft: false
make_latest: false
prerelease: ${{ contains(steps.get_ref.outputs.ref_name, '-alpha') || contains(steps.get_ref.outputs.ref_name, '-beta') }}
body_path: RELEASE_BODY.md
# if a chart was packaged, we'll upload it to this release preserving helm's naming convention.
files: |
./*.tgz

# todo(chrisseto) trigger an action in the charts repo that updates index.yaml
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,13 @@ Releases](https://redpandadata.atlassian.net/projects/K8S?selectedItem=com.atlas
To release any project in this repository:
1. Mint the version and its CHANGELOG.md entry via `changie batch -j <project> <version>`
- If minting a pre-release, specify `-k` to keep the unreleased changes in place for the official release.
- Manually review the contents and make any formatting or language adjustments as need be.
2. Run `task test:unit` and `task lint`, they will report additional required actions, if any.
4. Commit the resultant diff with the commit message `<project>: cut release <version>` and rebase it into master via a Pull Request.
5. Tag the above commit with as `<project>/v<version>` with `git tag $(changie latest -j <project>) <commit-sha>`.
6. Push the tags.
7. Create a [Release on GitHub](https://github.com/redpanda-data/redpanda-operator/releases)
- Associate it with the tag pushed in the previous step.
- Paste the contents of `.changes/<project>/<version>.md`, excluding the header, into the release notes field.
- Name the release `<project>: <version>`
7. Verify that the [Release Workflow](./.github/workflows/release.yml) ran successfully.
8. If applicable, mark the newly minted release as the "latest".

## Nightly build

Expand Down
5 changes: 3 additions & 2 deletions operator/chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ description: Redpanda operator helm chart
type: application

# The operator helm chart is considered part of the operator itself. Therefore
# version == appVersion.
version: v25.1.1-beta3
# version == appVersion. Our charts' versions, don't include a leading `v`, so
# we match that precedence here.
version: 25.1.1-beta3
appVersion: v25.1.1-beta3
kubeVersion: ">= 1.25.0-0"

Expand Down
2 changes: 1 addition & 1 deletion operator/chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
description: Find the default values and descriptions of settings in the Redpanda Operator Helm chart.
---

![Version: v25.1.1-beta3](https://img.shields.io/badge/Version-v25.1.1--beta3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v25.1.1-beta3](https://img.shields.io/badge/AppVersion-v25.1.1--beta3-informational?style=flat-square)
![Version: 25.1.1-beta3](https://img.shields.io/badge/Version-25.1.1--beta3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v25.1.1-beta3](https://img.shields.io/badge/AppVersion-v25.1.1--beta3-informational?style=flat-square)

This page describes the official Redpanda Operator Helm Chart. In particular, this page describes the contents of the chart’s [`values.yaml` file](./values.yaml). Each of the settings is listed and described on this page, along with any default values.

Expand Down
24 changes: 12 additions & 12 deletions operator/chart/chart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ import (
"github.com/redpanda-data/redpanda-operator/pkg/testutil"
)

type ChartYAML struct {
Version string `json:"version"`
AppVersion string `json:"appVersion"`
Annotations map[string]string `json:"annotations"`
type ImageAnnotation struct {
Name string `json:"name"`
Image string `json:"image"`
}

func TestChartYaml(t *testing.T) {
Expand All @@ -55,16 +54,17 @@ func TestChartYaml(t *testing.T) {

expectedVersion := string(out[len("operator/"):])

assert.Equal(t, expectedVersion, Chart.Metadata().Version, "Chart.yaml's version should match `%s: %s", changieCmd, expectedVersion)
assert.Equal(t, expectedVersion, Chart.Metadata().AppVersion, "Chart.yaml's appVersion should match `%s: %s", changieCmd, expectedVersion)
assert.Equal(t, expectedVersion[1:], Chart.Metadata().Version, "Chart.yaml's version should match `%s: %s", changieCmd, expectedVersion)

assert.Equal(t, Chart.Metadata().AppVersion, Chart.Metadata().Version, "The Operator and its chart are distributed as the same package. Any changes to appVersion should be made to version and visa vera.")
var operatorImages []ImageAnnotation
require.NoError(t, yaml.Unmarshal([]byte(Chart.Metadata().Annotations["artifacthub.io/images"]), &operatorImages))

assert.Contains(
t,
Chart.Metadata().Annotations["artifacthub.io/images"],
fmt.Sprintf("%s:%s", operatorRepo, expectedVersion),
"artifacthub.io/images should be in sync with .version",
)
var redpandaImages []ImageAnnotation
require.NoError(t, yaml.Unmarshal([]byte(redpanda.Chart.Metadata().Annotations["artifacthub.io/images"]), &redpandaImages))

assert.Equal(t, operatorImages[1], redpandaImages[0], "artifacthub.io/images should be in sync with the vendored redpanda chart")
assert.Equal(t, fmt.Sprintf("%s:%s", operatorRepo, expectedVersion), operatorImages[0].Image, "artifacthub.io/images should be in sync with appVersion")
}

func TestRBACBindings(t *testing.T) {
Expand Down
Loading