-
Notifications
You must be signed in to change notification settings - Fork 321
Add README.md documentation for cmd/ tools #5259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Prucek
wants to merge
1
commit into
openshift:main
Choose a base branch
from
Prucek:rename-agents-to-readme
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # auto-testgrid-generator | ||
|
|
||
| ## What | ||
| Orchestrator that runs `testgrid-config-generator` to produce updated TestGrid dashboard configurations, then creates or updates a pull request against `kubernetes/test-infra` with the changes. This is the automation that keeps TestGrid dashboards in sync with the current set of OpenShift CI periodic jobs. | ||
|
|
||
| ## How it works -- full flow | ||
|
|
||
| 1. **Parse flags**: collects paths to the testgrid config directory, release controller config, Prow jobs directory, allow-list file, and git/PR creation options. | ||
|
|
||
| 2. **Run testgrid-config-generator**: executes `/usr/bin/testgrid-config-generator` as a subprocess with the following arguments: | ||
| - `-testgrid-config {dir}` -- where to write TestGrid YAML | ||
| - `-release-config {dir}` -- release controller configuration | ||
| - `-prow-jobs-dir {dir}` -- Prow periodic job definitions | ||
| - `-allow-list {file}` -- job classification overrides | ||
|
|
||
| 3. **Create or update PR**: uses `prcreation.PRCreationOptions.UpsertPR()` to: | ||
| - Check the git working directory for changes | ||
| - Create a branch and commit if changes exist | ||
| - Push to the fork and create a PR against `kubernetes/test-infra` (configurable with `--github-org`) | ||
| - If a PR with matching title already exists, force-push to update it | ||
| - PR title format: `Update OpenShift testgrid definitions by auto-testgrid-generator job at {timestamp}` | ||
| - Assigns the PR to `--assign` (default: `openshift/test-platform`) | ||
|
|
||
| ### PR matching | ||
| The tool uses title matching (`matchTitle`) to find existing PRs. If a PR with the prefix "Update OpenShift testgrid definitions by auto-testgrid-generator job" already exists, it updates that PR rather than creating a new one. | ||
|
|
||
| ## Flags | ||
| | Flag | Default | What it controls | | ||
| |---|---|---| | ||
| | `--testgrid-config` | (none) | Directory where TestGrid output YAML is stored | | ||
| | `--release-config` | (none) | Directory of release controller config files | | ||
| | `--prow-jobs-dir` | (none) | Directory of Prow job config files | | ||
| | `--allow-list` | (none) | File with release-type overrides | | ||
| | `--working-dir` | `.` | Git working directory | | ||
| | `--github-login` | `openshift-bot` | GitHub username for PR creation | | ||
| | `--github-org` | `kubernetes` | GitHub org (override for testing) | | ||
| | `--upstream-branch` | `master` | Target branch for the PR | | ||
| | `--assign` | `openshift/test-platform` | GitHub user or team to assign the PR to | | ||
| | `--git-name` | (from GitAuthorOptions) | Git author name for commits | | ||
| | `--git-email` | (from GitAuthorOptions) | Git author email for commits | | ||
| | (PRCreationOptions flags) | | GitHub token path, etc. | | ||
|
|
||
| ## Key files | ||
| - `cmd/auto-testgrid-generator/main.go` -- entry point, subprocess execution of testgrid-config-generator, PR creation | ||
| - `cmd/testgrid-config-generator/main.go` -- the actual TestGrid config generation logic (invoked as a binary) | ||
| - `pkg/github/prcreation/` -- PR creation/update library | ||
|
|
||
| ## Deployment | ||
| Periodic Prow job. The container image includes both the `auto-testgrid-generator` and `testgrid-config-generator` binaries (the latter at `/usr/bin/testgrid-config-generator`). The job runs with a GitHub token for PR creation against `kubernetes/test-infra`. | ||
|
|
||
| ## Related | ||
| - `cmd/testgrid-config-generator` -- the actual generation logic, invoked as a subprocess | ||
| - Target repo: `kubernetes/test-infra` (TestGrid configuration lives there) | ||
| - TestGrid dashboards: `https://testgrid.k8s.io/redhat-openshift-*` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,61 @@ | ||
| # Auto publicize config | ||
| # autopublicizeconfig | ||
|
|
||
| This tool re-generates the publicize plugin configuration file and | ||
| submits a pull request against the openshift/release repository. | ||
| ## What | ||
| Automation tool that generates the configuration file for the `publicize` plugin by discovering all repos that need private-to-public mirroring. It scans ci-operator configs and the whitelist to find repos building official images, computes the `openshift-priv/{repo}` to `{org}/{repo}` mapping, writes the config, and creates a PR on `openshift/release`. | ||
|
|
||
| This is the config generator for the `publicize` webhook plugin. It keeps the publicize config in sync as repos are added to or removed from the private org. | ||
|
|
||
| ## How it works -- full flow | ||
|
|
||
| 1. Initialize GitHub client and secrets | ||
| 2. Scan ci-operator configs at `{release-repo-path}/ci-operator/config/` for repos that build official images (`api.BuildsAnyOfficialImages` with `WithoutOKD`) | ||
| 3. Add all repos from the whitelist file | ||
| 4. For each discovered `{org}/{repo}`: | ||
| - Compute the private repo name using `MirroredRepoName()` with the flattened orgs set | ||
| - Create the mapping: `openshift-priv/{mirroredName}` -> `{org}/{repo}` | ||
| 5. Marshal the config as YAML and write to `--publicize-config` path, creating directories as needed | ||
| 6. Check for git changes using `bumper.HasChanges()` | ||
| 7. If no changes, exit cleanly | ||
| 8. If running in dry-run mode, log and exit | ||
| 9. If changes exist and not dry-run: | ||
| - Create a commit with title: `"Automate publicize configuration sync {RFC1123 timestamp}"` | ||
| - Push to the `auto-publicize-sync` branch on `openshift/release` | ||
| - Create or update a PR via `bumper.UpdatePullRequestWithLabels()`: | ||
| - Target: `openshift/release` default branch | ||
| - Source: `{github-login}:auto-publicize-sync` | ||
| - Description: "Updates the publicize plugin configuration" | ||
| - If `--self-approve` is set, add `approved` and `lgtm` labels | ||
|
|
||
| ## Generated config format | ||
| ```yaml | ||
| repositories: | ||
| openshift-priv/installer: openshift/installer | ||
| openshift-priv/cluster-version-operator: openshift/cluster-version-operator | ||
| openshift-priv/stolostron-multicloud-operators-subscription: stolostron/multicloud-operators-subscription | ||
| ``` | ||
|
|
||
| ## Flags | ||
| | Flag | Default | What it controls | | ||
| |---|---|---| | ||
| | `--dry-run` | `true` | When true, writes config but does not create PR | | ||
| | `--self-approve` | `false` | Add `approved` and `lgtm` labels to the PR | | ||
| | `--github-login` | `openshift-bot` | GitHub username for push and PR creation | | ||
| | `--git-name` | `""` | Git commit author name (must pair with `--git-email`) | | ||
| | `--git-email` | `""` | Git commit author email (must pair with `--git-name`) | | ||
| | `--publicize-config` | (required) | Path where the generated publicize config will be written | | ||
| | `--release-repo-path` | (required) | Path to openshift/release repository directory | | ||
| | `--flatten-org` | (repeatable) | Additional orgs whose repos should not have org prefix | | ||
| | `--whitelist-file` | `""` | Path to YAML file listing repos to include | | ||
| | GitHub flags | | Standard Prow GitHub options | | ||
|
|
||
| ## Key files | ||
| - `cmd/autopublicizeconfig/main.go` -- all logic in this single file | ||
| - `cmd/publicize/` -- the webhook plugin that consumes the generated config | ||
| - `pkg/privateorg/flatten.go` -- `MirroredRepoName()` naming logic | ||
|
|
||
| ## Deployment | ||
| Periodic Prow job. Creates PRs against the `openshift/release` repository on branch `auto-publicize-sync`. | ||
|
|
||
| ## Related | ||
| - `cmd/publicize` -- the webhook plugin that uses the generated config | ||
| - `cmd/ci-operator-config-mirror` -- uses the same repo discovery logic for a different purpose |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: openshift/ci-tools
Length of output: 867
🏁 Script executed:
Repository: openshift/ci-tools
Length of output: 6159
🏁 Script executed:
Repository: openshift/ci-tools
Length of output: 44
🏁 Script executed:
Repository: openshift/ci-tools
Length of output: 120
🏁 Script executed:
Repository: openshift/ci-tools
Length of output: 2034
🏁 Script executed:
Repository: openshift/ci-tools
Length of output: 133
🏁 Script executed:
Repository: openshift/ci-tools
Length of output: 44
Remove or implement the
--rebalancer-cronflag and step.The README documents a
--rebalancer-cronflag and optional rebalancer step (lines 22, 48), but neither exist in the implementation. The flag is not defined in FutureOptions or anywhere in main.go, and there is no logic to prepend a rebalancer step. Either remove these from the documentation or implement the feature.🤖 Prompt for AI Agents