Skip to content

Conversation

@matzew
Copy link

@matzew matzew commented Nov 14, 2025

Add /git:sync-downstream command to automate syncing downstream forks with upstream repositories while preserving downstream-specific files.

Key features:

  • Merges upstream/main into downstream using -s ours strategy
  • Preserves downstream files listed in .downstream-preserve config
  • Automatically updates Go vendor dependencies
  • Creates single commit with all changes
  • Supports --dry-run mode for preview

This addresses a common OpenShift workflow where projects maintain forks of upstream repositories with custom CI/CD, build configs, and governance files that need to be preserved during upstream syncs.

Usage:
/git:sync-downstream [--dry-run]

Configuration:
Create .downstream-preserve file listing files to preserve:
.ci-operator.yaml
.tekton/
OWNERS
renovate.json

🤖 Generated with Claude Code

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added /git:sync-downstream command to synchronize downstream forks with upstream while preserving downstream-specific files, with optional --dry-run flag for preview mode.
  • Documentation

    • Added comprehensive documentation including command usage examples, configuration file format, and typical workflows.

Add /git:sync-downstream command to automate syncing downstream forks
with upstream repositories while preserving downstream-specific files.

Key features:
- Merges upstream/main into downstream using -s ours strategy
- Preserves downstream files listed in .downstream-preserve config
- Automatically updates Go vendor dependencies
- Creates single commit with all changes
- Supports --dry-run mode for preview

This addresses a common OpenShift workflow where projects maintain
forks of upstream repositories with custom CI/CD, build configs, and
governance files that need to be preserved during upstream syncs.

Usage:
  /git:sync-downstream [--dry-run]

Configuration:
  Create .downstream-preserve file listing files to preserve:
    .ci-operator.yaml
    .tekton/
    OWNERS
    renovate.json

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@openshift-ci openshift-ci bot requested review from dgoodwin and mrunalp November 14, 2025 09:47
@openshift-ci
Copy link

openshift-ci bot commented Nov 14, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: matzew
Once this PR has been reviewed and has the lgtm label, please assign stleerh for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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
Copy link

openshift-ci bot commented Nov 14, 2025

Hi @matzew. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 14, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

Walkthrough

Adds documentation for a new Git plugin command sync-downstream that synchronizes a downstream fork with upstream while preserving downstream-specific files, with optional --dry-run flag support. The command is registered in the plugin manifest and documented across multiple documentation files.

Changes

Cohort / File(s) Summary
Command Registration
docs/data.json
Adds new sync-downstream command entry to git plugin commands list with description, synopsis, and argument hint for dry-run flag
Plugin Documentation
PLUGINS.md, plugins/git/README.md, plugins/git/commands/sync-downstream.md
Adds command documentation sections: high-level overview in main plugin file, detailed command reference in dedicated markdown file covering workflow, prerequisites, dry-run behavior, error handling, configuration format, examples, and related commands

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • All changes are documentation additions that follow existing patterns
  • Primary focus: verify command description accuracy, synopsis clarity, and consistency across documentation files
  • Ensure examples are correct and configuration format is properly specified

Pre-merge checks and finishing touches

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)
Check name Status Explanation Resolution
No Assumed Git Remote Names ❌ Error The sync-downstream command documentation assumes hardcoded git remote names 'upstream' and 'downstream' without discovering them first. Update documentation to require users verify remotes exist via 'git remote -v' or accept remote name parameters instead of assuming fixed names.
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately summarizes the main change: adding a new sync-downstream command to the git plugin for fork maintenance.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
No Real People Names In Style References ✅ Passed No references to real people's names found in style references, plugin commands, skill documentation, example prompts, or instructions in the modified files.
Git Push Safety Rules ✅ Passed The PR introduces a sync-downstream command with only documentation files; no git push operations or executable code implementing autonomous pushes were found.
No Untrusted Mcp Servers ✅ Passed PR only adds documentation and command metadata for a git sync-downstream feature with no MCP server installations or untrusted dependencies introduced.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
plugins/git/commands/sync-downstream.md (1)

10-10: Add language specifiers to code blocks.

The markdown linter identifies 6 fenced code blocks without language specifiers. Add appropriate language identifiers to improve documentation clarity and enable syntax highlighting.

Apply these diffs to add language specifiers:

  ## Synopsis
  • /git:sync-downstream [--dry-run]

```diff
  2. **Configuration file must exist:**
     Create a `.downstream-preserve` file in repository root listing files/directories to preserve from downstream:
-    ```
+    ```bash
     # Example .downstream-preserve
     .ci-operator.yaml
     .tekton/
     Dockerfile.ci
     OWNERS
     renovate.json
     ```
  ### Output
  
  After successful execution, show:
  - ✅ Commit hash and message
  - 📊 Summary of changes: `git diff --stat downstream/main..HEAD | tail -1`
  - 📝 Next steps:
-   ```
+   ```bash
    # Push the branch
    git push origin sync-downstream
  
    # Create pull request
    gh pr create --base downstream/main --title "Sync with upstream main"
    ```
  **Output:**
- ```
+ ```
  ✅ Created sync-downstream branch from upstream/main
  ✅ Merged downstream/main with -s ours strategy
  ✅ Restored 9 downstream files from .downstream-preserve
  ✅ Updated Go dependencies (vendor/)
  ✅ Committed: abc1234 "sync: merge upstream main with downstream config"
  
  📊 Changes: 45 files changed, 892 insertions(+), 234 deletions(-)
  
  📝 Next steps:
    git push origin sync-downstream
    gh pr create --base downstream/main --title "Sync with upstream main"

```diff
  **Output:**
- ```
+ ```
  🔍 DRY RUN MODE - No changes will be committed
  
  ✅ Fetched upstream and downstream
  ✅ Would create sync-downstream branch from upstream/main
  ✅ Would restore these downstream files:
     - .ci-operator.yaml
     - .tekton/
     - Dockerfile.ci
     - OWNERS
     - renovate.json
  
  📊 Would change: 45 files changed, 892 insertions(+), 234 deletions(-)
  
  Use /git:sync-downstream (without --dry-run) to apply these changes.

```diff
  **Example:**
- ```
+ ```
  # CI/CD configurations
  .ci-operator.yaml
  .snyk
  .tekton/
  
  # Build files
  Dockerfile.ci
  Dockerfile.ocp
  Makefile-ocp.mk
  
  # Governance
  OWNERS
  
  # Configuration
  mcp_config.toml
  renovate.json



Also applies to: 45-45, 116-116, 154-154, 175-175, 234-234

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used**: Path: .coderabbit.yaml

**Review profile**: CHILL

**Plan**: Pro

**Cache: Disabled due to data retention organization setting**

**Knowledge base: Disabled due to data retention organization setting**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between aeea2772a5824a15ed61260d66ebd47eaca322ee and 259f75bc5a632b7e3fa30b3b589f7e9143d4a326.

</details>

<details>
<summary>📒 Files selected for processing (4)</summary>

* `PLUGINS.md` (1 hunks)
* `docs/data.json` (1 hunks)
* `plugins/git/README.md` (1 hunks)
* `plugins/git/commands/sync-downstream.md` (1 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.18.1)</summary>

<details>
<summary>plugins/git/commands/sync-downstream.md</summary>

10-10: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

45-45: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

116-116: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

154-154: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

175-175: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

234-234: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

</details>

<details>
<summary>🔇 Additional comments (4)</summary><blockquote>

<details>
<summary>plugins/git/README.md (1)</summary><blockquote>

`23-25`: **LGTM!**

The new command documentation is properly placed and concise, following the established pattern in the README.

</blockquote></details>
<details>
<summary>PLUGINS.md (1)</summary><blockquote>

`86-86`: **LGTM!**

The command entry is properly formatted and positioned, consistent with neighboring commands.

</blockquote></details>
<details>
<summary>docs/data.json (1)</summary><blockquote>

`46-51`: **LGTM!**

The command metadata is properly structured and positioned in the data manifest.

</blockquote></details>
<details>
<summary>plugins/git/commands/sync-downstream.md (1)</summary><blockquote>

`1-294`: **Excellent documentation coverage.**

The sync-downstream command documentation is well-structured and comprehensive, providing clear prerequisites, step-by-step implementation details, multiple usage examples, error handling guidance, and practical workflow patterns. This will effectively support users adopting the command for downstream fork maintenance.

</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@stbenjam
Copy link
Member

Please join the openshift-eng org to get your PR tested. Once you're in the org, close and re-open the PR to retrigger evaluation of your org membership.

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

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants