Skip to content
Open
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
225 changes: 225 additions & 0 deletions .claude/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
{
"name": "openshift-branching",
"version": "1.0.0",
"description": "Automates OpenShift release branching tasks",
"author": "TestPlatform Team",
"commands": [
{
"name": "branching-day",
"description": "Execute Branching Day tasks for OpenShift X.Y release",
"usage": "/branching-day",
"examples": [
"/branching-day"
]
},
{
"name": "post-branching",
"description": "Execute Post-Branching tasks - bootstrap config and content for X.Y+2",
"usage": "/post-branching",
"examples": [
"/post-branching"
]
}
],
"skills": [
{
"name": "create-branch-from-master",
"description": "Fetch latest from master, rebase/reset master, and create a new branch",
"script": "skills/common/create-branch-from-master.sh"
},
{
"name": "build-branching-tooling",
"description": "Build all branching tools (config-brancher, tide-config-manager, rpm-repo-mirroring-service, ci-operator-config-mirror)",
"script": "skills/common/build-branching-tooling.sh"
},
{
"name": "get-current-release",
"description": "Verify branching readiness and get target release version (checks for 3+ accepted nightlies)",
"script": "skills/common/get-current-release.sh"
},
{
"name": "run-config-brancher",
"description": "Run config-brancher to bump CI operator configurations",
"script": "skills/branching-day/run-config-brancher.sh"
},
{
"name": "verify-config-brancher",
"description": "Verify config-brancher output (re-run after fixes)",
"script": "skills/branching-day/verify-config-brancher.sh"
},
{
"name": "update-infra-periodics",
"description": "Update infra-periodics.yaml and jira config for config-brancher PR",
"script": "skills/branching-day/update-infra-periodics.sh"
},
{
"name": "verify-infra-periodics",
"description": "Verify infra-periodics and jira config updates (re-run after fixes)",
"script": "skills/branching-day/verify-infra-periodics.sh"
},
{
"name": "commit-config-brancher-pr",
"description": "Create commits for config-brancher PR",
"script": "skills/branching-day/commit-config-brancher-pr.sh"
},
{
"name": "run-tide-config-manager",
"description": "Run tide-config-manager to update merge criteria for branching",
"script": "skills/branching-day/run-tide-config-manager.sh"
},
{
"name": "verify-tide-config-manager",
"description": "Verify tide-config-manager output (re-run after fixes)",
"script": "skills/branching-day/verify-tide-config-manager.sh"
},
{
"name": "update-tide-and-infra-jobs",
"description": "Update infrastructure periodic jobs for tide config PR",
"script": "skills/branching-day/update-tide-and-infra-jobs.sh"
},
{
"name": "verify-tide-and-infra-jobs",
"description": "Verify tide and infra jobs updates (re-run after fixes)",
"script": "skills/branching-day/verify-tide-and-infra-jobs.sh"
},
{
"name": "update-etcd-config",
"description": "Update etcd tide config for branching (etcd special case)",
"script": "skills/branching-day/update-etcd-config.sh"
},
{
"name": "verify-etcd-config",
"description": "Verify etcd config updates (re-run after fixes)",
"script": "skills/branching-day/verify-etcd-config.sh"
},
{
"name": "commit-tide-config-pr",
"description": "Create commits for tide config PR",
"script": "skills/branching-day/commit-tide-config-pr.sh"
},
{
"name": "update-image-mirroring",
"description": "Helper to update image mirroring configuration",
"script": "skills/branching-day/update-image-mirroring.sh"
},
{
"name": "commit-image-mirroring-pr",
"description": "Create commits for image mirroring PR",
"script": "skills/branching-day/commit-image-mirroring-pr.sh"
},
{
"name": "trigger-periodic-jobs",
"description": "Trigger periodic jobs via gangway with optional polling",
"script": "skills/common/trigger-periodic-jobs.sh"
},
{
"name": "update-jira-validation-post-branching",
"description": "Configure Jira validation criteria for X.Y+2 branches (post-branching)",
"script": "skills/post-branching/update-jira-validation-post-branching.sh"
},
{
"name": "verify-jira-validation",
"description": "Verify Jira validation config (re-run after fixes)",
"script": "skills/post-branching/verify-jira-validation.sh"
},
{
"name": "commit-jira-validation-pr",
"description": "Create commit and branch for Jira validation PR (post-branching)",
"script": "skills/post-branching/commit-jira-validation-pr.sh"
},
{
"name": "update-merge-blockers-job",
"description": "Update merge blockers job to track X.Y+2 (post-branching)",
"script": "skills/post-branching/update-merge-blockers-job.sh"
},
{
"name": "verify-merge-blockers-job",
"description": "Verify merge blockers job update (re-run after fixes)",
"script": "skills/post-branching/verify-merge-blockers-job.sh"
},
{
"name": "commit-merge-blockers-pr",
"description": "Create commit and branch for merge blockers PR (post-branching)",
"script": "skills/post-branching/commit-merge-blockers-pr.sh"
},
{
"name": "update-fast-forward-job",
"description": "Update fast-forward job for X.Y+2 (post-branching)",
"script": "skills/post-branching/update-fast-forward-job.sh"
},
{
"name": "verify-fast-forward-job",
"description": "Verify fast-forward job update (re-run after fixes)",
"script": "skills/post-branching/verify-fast-forward-job.sh"
},
{
"name": "commit-fast-forward-pr",
"description": "Create commit and branch for fast-forward PR (post-branching)",
"script": "skills/post-branching/commit-fast-forward-pr.sh"
},
{
"name": "create-config-jobs-x-y-plus-2",
"description": "Create CI operator configs and jobs for X.Y+2 (post-branching)",
"script": "skills/post-branching/create-config-jobs-x-y-plus-2.sh"
},
{
"name": "verify-config-jobs-x-y-plus-2",
"description": "Verify CI configs and jobs creation (re-run after fixes)",
"script": "skills/post-branching/verify-config-jobs-x-y-plus-2.sh"
},
{
"name": "commit-ci-configs-jobs-pr",
"description": "Create branch for CI configs and jobs PR (post-branching)",
"script": "skills/post-branching/commit-ci-configs-jobs-pr.sh"
},
{
"name": "update-auto-config-brancher-x-y-plus-2",
"description": "Update auto-config-brancher to maintain X.Y+2 (post-branching)",
"script": "skills/post-branching/update-auto-config-brancher-x-y-plus-2.sh"
},
{
"name": "verify-auto-config-brancher",
"description": "Verify auto-config-brancher job update (re-run after fixes)",
"script": "skills/post-branching/verify-auto-config-brancher.sh"
},
{
"name": "commit-auto-config-brancher-pr",
"description": "Create commit and branch for auto-config-brancher PR (post-branching)",
"script": "skills/post-branching/commit-auto-config-brancher-pr.sh"
},
{
"name": "update-image-mirroring-x-y-plus-2",
"description": "Update image mirroring config for X.Y+2 (post-branching)",
"script": "skills/post-branching/update-image-mirroring-x-y-plus-2.sh"
},
{
"name": "verify-image-mirroring-x-y-plus-2",
"description": "Verify image mirroring config update (re-run after fixes)",
"script": "skills/post-branching/verify-image-mirroring-x-y-plus-2.sh"
},
{
"name": "commit-image-mirroring-x-y-plus-2-pr",
"description": "Create commit and branch for image mirroring X.Y+2 PR (post-branching)",
"script": "skills/post-branching/commit-image-mirroring-x-y-plus-2-pr.sh"
},
{
"name": "verify-imagestream-tags",
"description": "Verify image stream tag counts match between versions (re-run after tagging)",
"script": "skills/post-branching/verify-imagestream-tags.sh"
},
{
"name": "tag-imagestreams",
"description": "Tag image streams from old version to new version",
"script": "skills/post-branching/tag-imagestreams.sh"
},
{
"name": "mirror-imagestreams-to-quay",
"description": "Mirror all image streams to Quay (7 streams: ocp, origin, ocp-private, and 4 variants)",
"script": "skills/post-branching/mirror-imagestreams-to-quay.sh"
}
],
"config": {
"RELEASE_REPO": "../release",
"CI_TOOLS_REPO": "."
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
set -euo pipefail

[ "$#" -ne 3 ] && echo "Usage: $0 <current> <future> <release-repo>" && exit 1

cd "$3"
[ "$(git branch --show-current)" != "config-brancher-$2" ] && echo "Error: Wrong branch" && exit 1

git diff --staged --quiet || git reset HEAD

git add ci-operator/config/ && \
git diff --staged --quiet || \
git commit -m "config-brancher --config-dir ./ci-operator/config --current-release=$1 --future-release=$2 --bump-release=$2 --confirm"

git add -A && \
git reset HEAD ci-operator/jobs/infra-periodics.yaml 2>/dev/null || true && \
git reset HEAD core-services/jira-lifecycle-plugin/config.yaml 2>/dev/null || true && \
git diff --staged --quiet || \
git commit -m "make update"

[ -f "ci-operator/jobs/infra-periodics.yaml" ] && \
git add ci-operator/jobs/infra-periodics.yaml && \
git diff --staged --quiet || \
git commit -m "bump periodic-prow-auto-config-brancher and periodic-openshift-release-fast-forward"

[ -f "core-services/jira-lifecycle-plugin/config.yaml" ] && \
git add core-services/jira-lifecycle-plugin/config.yaml && \
git diff --staged --quiet || \
git commit -m "bump versions in jira config"

echo "✓ Commits: $(git log --oneline origin/master..HEAD | wc -l)"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -euo pipefail

[ "$#" -ne 3 ] && echo "Usage: $0 <current> <future> <release-repo>" && exit 1

cd "$3"
[ "$(git branch --show-current)" != "image-mirroring-$2" ] && echo "Error: Wrong branch" && exit 1

git add core-services/image-mirroring/openshift/_config.yaml && git commit -m "bump image-mirroring config"
git add -A && git commit -m "make openshift-image-mirror-mappings"

echo "✓ Commits: $(git log --oneline origin/master..HEAD | wc -l)"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -euo pipefail

[ "$#" -ne 3 ] && echo "Usage: $0 <current> <future> <release-repo>" && exit 1

cd "$3"
[ "$(git branch --show-current)" != "tide-config-$2" ] && echo "Error: Wrong branch" && exit 1

git add core-services/prow/ && git commit -m "tide-config-manager make prow-config"
git add ci-operator/jobs/infra-periodics.yaml && git commit -m "bump periodic-openshift-release-merge-blockers"
git add ci-operator/jobs/infra-periodics.yaml && git commit -m "bump periodic-ocp-build-data-enforcer"

git diff --quiet core-services/prow/02_config/openshift/etcd/_prowconfig.yaml || \
(git add core-services/prow/02_config/openshift/etcd/_prowconfig.yaml && git commit -m "etcd manual change")

echo "✓ Commits: $(git log --oneline origin/master..HEAD | wc -l)"
14 changes: 14 additions & 0 deletions .claude/.claude-plugin/skills/branching-day/run-config-brancher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -euo pipefail

[ "$#" -ne 3 ] && echo "Usage: $0 <current-release> <future-release> <release-repo>" && exit 1
[ ! -d "$2" ] && echo "Error: Release repo not found" && exit 1
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix incorrect directory validation.

The script checks if $2 (future-release version string) is a directory, but it should check $3 (release-repo path). This causes the script to always fail with a misleading error message.

🔎 Proposed fix
-[ ! -d "$2" ] && echo "Error: Release repo not found" && exit 1
+[ ! -d "$3" ] && echo "Error: Release repo not found" && exit 1
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[ ! -d "$2" ] && echo "Error: Release repo not found" && exit 1
[ ! -d "$3" ] && echo "Error: Release repo not found" && exit 1
🤖 Prompt for AI Agents
In .claude/.claude-plugin/skills/branching-day/run-config-brancher.sh around
line 5, the script erroneously checks whether $2 (the future-release version
string) is a directory, causing a false "Release repo not found" error; change
the test to check $3 (the release-repo path) instead and keep the same
error/exit behavior so the script validates the repository path correctly.


config-brancher \
--config-dir "$3/ci-operator/config" \
--current-release="$1" \
--future-release="$2" \
--bump-release="$2" \
--confirm

echo "✓ config-brancher: $1 → $2"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -euo pipefail

[ "$#" -ne 2 ] && echo "Usage: $0 <current-release> <release-repo>" && exit 1
[ ! -d "$2" ] && echo "Error: Release repo not found" && exit 1

RELEASE_REPO=$(cd "$2" && pwd)

tide-config-manager \
--current-release="$1" \
--lifecycle-phase=branching \
--prow-config-dir="$RELEASE_REPO/core-services/prow/02_config/" \
--sharded-prow-config-base-dir="$RELEASE_REPO/core-services/prow/02_config/"

echo "✓ tide-config-manager: $1"
18 changes: 18 additions & 0 deletions .claude/.claude-plugin/skills/branching-day/update-etcd-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -euo pipefail

[ "$#" -ne 3 ] && echo "Usage: $0 <current> <future> <release-repo>" && exit 1

CURRENT="$1"
FUTURE="$2"
ETCD="$3/core-services/prow/02_config/openshift/etcd/_prowconfig.yaml"

[ ! -f "$ETCD" ] && echo "Error: etcd config not found" && exit 1

sed -i "/- openshift-4.20$/a\ - openshift-${CURRENT}" "$ETCD"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: Hardcoded version "openshift-4.20" will cause failures.

The script hardcodes "openshift-4.20" as an anchor point for inserting the current release. This creates multiple problems:

  • Breaks when OpenShift moves beyond 4.20: Once 4.20 is replaced with a newer version in the config, this script will fail to find the anchor.
  • Maintenance burden: Every time the anchor version changes, all automation needs to be updated.
  • Silent failure: If "openshift-4.20" isn't found, sed silently does nothing.
🔎 Dynamic anchor detection
-sed -i "/- openshift-4.20$/a\    - openshift-${CURRENT}" "$ETCD"
+# Find the last openshift version before our current release
+ANCHOR=$(grep -E "^\s+- openshift-[0-9]+\.[0-9]+$" "$ETCD" | \
+         grep -v "openshift-${CURRENT}" | \
+         tail -1 | \
+         sed 's/.*\(openshift-[0-9.]*\).*/\1/')
+
+if [ -z "$ANCHOR" ]; then
+    echo "Error: Could not find anchor version in etcd config"
+    exit 1
+fi
+
+sed -i "/- ${ANCHOR}$/a\    - openshift-${CURRENT}" "$ETCD"

This dynamically finds the last version entry before the current release to use as an anchor.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
sed -i "/- openshift-4.20$/a\ - openshift-${CURRENT}" "$ETCD"
# Find the last openshift version before our current release
ANCHOR=$(grep -E "^\s+- openshift-[0-9]+\.[0-9]+$" "$ETCD" | \
grep -v "openshift-${CURRENT}" | \
tail -1 | \
sed 's/.*\(openshift-[0-9.]*\).*/\1/')
if [ -z "$ANCHOR" ]; then
echo "Error: Could not find anchor version in etcd config"
exit 1
fi
sed -i "/- ${ANCHOR}$/a\ - openshift-${CURRENT}" "$ETCD"

sed -i "s/- openshift-${CURRENT}$/- openshift-${FUTURE}/" "$ETCD"
sed -i "/excludedBranches:/,/labels:/ {
/- openshift-${CURRENT}$/a\ - openshift-${FUTURE}
}" "$ETCD"

echo "✓ etcd config: $CURRENT → $FUTURE"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -euo pipefail

[ "$#" -ne 3 ] && echo "Usage: $0 <current> <future> <release-repo>" && exit 1

CONFIG="$3/core-services/image-mirroring/openshift/_config.yaml"
[ ! -f "$CONFIG" ] && echo "Error: Image mirroring config not found" && exit 1

echo "⚠ MANUAL EDIT REQUIRED"
echo ""
echo "Edit $CONFIG:"
echo " Remove 'latest' from: $1 (all variants)"
echo " Add 'latest' to: $2 (all variants)"
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -euo pipefail

[ "$#" -ne 3 ] && echo "Usage: $0 <current> <future> <release-repo>" && exit 1

CURRENT="$1"
FUTURE="$2"
INFRA="$3/ci-operator/jobs/infra-periodics.yaml"
JIRA="$3/core-services/jira-lifecycle-plugin/config.yaml"

[ ! -f "$INFRA" ] && echo "Error: infra-periodics.yaml not found" && exit 1
[ ! -f "$JIRA" ] && echo "Error: Jira config not found" && exit 1

sed -i "/name: periodic-prow-auto-config-brancher/,/name:/ {
s/base_ref: openshift-${CURRENT}/base_ref: openshift-${FUTURE}/
s/--current-release=${CURRENT}/--current-release=${FUTURE}/
s/--future-release=${CURRENT}/--future-release=${FUTURE}/
}" "$INFRA"

sed -i "/name: periodic-openshift-release-fast-forward$/,/secretName:/ {
s/--current-release=${CURRENT}/--current-release=${FUTURE}/
s/--future-release=${CURRENT}/--future-release=${FUTURE}/
}" "$INFRA"

sed -i "/^ main:/,/^ [a-z]/ {
s/target_version: ${CURRENT}\.0/target_version: ${FUTURE}.0/
}" "$JIRA"
sed -i "/^ master:/,/^ [a-z]/ {
s/target_version: ${CURRENT}\.0/target_version: ${FUTURE}.0/
}" "$JIRA"

echo "✓ infra-periodics + jira: $CURRENT → $FUTURE"
Loading