Skip to content

Release tooling to automate releases and GHA pipeline to build operat…#317

Open
SpaceFace02 wants to merge 1 commit into
trusted-execution-clusters:mainfrom
SpaceFace02:build-operator-gha
Open

Release tooling to automate releases and GHA pipeline to build operat…#317
SpaceFace02 wants to merge 1 commit into
trusted-execution-clusters:mainfrom
SpaceFace02:build-operator-gha

Conversation

@SpaceFace02

@SpaceFace02 SpaceFace02 commented Jul 23, 2026

Copy link
Copy Markdown
Member

This PR aims to improve the release workflow of the operator, by introducing helper scripts, GHA pipeline to build and push operator images and other release improvements.

Summary by Sourcery

Automate the operator release process by introducing version-aware defaults, a prepare-release script, and a GitHub Actions workflow that builds and publishes images and OLM bundles from tagged releases.

New Features:

  • Add a GitHub Actions release workflow that builds and pushes operator and component images plus the OLM bundle on semantic version tags.
  • Introduce a prepare-release Makefile target and script to consistently bump crate, CSV, README, and lockfile versions for a new release.

Enhancements:

  • Make operator image and component versions configurable via environment, defaulting to the trustee version and the Cargo package version.
  • Adjust bundle generation to derive the OLM bundle version from the image tag by stripping a leading 'v', and clarify this behavior in the README.
  • Update CSV and related image references to the v0.2.1 release of the operator and its managed components.

CI:

  • Add a release GitHub Actions workflow that runs on semantic version tags, installs required tooling, logs into Quay, and runs the release build and push pipeline.

Documentation:

  • Refresh README release instructions and examples to use v-prefixed image tags and explain OLM semver requirements.

…or images

Signed-off-by: Chirag Rao <crao@redhat.com>
@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: SpaceFace02

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai

sourcery-ai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Reviewer's Guide

Automates the operator release process by adding a release preparation script, a GitHub Actions workflow to build and push images on semver tags, and aligning image/version handling across the operator code, CSV bundle, Makefile, and README with v-prefixed image tags and bare semver bundle versions.

Flow diagram for the automated operator release process

flowchart LR
  Dev["Developer runs make prepare-release VERSION=MAJOR.MINOR.PATCH"] --> PRS["scripts/prepare-release.sh VERSION"]
  PRS -->|updates| CargoToml["Workspace Cargo.toml versions"]
  PRS -->|updates| CSV["trusted-cluster-operator CSV bundle"]
  PRS -->|updates| README["README TAG and note"]
  PRS -->|refreshes| CargoLock["Cargo.lock"]

  Dev --> Commit["git commit -am 'Release VERSION'"]
  Commit --> Tag["git tag VERSION"]
  Tag --> Push["git push origin main VERSION"]

  Push --> GH["GitHub push event on semver tag"]
  GH --> WF["release workflow (.github/workflows/release.yml)"]

  WF --> Go["actions/setup-go (install Go)"]
  WF --> Yq["go install yq v4"]
  WF --> OSdk["Download operator-sdk v1.39.1"]
  WF --> QuayLogin["docker/login-action to Quay.io"]

  WF --> MakePushAll["make push-all TAG=v${github.ref_name}"]
  MakePushAll --> Images["Build & push operator + component images (v-prefixed tags)"]
  MakePushAll --> Bundle["Build & push OLM bundle using OLM_VERSION (bare semver)"]

  WF --> GHRelease["softprops/action-gh-release (GitHub Release)"]
Loading

File-Level Changes

Change Details Files
Make operator image component versions configurable via environment and align defaults with project semver.
  • Change TRUSTEE_VERSION to read from TRUSTEE_VERSION env var with default v0.17.0
  • Change COMPONENT_VERSION to read from COMPONENT_VERSION env var with default derived from CARGO_PKG_VERSION and v-prefix
  • Keep registry constant but rely on updated defaults for image tags
operator/src/main.rs
Update CSV bundle to new operator/component versions and use v-prefixed image tags consistently.
  • Bump operator CSV version from 0.2.0 to 0.2.1 including metadata.name and spec.version
  • Update containerImage and relatedImages tags for operator and components to v0.2.1
  • Update operator deployment image and RELATED_IMAGE_* environment variables to v0.2.1
bundle/static/manifests/trusted-cluster-operator.clusterserviceversion.yaml
Introduce a release preparation script and supporting Makefile target to standardize version bumps across Cargo.toml, CSV, README, and Cargo.lock.
  • Add prepare-release Makefile phony target that requires VERSION and invokes scripts/prepare-release.sh
  • Implement prepare-release.sh to validate bare semver VERSION, update local workspace Cargo.toml [package].version entries, rewrite CSV operator/component image tags and version fields, update README TAG example and note, and refresh Cargo.lock via cargo metadata
  • Support a --dry-run mode for previewing changes without modifying files
Makefile
scripts/prepare-release.sh
Clarify README instructions for image TAG vs bundle OLM version semantics and update example tag.
  • Change example TAG export from 0.2.0 to v0.2.1
  • Rewrite note to explain that TAG is the image tag with optional leading v and that Makefile derives OLM_VERSION by stripping v for bundle semver
README.md
Add a GitHub Actions workflow that builds and pushes operator and component images plus OLM bundle on semver tag pushes and creates a GitHub release.
  • Create release.yml workflow triggered on push of tags matching MAJOR.MINOR.PATCH
  • Set up Go toolchain, install yq and operator-sdk on ubuntu-24.04 runner
  • Log into Quay.io using repository secrets and run make push-all TAG=v${{ github.ref_name }} to build/push images and bundle
  • Use softprops/action-gh-release to generate release notes and create a GitHub release for the tag
.github/workflows/release.yml
Adjust Makefile bundle generation to use bare semver for OLM while allowing v-prefixed image tags.
  • Introduce OLM_VERSION variable that strips leading v from TAG using patsubst
  • Pass OLM_VERSION instead of TAG to generate-bundle-prod.sh via -v flag
  • Extend .PHONY list to include prepare-release target
Makefile

Possibly linked issues

  • #: The PR adds prepare-release script and release GitHub workflow to automate image and manifest publishing per issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@SpaceFace02

Copy link
Copy Markdown
Member Author

Aims to fix #286, and other enhancements.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The tag filter in .github/workflows/release.yml uses a regex-style pattern ('[0-9]+.[0-9]+.[0-9]+'), but GitHub’s tag filters are glob-based; consider switching to something like '..*' so releases actually trigger on semver tags.
  • TRUSTEE_VERSION and COMPONENT_VERSION now use option_env!/env! in consts, which bakes values in at build time; if these are intended to be configurable per deployment, consider reading from std::env::var at runtime instead.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The tag filter in .github/workflows/release.yml uses a regex-style pattern ('[0-9]+.[0-9]+.[0-9]+'), but GitHub’s tag filters are glob-based; consider switching to something like '*.*.*' so releases actually trigger on semver tags.
- TRUSTEE_VERSION and COMPONENT_VERSION now use option_env!/env! in consts, which bakes values in at build time; if these are intended to be configurable per deployment, consider reading from std::env::var at runtime instead.

## Individual Comments

### Comment 1
<location path=".github/workflows/release.yml" line_range="7-8" />
<code_context>
+
+name: "Release"
+on:
+  push:
+    tags:
+      - "[0-9]+.[0-9]+.[0-9]+"
+
</code_context>
<issue_to_address>
**issue (bug_risk):** The tag filter pattern is treated as a glob, not a regex, so `"[0-9]+.[0-9]+.[0-9]+"` won’t match version tags as intended.

`on.push.tags` uses glob matching, so `"[0-9]+.[0-9]+.[0-9]+"` will only match tags that literally contain `[` and `+`. To trigger on semantic version tags like `0.2.1`, use a glob such as `"*.*.*"` (or a set of more specific glob patterns) instead of a regex-style pattern.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +7 to +8
push:
tags:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): The tag filter pattern is treated as a glob, not a regex, so "[0-9]+.[0-9]+.[0-9]+" won’t match version tags as intended.

on.push.tags uses glob matching, so "[0-9]+.[0-9]+.[0-9]+" will only match tags that literally contain [ and +. To trigger on semantic version tags like 0.2.1, use a glob such as "*.*.*" (or a set of more specific glob patterns) instead of a regex-style pattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant