-
Notifications
You must be signed in to change notification settings - Fork 97
[prow-job]add bump-release-version command for updating prow jobs #89
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
Open
jiajliu
wants to merge
1
commit into
openshift-eng:main
Choose a base branch
from
jiajliu:bump
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.
+160
−0
Open
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,153 @@ | ||
| --- | ||
| description: Bump the release version in ci-operator config files | ||
| --- | ||
|
|
||
| ## Name | ||
| prow-job:bump-release-version | ||
|
|
||
| ## Synopsis | ||
| ``` | ||
| /prow-job:bump-release-version <config-file>[,<config-file>...] [--bump=N] | ||
| ``` | ||
|
|
||
| ## Description | ||
|
|
||
| The `prow-job:bump-release-version` command creates new ci-operator config files with bumped OpenShift release versions. It intelligently updates all version references, generates new random cron schedules while preserving test frequencies, and creates properly named output files. | ||
|
|
||
| **Usage Examples:** | ||
|
|
||
| 1. **Bump a single config file by 1 minor version (default)**: | ||
| ``` | ||
| /prow-job:bump-release-version openshift-verification-tests-main__installation-nightly-4.21.yaml | ||
| ``` | ||
| Creates: `openshift-verification-tests-main__installation-nightly-4.22.yaml` | ||
|
|
||
| 2. **Bump by 2 minor versions**: | ||
| ``` | ||
| /prow-job:bump-release-version openshift-verification-tests-main__ota-multi-stable-4.20-cpou-upgrade-from-stable-4.18.yaml -b 2 | ||
| ``` | ||
| Creates: `openshift-verification-tests-main__ota-multi-stable-4.22-cpou-upgrade-from-stable-4.20.yaml` | ||
|
|
||
| 3. **Bump multiple files**: | ||
| ``` | ||
| /prow-job:bump-release-version file1-4.21.yaml,file2-4.21.yaml | ||
| ``` | ||
|
|
||
| ## Implementation | ||
|
|
||
| ### Phase 1: Input Parsing and Validation | ||
|
|
||
| 1. **Parse arguments**: | ||
| - Extract comma-separated config file names | ||
| - Parse optional `--bump=N` or `-b N` parameter (default: 1) | ||
| - Validate bump increment is a positive integer | ||
|
|
||
| 2. **Locate files**: | ||
| - Check current working directory | ||
| - Report missing files and skip them | ||
|
|
||
| ### Phase 2: Version Detection | ||
|
|
||
| For each file: | ||
|
|
||
| 1. **Read file content** and identify current version from: | ||
| - Filename pattern: `*-4.21.yaml` | ||
| - `base_images[*].name` fields: `"4.21"` | ||
| - `releases[*].version` fields: `"4.21"` | ||
| - `zz_generated_metadata.variant`: `installation-nightly-4.21` | ||
|
|
||
| 2. **Calculate target version**: | ||
| - Parse as MAJOR.MINOR format (e.g., 4.21) | ||
| - Apply formula: `NEW_MINOR = CURRENT_MINOR + BUMP_INCREMENT` | ||
| - Examples: | ||
| - 4.21 + bump=1 → 4.22 | ||
| - 4.20 + bump=2 → 4.22 | ||
|
|
||
| ### Phase 3: File Generation | ||
|
|
||
| 1. **Replace all version references** throughout the file: | ||
| - `base_images[*].name`: `"4.21"` → `"4.22"` | ||
| - `releases[*].version`: `"4.21"` → `"4.22"` | ||
| - `zz_generated_metadata.variant`: `installation-nightly-4.21` → `installation-nightly-4.22` | ||
|
|
||
| 2. **Generate new cron schedules** for ALL test entries: | ||
| - Preserve test frequency from original cron | ||
| - Analyze original cron to identify frequency pattern: | ||
| - f7 (weekly): 4 runs/month, all months (e.g., `2,9,16,23 * *`) | ||
| - f14 (biweekly): 2 runs/month, all months (e.g., `5,19 * *`) | ||
| - f28 (monthly): 1 run/month, all months (e.g., `12 * *`) | ||
| - f60 (every 2 months): 1 run, alternating months (e.g., `7 2,4,6,8,10,12 *`) | ||
|
|
||
| - Generate new random cron maintaining same frequency: | ||
| - Always randomize: MINUTE (0-59), HOUR (0-23) | ||
| - Preserve exactly: MONTH pattern (e.g., `2,4,6,8,10,12` stays `2,4,6,8,10,12`) | ||
| - Randomize with same count: DAY values (e.g., 2 days → 2 different days) | ||
| - Preserve: DOW (day of week) pattern | ||
|
|
||
| - Examples: | ||
| ``` | ||
| Original: 32 14 2,9,16,23 * * (f7 - weekly) | ||
| New: 45 8 3,10,17,24 * * (still f7 - different times, same frequency) | ||
| Original: 21 6 5,19 * * (f14 - biweekly) | ||
| New: 18 12 7,21 * * (still f14 - different times, same frequency) | ||
| Original: 33 23 7 2,4,6,8,10,12 * * (f60 - even months) | ||
| New: 40 10 15 2,4,6,8,10,12 * * (still f60 - same months, different day/time) | ||
| ``` | ||
| 3. **Write new file** with bumped version in filename: | ||
| - Input: `openshift-verification-tests-main__installation-nightly-4.21.yaml` | ||
| - Output: `openshift-verification-tests-main__installation-nightly-4.22.yaml` | ||
| ### Phase 4: Verification | ||
| 1. **Compare files** line-by-line to verify ONLY these changed: | ||
| - Version numbers (all occurrences) | ||
| - Cron schedules | ||
| 2. **Report changes**: | ||
| - Count version replacements | ||
| - Count cron schedule updates | ||
| - Flag any unexpected differences | ||
| ### Phase 5: Summary Report | ||
| Provide structured summary: | ||
| ``` | ||
| Processing 1 file(s)... | ||
| Bump increment: 1 | ||
|
|
||
| [1/1] Processing: openshift-verification-tests-main__installation-nightly-4.21.yaml | ||
| ✓ File exists | ||
| ✓ Detected version: 4.21 | ||
| ✓ Target version: 4.22 | ||
| ✓ Created: openshift-verification-tests-main__installation-nightly-4.22.yaml | ||
| ✓ Version replacements: 47 | ||
| ✓ Cron schedules updated: 85 | ||
| ✓ Verification passed | ||
|
|
||
| Summary: | ||
| ┌────────────────────────────────────────────────────────────────┬──────────┬────────┐ | ||
| │ File │ Version │ Status │ | ||
| ├────────────────────────────────────────────────────────────────┼──────────┼────────┤ | ||
| │ openshift-verification-tests-main__installation-nightly-4.21 │ 4.21→4.22│ ✓ │ | ||
| └────────────────────────────────────────────────────────────────┴──────────┴────────┘ | ||
|
|
||
| Total: 1 processed, 1 successful, 0 failed | ||
| ``` | ||
| ## Arguments | ||
| - **`<config-file>[,<config-file>...]`** (required): One or more ci-operator config filenames, comma-separated. Files can be in current directory or `ci-operator/config/` subdirectories. | ||
| - **`--bump=N`** or **`-b N`** (optional, default: 1): Number of minor versions to bump. Must be a positive integer. | ||
| ## Important Notes | ||
| - This command creates **NEW** files; it does NOT modify the original files | ||
| - Generated files should be reviewed before committing | ||
| - After generation, run `make jobs` to update Prow job configurations | ||
| - Ensure the new version is valid for the OpenShift release you're targeting | ||
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.
Add language specifiers to all fenced code blocks.
Markdown best practices require specifying a language identifier for all fenced code blocks to enable syntax highlighting. The blocks at these lines are missing language specifiers:
```bashor```shell```text(for example output) or```bash```text(for example output)Apply this diff to fix the code block at line 9 as an example:
Repeat this pattern for the remaining code blocks.
Also applies to: 20-22, 26-28, 32-34, 88-97, 118-139
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
9-9: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents