Skip to content

Conversation

@jhadvig
Copy link
Member

@jhadvig jhadvig commented Nov 3, 2025

Add /vendor slash command for automated PR preparation

A Claude Code slash command that automates the process of vendoring the openshift/api repository at a specific commit SHA.

Usage

/vendor <SHA>              # Vendor with auto-detected JIRA ID from branch name
/vendor <SHA> <JIRA-ID>    # Vendor with explicit JIRA ID
/vendor                    # Prompts for SHA if not provided

Features

  • JIRA Auto-detection: Automatically extracts JIRA ticket IDs from branch names matching CONSOLE-<number> or OCPBUGS-<number> patterns
  • Dependency Management: Updates go.mod, go.sum, and vendor/ directory
  • Automated Testing: Runs make test-unit and automatically fixes test failures (up to 3 attempts)
  • Smart Commits: Creates separate commits for:
    a. Dependency bump: : Bump openshift/api to
    b. Code fixes (if needed): :
  • Safety Checks: Verifies uncommitted changes and validates the SHA before proceeding

Workflow

  1. Parse arguments and detect JIRA ID from branch name or argument
  2. Check git status for uncommitted changes
  3. Show current openshift/api version
  4. Run go get github.com/openshift/api@
  5. Run go mod tidy && go mod vendor
  6. Verify changes with go mod verify
  7. Run unit tests and fix failures if needed
  8. Create commits (separate vendor bump from code fixes)
  9. Display summary of changes

Error Recovery

If the process fails, rollback with:

git reset --hard HEAD~1  # or HEAD~2

if both commits were created

/assign @TheRealJon @Leo6Leo @logonoff @cajieh

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Nov 3, 2025
@openshift-ci-robot
Copy link
Contributor

@jhadvig: This pull request explicitly references no jira issue.

In response to this:

Add /vendor slash command for automated PR preparation

A Claude Code slash command that automates the process of vendoring the openshift/api repository at a specific commit SHA.

Usage

/vendor <SHA>              # Vendor with auto-detected JIRA ID from branch name
/vendor <SHA> <JIRA-ID>    # Vendor with explicit JIRA ID
/vendor                    # Prompts for SHA if not provided

Features

  • JIRA Auto-detection: Automatically extracts JIRA ticket IDs from branch names matching CONSOLE-<number> or OCPBUGS-<number> patterns
  • Dependency Management: Updates go.mod, go.sum, and vendor/ directory
  • Automated Testing: Runs make test-unit and automatically fixes test failures (up to 3 attempts)
  • Smart Commits: Creates separate commits for:
    a. Dependency bump: : Bump openshift/api to
    b. Code fixes (if needed): :
  • Safety Checks: Verifies uncommitted changes and validates the SHA before proceeding

Workflow

  1. Parse arguments and detect JIRA ID from branch name or argument
  2. Check git status for uncommitted changes
  3. Show current openshift/api version
  4. Run go get github.com/openshift/api@
  5. Run go mod tidy && go mod vendor
  6. Verify changes with go mod verify
  7. Run unit tests and fix failures if needed
  8. Create commits (separate vendor bump from code fixes)
  9. Display summary of changes

Error Recovery

If the process fails, rollback with:

git reset --hard HEAD~1  # or HEAD~2

if both commits were created

/assign @TheRealJon @Leo6Leo @logonoff

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 3, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jhadvig

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

The pull request process is described here

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 3, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 3, 2025

@jhadvig: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/verify 88dee0e link true /test verify
ci/prow/e2e-aws-console 88dee0e link true /test e2e-aws-console

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Copy link
Contributor

@Leo6Leo Leo6Leo left a comment

Choose a reason for hiding this comment

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

Since this is specific for the openshift/api vendor, maybe a more specific command name can be found? (e.g. /api-bump or something like this).

Or if we want to turn this /vendor command to a more generic command (i.e. can be used for any go lang dependency bump / clean up). WDYT? @jhadvig

- Once fixed, create a brief summary of the fix nature for the commit message (store in `FIX` variable)

## 8. Commit Changes
Create one or two commits depending on whether code fixes were needed:
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like Claude to ask for approval before perform the commit action. Since I might want to inspect the changes that Claude made before committing and pushing to GitHub.


**Commit 1 - Dependency bump (always created):**
- Files: `go.mod`, `go.sum`, and `vendor/` directory
- Format: `<JIRA>: Bump openshift/api to <SHORT-SHA>` (if JIRA provided)
Copy link
Contributor

Choose a reason for hiding this comment

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

The format will be beneficial to specify both from to .... would be helpful for backtracing purposes.
Example would be:
<JIRA>: Bump openshift/api from <SHORT-SHA> to <SHORT-SHA>

**Commit 1 - Dependency bump (always created):**
- Files: `go.mod`, `go.sum`, and `vendor/` directory
- Format: `<JIRA>: Bump openshift/api to <SHORT-SHA>` (if JIRA provided)
- Format: `Bump openshift/api to <SHORT-SHA>` (if no JIRA)
Copy link
Contributor

Choose a reason for hiding this comment

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

The previous comment applies to here as well.

- Format: `Bump openshift/api to <SHORT-SHA>` (if no JIRA)
- Use first 7-8 characters of SHA for SHORT-SHA

**Commit 2 - Code fixes (only if fixes were needed):**
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, I would like Claude to ask for approval before perform any commit action, so that I can manually check and go through the changes that Claude made.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants