Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ tests:
test:
- chain: openshift-mcp-server-mcpchecker-eval-vertex
workflow: ipi-aws
- as: fast-forward-release-0-4
cron: 0 6 * * *
steps:
env:
DESTINATION_BRANCH: release-0.4
workflow: openshift-mcp-server-fastforward
zz_generated_metadata:
branch: main
org: openshift
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
periodics:
- agent: kubernetes
cluster: build01
cron: 0 6 * * *
decorate: true
decoration_config:
sparse_checkout_files:
- .ci-operator.yaml
- Dockerfile.ci
extra_refs:
- base_ref: main
org: openshift
repo: openshift-mcp-server
sparse_checkout_files:
- .ci-operator.yaml
- Dockerfile.ci
labels:
ci.openshift.io/generator: prowgen
pj-rehearse.openshift.io/can-be-rehearsed: "true"
name: periodic-ci-openshift-openshift-mcp-server-main-fast-forward-release-0-4
spec:
containers:
- args:
- --gcs-upload-secret=/secrets/gcs/service-account.json
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
- --lease-server-credentials-file=/etc/boskos/credentials
- --report-credentials-file=/etc/report/credentials
- --target=fast-forward-release-0-4
command:
- ci-operator
env:
- name: HTTP_SERVER_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
image: quay-proxy.ci.openshift.org/openshift/ci:ci_ci-operator_latest
imagePullPolicy: Always
name: ""
ports:
- containerPort: 8080
name: http
resources:
requests:
cpu: 10m
volumeMounts:
- mountPath: /etc/boskos
name: boskos
readOnly: true
- mountPath: /secrets/gcs
name: gcs-credentials
readOnly: true
- mountPath: /secrets/manifest-tool
name: manifest-tool-local-pusher
readOnly: true
- mountPath: /etc/pull-secret
name: pull-secret
readOnly: true
- mountPath: /etc/report
name: result-aggregator
readOnly: true
serviceAccountName: ci-operator
volumes:
- name: boskos
secret:
items:
- key: credentials
path: credentials
secretName: boskos-credentials
- name: manifest-tool-local-pusher
secret:
secretName: manifest-tool-local-pusher
- name: pull-secret
secret:
secretName: registry-pull-credentials
- name: result-aggregator
secret:
secretName: result-aggregator
16 changes: 16 additions & 0 deletions ci-operator/step-registry/openshift/mcp-server/fastforward/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
reviewers:
- 2uasimojo
- bentito
- cajieh
- Cali0707
- dlom
- grokspawn
- manusa
- matzew
- Kaustubh-pande
approvers:
- Cali0707
- manusa
- matzew
- Kaustubh-pande
component: "openshift-mcp-server"
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

set -euo pipefail

tmp_dir=$(mktemp -d -t ff-XXXXX)
cd "$tmp_dir" || exit 1
export HOME="$tmp_dir"

log_file="${ARTIFACT_DIR}/fastforward.log"
log() {
local ts
ts=$(date --iso-8601=seconds)
echo "$ts" "$@" | tee -a "$log_file"
}

log "INFO Fast-forward settings"
log " REPO_OWNER = $REPO_OWNER"
log " REPO_NAME = $REPO_NAME"
log " SOURCE_BRANCH = $SOURCE_BRANCH"
log " DESTINATION_BRANCH = $DESTINATION_BRANCH"

if [[ -z "$DESTINATION_BRANCH" ]]; then
log "ERROR DESTINATION_BRANCH may not be empty"
exit 1
fi
Comment on lines +16 to +25

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Validate SOURCE_BRANCH before logging and cloning.

The reference supplies main by default, but an override can be empty. The script checks only DESTINATION_BRANCH; an empty source reaches both git clone -b calls, and an unset source exits at the settings log because set -u runs before validation. Move both branch checks before the settings log and reject ${SOURCE_BRANCH:-}.

The analogous ci-operator/step-registry/windows/ci/fastforward/windows-ci-fastforward-commands.sh:114-122 validates both branch variables.

Proposed validation order
-log "INFO Fast-forward settings"
-log "    REPO_OWNER         = $REPO_OWNER"
-log "    REPO_NAME          = $REPO_NAME"
-log "    SOURCE_BRANCH      = $SOURCE_BRANCH"
-log "    DESTINATION_BRANCH = $DESTINATION_BRANCH"
-
-if [[ -z "$DESTINATION_BRANCH" ]]; then
+if [[ -z "${SOURCE_BRANCH:-}" ]]; then
+    log "ERROR SOURCE_BRANCH may not be empty"
+    exit 1
+fi
+if [[ -z "${DESTINATION_BRANCH:-}" ]]; then
     log "ERROR DESTINATION_BRANCH may not be empty"
     exit 1
 fi
+
+log "INFO Fast-forward settings"
+log "    REPO_OWNER         = $REPO_OWNER"
+log "    REPO_NAME          = $REPO_NAME"
+log "    SOURCE_BRANCH      = $SOURCE_BRANCH"
+log "    DESTINATION_BRANCH = $DESTINATION_BRANCH"
📝 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
log "INFO Fast-forward settings"
log " REPO_OWNER = $REPO_OWNER"
log " REPO_NAME = $REPO_NAME"
log " SOURCE_BRANCH = $SOURCE_BRANCH"
log " DESTINATION_BRANCH = $DESTINATION_BRANCH"
if [[ -z "$DESTINATION_BRANCH" ]]; then
log "ERROR DESTINATION_BRANCH may not be empty"
exit 1
fi
if [[ -z "${SOURCE_BRANCH:-}" ]]; then
log "ERROR SOURCE_BRANCH may not be empty"
exit 1
fi
if [[ -z "${DESTINATION_BRANCH:-}" ]]; then
log "ERROR DESTINATION_BRANCH may not be empty"
exit 1
fi
log "INFO Fast-forward settings"
log " REPO_OWNER = $REPO_OWNER"
log " REPO_NAME = $REPO_NAME"
log " SOURCE_BRANCH = $SOURCE_BRANCH"
log " DESTINATION_BRANCH = $DESTINATION_BRANCH"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@ci-operator/step-registry/openshift/mcp-server/fastforward/openshift-mcp-server-fastforward-commands.sh`
around lines 16 - 25, Update the fast-forward script’s startup validation to
check both SOURCE_BRANCH and DESTINATION_BRANCH before the settings log, using
${SOURCE_BRANCH:-} so an unset or empty source is rejected safely under set -u.
Preserve the existing error-and-exit behavior, then allow logging and subsequent
git clone operations only after both branch values are valid.


token=$(cat /etc/github/oauth)
repo_url="https://openshift-merge-robot:${token}@github.com/${REPO_OWNER}/${REPO_NAME}.git"

log "INFO Cloning $DESTINATION_BRANCH"
if ! git clone -b "$DESTINATION_BRANCH" "$repo_url" 2>&1 | tee -a "$log_file"; then
log "INFO $DESTINATION_BRANCH does not exist, creating from $SOURCE_BRANCH"
if ! git clone -b "$SOURCE_BRANCH" "$repo_url" 2>&1 | tee -a "$log_file"; then
log "ERROR Could not clone $SOURCE_BRANCH"
exit 1
fi
Comment on lines +30 to +36

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Do not treat every destination clone failure as a missing branch.

The condition also catches authentication, network, repository, and server failures. The script then retries from the source branch and may attempt an unnecessary branch creation and push. Distinguish a missing destination branch from other clone failures before entering the creation path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@ci-operator/step-registry/openshift/mcp-server/fastforward/openshift-mcp-server-fastforward-commands.sh`
around lines 30 - 36, Update the destination-branch clone handling in the
fast-forward command script so only a confirmed missing $DESTINATION_BRANCH
enters the fallback clone and branch-creation path. Preserve and propagate
authentication, network, repository, and server errors instead of treating them
as absent branches; use the existing git/logging flow and symbols without
changing successful clone behavior.

cd "$REPO_NAME" || exit 1
git checkout -b "$DESTINATION_BRANCH"
git push -u origin "$DESTINATION_BRANCH" 2>&1 | tee -a "$log_file"
log "INFO Created and pushed $DESTINATION_BRANCH"
exit 0
fi

cd "$REPO_NAME" || exit 1

log "INFO Pulling $SOURCE_BRANCH into $DESTINATION_BRANCH (ff-only)"
if ! git pull --ff-only origin "$SOURCE_BRANCH" 2>&1 | tee -a "$log_file"; then
log "ERROR Could not fast-forward from $SOURCE_BRANCH"
exit 1
fi

log "INFO Pushing to origin/$DESTINATION_BRANCH"
if ! git push 2>&1 | tee -a "$log_file"; then
log "ERROR Could not push to $DESTINATION_BRANCH"
exit 1
fi

log "INFO Fast-forward complete"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"path": "openshift/mcp-server/fastforward/openshift-mcp-server-fastforward-ref.yaml",
"owners": {
"approvers": [
"Cali0707",
"manusa",
"matzew",
"Kaustubh-pande"
],
"reviewers": [
"Cali0707",
"manusa",
"matzew",
"Kaustubh-pande"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ref:
as: openshift-mcp-server-fastforward
from_image:
name: cli
namespace: ocp
tag: latest
commands: openshift-mcp-server-fastforward-commands.sh
resources:
requests:
cpu: 100m
memory: 100Mi
credentials:
- namespace: ci
name: github-credentials-openshift-merge-robot
mount_path: /etc/github
env:
- name: SOURCE_BRANCH
default: "main"
documentation: |-
The branch to fast-forward FROM.
- name: DESTINATION_BRANCH
default: ""
documentation: |-
The branch to fast-forward TO. Required.
documentation: |-
Fast-forwards a source branch to a destination branch in the
openshift/openshift-mcp-server GitHub repo using openshift-merge-robot
credentials.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"path": "openshift/mcp-server/fastforward/openshift-mcp-server-fastforward-workflow.yaml",
"owners": {
"approvers": [
"Cali0707",
"manusa",
"matzew",
"Kaustubh-pande"
],
"reviewers": [
"Cali0707",
"manusa",
"matzew",
"Kaustubh-pande"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
workflow:
as: openshift-mcp-server-fastforward
steps:
test:
- ref: openshift-mcp-server-fastforward
Comment on lines +3 to +5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

file='ci-operator/step-registry/openshift/mcp-server/fastforward/openshift-mcp-server-fastforward-workflow.yaml'

printf '%s\n' '--- workflow ---'
cat -n "$file"

printf '%s\n' '--- related workflow phase declarations ---'
rg -n -U 'phases:|^[[:space:]]+(pre|test|post):' \
  ci-operator/step-registry/openshift/mcp-server \
  ci-operator/step-registry/openshift -g '*-workflow.yaml' | head -200

printf '%s\n' '--- workflow validation references ---'
rg -n 'validate-step-registry|workflow.*pre|workflow.*post|^[[:space:]]*pre:|^[[:space:]]*post:' \
  Makefile ci-operator/step-registry hack 2>/dev/null | head -240

printf '%s\n' '--- referenced step ---'
rg -n -U 'name: openshift-mcp-server-fastforward|openshift-mcp-server-fastforward' \
  ci-operator/step-registry | head -120

printf '%s\n' '--- file status ---'
git status --short -- "$file"
git diff --stat -- "$file"

Repository: openshift/release

Length of output: 50373


🏁 Script executed:

#!/bin/bash
set -eu

file='ci-operator/step-registry/openshift/mcp-server/fastforward/openshift-mcp-server-fastforward-workflow.yaml'

printf '%s\n' '--- validation target ---'
sed -n '155,178p' Makefile

printf '%s\n' '--- validator implementation references ---'
rg -n -i --glob '*.go' --glob '*.sh' --glob '*.py' \
  'validate-step-registry|step-registry.*valid|workflow.*phase|pre.*test.*post' . \
  | head -160

printf '%s\n' '--- exact phase-shape examples ---'
for f in \
  ci-operator/step-registry/telco5g/kpi-results/telco5g-kpi-results-workflow.yaml \
  ci-operator/step-registry/openshift/edge-tooling/agent-eval/openshift-edge-tooling-agent-eval-workflow.yaml \
  ci-operator/step-registry/openshift/agentic/trt/jira-solver/openshift-agentic-trt-jira-solver-workflow.yaml
do
  if test -f "$f"; then
    echo "--- $f"
    cat -n "$f"
  fi
done

printf '%s\n' '--- file tracking and change status ---'
git ls-files --error-unmatch "$file"
git diff --name-status -- "$file"
git diff --numstat -- "$file"

printf '%s\n' '--- referenced step definitions ---'
rg -n -C 3 '^name: openshift-mcp-server-fastforward$|^  as: openshift-mcp-server-fastforward$|ref: openshift-mcp-server-fastforward' \
  ci-operator/step-registry

Repository: openshift/release

Length of output: 7119


Declare the required pre, test, and post phases.

Add empty pre: [] and post: [] phases, then run make validate-step-registry.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@ci-operator/step-registry/openshift/mcp-server/fastforward/openshift-mcp-server-fastforward-workflow.yaml`
around lines 3 - 5, Update the workflow’s steps declaration to include empty pre
and post phases alongside the existing test phase, preserving the
openshift-mcp-server-fastforward test reference. Then run make
validate-step-registry to verify the step registry.

Source: Coding guidelines

documentation: |-
Fast-forwards a source branch to a destination branch in the
openshift/openshift-mcp-server GitHub repo.