Skip to content
149 changes: 106 additions & 43 deletions .claude/skills/new-release/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,94 +54,149 @@ The skill uses ACM release branch names as the primary input and automatically c

## Repository Workflow

The skill manages releases across 6 repositories, each with its own dedicated script:
The skill manages releases across 6 repositories, each with its own dedicated script.

> **Version example below uses release-2.17 / Global Hub v1.8.0 (globalhub-1-8)**

---

### Repository 1: multicluster-global-hub (Script 01)

**Repository**: [stolostron/multicluster-global-hub](https://github.com/stolostron/multicluster-global-hub)

**What it does** (4-part workflow):
**What it does** (3-part workflow):
1. **Update main branch**: Creates new `.tekton/` configuration files for new version (e.g., globalhub-1-8) with `target_branch="main"`, updates `Containerfile.*` version labels
2. **Create release branch**: Creates ACM release branch (e.g., release-2.17) from updated main
3. **Create PR to main**: Creates PR to upstream main with new release configurations
4. **Update previous release**: Updates previous release branch's `.tekton/` files to set `target_branch` to the previous release branch (e.g., globalhub-1-7 files updated to `target_branch="release-2.16"`)
2. **Create PR to main**: Creates PR to upstream main with new release configurations
3. **Update previous release**: Updates previous release branch's `.tekton/` files to set `target_branch` to the previous release branch (e.g., globalhub-1-7 files updated to `target_branch="release-2.16"`)

**Key behavior**:
- New `.tekton/` files (e.g., globalhub-1-8) created by **copying** old files (globalhub-1-7), not renaming
- Old `.tekton/` files (globalhub-1-7) remain on main with `target_branch="main"`
- Previous release branch gets updated so its files point to itself (not main)
- Ensures continuous file naming progression: globalhub-1-6 → globalhub-1-7 → globalhub-1-8
- The new tekton files on `main` will be automatically synced to the current release branch (`release-2.17`) after the PR is merged — **no separate PR needed for the current release branch**

**Expected PRs**: 2

**Outputs**: 1 PR (new release configurations to main), direct pushes to release branches
| PR | Target Branch | Content | Verification |
|----|--------------|---------|--------------|
| PR to main | `main` | New `.tekton/globalhub-1-8-*.yaml` files; old globalhub-1-7 files removed; Containerfile version updated; Makefile VERSION/CHANNELS updated | Check `.tekton/` has globalhub-1-8 files with `target_branch=main` (pull-request) and `target_branch=release-2.17` (push) |
| PR to prev release | `release-2.16` | globalhub-1-7 `pull-request.yaml` target_branch changed from `main` → `release-2.16` | Verify `*pull-request.yaml` has `target_branch=release-2.16` |

---

### Repository 2: openshift/release (Script 02)

**Repository**: [openshift/release](https://github.com/openshift/release)

**What it does**:
- Updates main branch CI configuration (promotion, fast-forward)
- Creates new release pipeline configuration
- Auto-generates presubmit/postsubmit jobs using `make update`
- Validates container engine availability (Docker or Podman)
- Creates new release pipeline configuration by copying from previous release
- Replaces version strings: ACM branch, version number, image prefix, GH version tag
- Auto-generates presubmit/postsubmit jobs using `make update` + `make jobs`
- Creates PR with all CI changes

**Outputs**: 1 PR (CI configuration)
**Expected PRs**: 1

| PR | Target Branch | Content | Verification |
|----|--------------|---------|--------------|
| PR to main | `main` | `ci-operator/config/stolostron/multicluster-global-hub/stolostron-multicluster-global-hub-release-2.17.yaml` created; main config updated with new release references | Check config file exists and contains `branch: release-2.17`, `name: "2.17"`, `release-218` prefix |

---

### Repository 3: operator-bundle (Script 03)

**Repository**: [stolostron/multicluster-global-hub-operator-bundle](https://github.com/stolostron/multicluster-global-hub-operator-bundle)

**What it does**:
- Creates bundle branch using Global Hub version (e.g., release-1.8 from v1.8.0)
- Detects open MGH release PR (e.g., PR to main with `release-2.17` in title) and copies bundle content (`manifests/`, `metadata/`, `tests/`) from that PR's branch; falls back to `upstream/main` if no open PR found
- Checks out release branch (e.g., release-1.8)
- Updates `images_digest_mirror_set.yaml` with new image tags
- Renames and updates tekton pipelines (pull-request and push)
- Updates bundle image labels to new version
- Updates `konflux-patch.sh` image references
- Creates PR with all bundle changes
- Renames tekton pipelines: globalhub-1-7 → globalhub-1-8 (pull-request and push)
- Updates `konflux-patch.sh` image references and version replacement
- Creates PR to the release branch

**Expected PRs**: 1

**Outputs**: 1 PR (bundle updates to main)
| PR | Target Branch | Content | Verification |
|----|--------------|---------|--------------|
| PR to release branch | `release-1.8` | Bundle content synced from MGH release PR branch; tekton pipelines renamed globalhub-1-7 → globalhub-1-8; image tags updated; konflux-patch.sh updated | Check `bundle/manifests/*.clusterserviceversion.yaml` has version `1.8.0-dev`, skipRange `>=1.7.0 <1.8.0`; `.tekton/` has `*globalhub-1-8*.yaml` |

---

### Repository 4: operator-catalog (Script 04)

**Repository**: [stolostron/multicluster-global-hub-operator-catalog](https://github.com/stolostron/multicluster-global-hub-operator-catalog)

**What it does**:
- Creates catalog branch using Global Hub version (e.g., release-1.8)
- Creates/updates catalog branch (e.g., release-1.8)
- Updates `images-mirror-set.yaml` with new image tags
- **Adds** new OCP version pipelines (e.g., OCP 4.21 for release-1.8)
- **Removes** old OCP version pipelines (e.g., OCP 4.16)
- Updates existing OCP version pipelines (4.17-4.20)
- **Adds** new OCP version pipeline (e.g., OCP 4.22 for release-1.8)
- **Removes** oldest OCP version pipeline (e.g., OCP 4.17)
- Updates existing OCP version pipelines (4.18-4.21)
- Updates `README.md` with new version information
- Updates GitHub Actions workflow for new release branch
- Creates **2 PRs**:
- Main PR: New release configuration to main branch
- Cleanup PR: Remove GitHub Actions from old release branch
- Creates PR to main with new release configuration
- Creates PR to catalog release branch with pipeline updates

**OCP Version Formula**: OCP_MIN = 4.(10 + GH_MINOR), OCP_MAX = OCP_MIN + 4

**Outputs**: 2 PRs (main release + cleanup)
**Expected PRs**: 2

| PR | Target Branch | Content | Verification |
|----|--------------|---------|--------------|
| PR to main | `main` | New release-1.8 catalog config; OCP version lifecycle managed | Check README lists OCP 4.18-4.22; new OCP pipeline added |
| PR to catalog branch | `release-1.8` | pipeline updates, image mirror set updated | Check `images-mirror-set.yaml` has globalhub-1-8 tags |
Comment thread
coderabbitai[bot] marked this conversation as resolved.

---

### Repository 5: glo-grafana (Script 05)

**Repository**: [stolostron/glo-grafana](https://github.com/stolostron/glo-grafana)

**What it does**:
- Creates grafana branch using Global Hub version (e.g., release-1.8)
- Renames and updates tekton pipelines (pull-request and push)
- Checks out grafana release branch (e.g., release-1.8)
- Renames tekton pipelines: globalhub-1-7 → globalhub-1-8 (pull-request and push)
- Updates branch references in pipeline files
- Creates PR to the release branch

**Expected PRs**: 1

**Outputs**: Branch creation only (no PR)
| PR | Target Branch | Content | Verification |
|----|--------------|---------|--------------|
| PR to grafana branch | `release-1.8` | tekton pipelines renamed globalhub-1-7 → globalhub-1-8; branch references updated | Check `.tekton/` has `glo-grafana-globalhub-1-8-pull-request.yaml` and `glo-grafana-globalhub-1-8-push.yaml` |

---

### Repository 6: postgres_exporter (Script 06)

**Repository**: [stolostron/postgres_exporter](https://github.com/stolostron/postgres_exporter)

**What it does**:
- Creates postgres_exporter branch using ACM version (e.g., release-2.17)
- Renames and updates tekton pipelines (pull-request and push)
- Checks out postgres_exporter release branch (e.g., release-2.17)
- Renames tekton pipelines: globalhub-1-7 → globalhub-1-8 (pull-request and push)
- Updates branch references in pipeline files
- Creates PR to the release branch

**Expected PRs**: 1

**Outputs**: Branch creation only (no PR)
| PR | Target Branch | Content | Verification |
|----|--------------|---------|--------------|
| PR to release branch | `release-2.17` | tekton pipelines renamed globalhub-1-7 → globalhub-1-8; branch references updated | Check `.tekton/` has `postgres-exporter-globalhub-1-8-pull-request.yaml` and `postgres-exporter-globalhub-1-8-push.yaml` |

---

## Total Expected Output Summary

| Repo | PRs | Branches |
|------|-----|---------|
| multicluster-global-hub | 2 (main, prev-release) | release-2.17 |
| openshift/release | 1 (main) | — |
| operator-bundle | 1 (release-1.8) | release-1.8 |
| operator-catalog | 2 (main, release-1.8) | release-1.8 |
| glo-grafana | 1 (release-1.8) | release-1.8 |
| postgres_exporter | 1 (release-2.17) | release-2.17 |
| **Total** | **8 PRs** | **5 branches** |

## Script Organization

Expand Down Expand Up @@ -222,8 +277,8 @@ The main orchestration script calculates and exports these variables for child s
| `GRAFANA_BRANCH` | Grafana release branch | `release-1.8` | Auto-calculated |
| `GRAFANA_TAG` | Grafana tag | `globalhub-1-8` | Auto-calculated |
| `POSTGRES_TAG` | Postgres image tag | `globalhub-1-8` | Auto-calculated |
| `OCP_MIN` | Minimum OCP version number | `417` | Auto-calculated |
| `OCP_MAX` | Maximum OCP version number | `421` | Auto-calculated |
| `OCP_MIN` | Minimum OCP version number | `418` | Auto-calculated |
| `OCP_MAX` | Maximum OCP version number | `422` | Auto-calculated |
| `OPENSHIFT_RELEASE_PATH` | Path to openshift/release clone | `/tmp/openshift-release` | Optional |
| `WORK_DIR` | Working directory for repos | `/tmp/globalhub-release-repos` | Optional |

Expand Down Expand Up @@ -284,12 +339,20 @@ When running the complete workflow (`cut-release.sh all`):

After running all 6 scripts:

**Pull Requests Created**: 5 PRs
1. Main repo: Version bump PR
2. OpenShift CI: CI configuration PR
3. Bundle: Bundle update PR
4. Catalog: New release configuration PR
5. Catalog: Cleanup PR for old branch
**Pull Requests Expected**: up to 8 PRs

> Each PR is only created if changes are needed. If the target branch is already up-to-date or an open PR already exists, the script will skip or reuse it.

| # | Repo | Target Branch | Content |
|---|------|--------------|---------|
| 1 | multicluster-global-hub | `main` | New globalhub-1-8 tekton configs, Containerfile/Makefile version bump |
| 2 | multicluster-global-hub | `release-2.16` | Update globalhub-1-7 pull-request pipeline target_branch → release-2.16 |
| 3 | openshift/release | `main` | CI config for release-2.17, presubmit/postsubmit jobs |
| 4 | operator-bundle | `release-1.8` | Rename tekton pipelines globalhub-1-7 → globalhub-1-8, update image tags |
| 5 | operator-catalog | `main` | New release-1.8 catalog config, OCP 4.18-4.22 lifecycle |
| 6 | operator-catalog | `release-1.8` | Update pipeline and image mirror set |
| 7 | glo-grafana | `release-1.8` | Rename tekton pipelines globalhub-1-7 → globalhub-1-8 |
| 8 | postgres_exporter | `release-2.17` | Rename tekton pipelines globalhub-1-7 → globalhub-1-8 |

**Branches Created**: 5 branches
1. `multicluster-global-hub`: `release-2.17`
Expand All @@ -310,23 +373,23 @@ The orchestration script includes error handling:

### Update all repositories (UPDATE mode - creates PRs):
```bash
RELEASE_BRANCH=release-2.17 ./.claude/skills/cut-release/scripts/cut-release.sh all
RELEASE_BRANCH=release-2.17 ./.claude/skills/new-release/scripts/cut-release.sh all
```

### Create new release branches (CREATE_BRANCHES mode - pushes directly):
```bash
CREATE_BRANCHES=true RELEASE_BRANCH=release-2.18 ./.claude/skills/cut-release/scripts/cut-release.sh all
CREATE_BRANCHES=true RELEASE_BRANCH=release-2.18 ./.claude/skills/new-release/scripts/cut-release.sh all
```

### Interactive selection:
```bash
RELEASE_BRANCH=release-2.17 ./.claude/skills/cut-release/scripts/cut-release.sh
RELEASE_BRANCH=release-2.17 ./.claude/skills/new-release/scripts/cut-release.sh
# Then select: 3,4 (to update only bundle and catalog)
```

### Update specific repositories:
```bash
RELEASE_BRANCH=release-2.17 ./.claude/skills/cut-release/scripts/cut-release.sh 1,2,3
RELEASE_BRANCH=release-2.17 ./.claude/skills/new-release/scripts/cut-release.sh 1,2,3
Comment thread
coderabbitai[bot] marked this conversation as resolved.
```

### Standalone script execution:
Expand All @@ -349,7 +412,7 @@ The skill provides clear progress indicators:
Global Hub Version: v1.8.0
Bundle Branch: release-1.8
Catalog Branch: release-1.8
Supported OCP: 4.17 - 4.21
Supported OCP: 4.18 - 4.22
================================================

Mode: Update all repositories
Expand Down
22 changes: 11 additions & 11 deletions .claude/skills/new-release/scripts/02-openshift-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ if [[ -d "$OPENSHIFT_RELEASE_PATH" ]]; then
git remote add upstream https://github.com/openshift/release.git 2>/dev/null || true

# Fetch and update to latest
echo " Updating to latest upstream/master..."
if git fetch upstream master; then
git checkout master 2>/dev/null || git checkout main 2>/dev/null || true
git pull upstream master 2>/dev/null || git pull upstream main 2>/dev/null || true
echo " Updating to latest upstream/main..."
if git fetch upstream main; then
git checkout main 2>/dev/null || true
git pull upstream main 2>/dev/null || true
echo " ✅ Updated to latest commit"
else
echo " ⚠️ Failed to update, continuing with existing state" >&2
Expand All @@ -78,12 +78,12 @@ else
PARENT_DIR=$(dirname "$OPENSHIFT_RELEASE_PATH")
REPO_NAME=$(basename "$OPENSHIFT_RELEASE_PATH")
cd "$PARENT_DIR"
git clone --depth=1 --single-branch --branch master --progress "https://github.com/$GITHUB_USER/release.git" "$REPO_NAME" 2>&1 | grep -E "Receiving|Resolving" || true
git clone --depth=1 --single-branch --branch main --progress "https://github.com/$GITHUB_USER/release.git" "$REPO_NAME" 2>&1 | grep -E "Receiving|Resolving" || true
cd "$REPO_NAME"
echo " Adding upstream remote..."
git remote add upstream https://github.com/openshift/release.git
echo " Fetching upstream master..."
git fetch --depth=1 upstream master --progress 2>&1 | grep -E "Receiving|Resolving" || true
echo " Fetching upstream main..."
git fetch --depth=1 upstream main --progress 2>&1 | grep -E "Receiving|Resolving" || true
fi

# Calculate previous release version (ACM_VERSION - 0.01)
Expand Down Expand Up @@ -120,7 +120,7 @@ if git show-ref --verify --quiet "refs/heads/$BRANCH_NAME"; then
git checkout "$BRANCH_NAME"
echo " ✅ Switched to existing branch $BRANCH_NAME"
else
git checkout -b "$BRANCH_NAME" upstream/master
git checkout -b "$BRANCH_NAME" upstream/main
echo " ✅ Created branch $BRANCH_NAME"
fi

Expand Down Expand Up @@ -364,7 +364,7 @@ PR_HEAD="${GITHUB_USER}:${BRANCH_NAME}"
EXISTING_PR=$(gh pr list \
--repo "openshift/release" \
--head "${PR_HEAD}" \
--base master \
--base main \
--state all \
--json number,url,state \
--jq '.[0] | select(. != null) | "\(.state)|\(.url)"' 2>/dev/null || echo "")
Expand Down Expand Up @@ -466,7 +466,7 @@ ACM: ${RELEASE_BRANCH}, Global Hub: release-${GH_VERSION_SHORT}"
PR_CREATED=true
else
# Create new PR
echo " Creating PR to openshift/release:master..."
echo " Creating PR to openshift/release:main..."

# Build PR body based on make jobs success
if [[ "$MAKE_JOBS_SUCCESS" = true ]]; then
Expand All @@ -475,7 +475,7 @@ ACM: ${RELEASE_BRANCH}, Global Hub: release-${GH_VERSION_SHORT}"
JOBS_NOTE="4. **Auto-generate job configurations**: Using \`make update\` (⚠️ \`make jobs\` failed - may need manual formatting)"
fi

PR_CREATE_OUTPUT=$(gh pr create --base master --head "$PR_HEAD" \
PR_CREATE_OUTPUT=$(gh pr create --base main --head "$PR_HEAD" \
--title "Add ${RELEASE_BRANCH} configuration for multicluster-global-hub" \
--body "This PR adds ${RELEASE_BRANCH} configuration for the multicluster-global-hub project.

Expand Down
Loading
Loading