|
| 1 | +--- |
| 2 | +description: Bump the release version in ci-operator config files |
| 3 | +--- |
| 4 | + |
| 5 | +## Name |
| 6 | +bump-release-version |
| 7 | + |
| 8 | +## Synopsis |
| 9 | +``` |
| 10 | +/bump-release-version <config-file>[,<config-file>...] [--bump=N] |
| 11 | +``` |
| 12 | + |
| 13 | +## Description |
| 14 | + |
| 15 | +The `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. |
| 16 | + |
| 17 | +**Usage Examples:** |
| 18 | + |
| 19 | +1. **Bump a single config file by 1 minor version (default)**: |
| 20 | + ``` |
| 21 | + /bump-release-version openshift-verification-tests-main__installation-nightly-4.21.yaml |
| 22 | + ``` |
| 23 | + Creates: `openshift-verification-tests-main__installation-nightly-4.22.yaml` |
| 24 | + |
| 25 | +2. **Bump by 2 minor versions**: |
| 26 | + ``` |
| 27 | + /bump-release-version openshift-verification-tests-main__ota-multi-stable-4.20-cpou-upgrade-from-stable-4.18.yaml -b 2 |
| 28 | + ``` |
| 29 | + Creates: `openshift-verification-tests-main__ota-multi-stable-4.22-cpou-upgrade-from-stable-4.20.yaml` |
| 30 | + |
| 31 | +3. **Bump multiple files**: |
| 32 | + ``` |
| 33 | + /bump-release-version file1-4.21.yaml,file2-4.21.yaml |
| 34 | + ``` |
| 35 | + |
| 36 | +## Implementation |
| 37 | + |
| 38 | +### Phase 1: Input Parsing and Validation |
| 39 | + |
| 40 | +1. **Parse arguments**: |
| 41 | + - Extract comma-separated config file names |
| 42 | + - Parse optional `--bump=N` or `-b N` parameter (default: 1) |
| 43 | + - Validate bump increment is a positive integer |
| 44 | + |
| 45 | +2. **Locate files**: |
| 46 | + - Check current working directory |
| 47 | + - Report missing files and skip them |
| 48 | + |
| 49 | +### Phase 2: Version Detection |
| 50 | + |
| 51 | +For each file: |
| 52 | + |
| 53 | +1. **Read file content** and identify current version from: |
| 54 | + - Filename pattern: `*-4.21.yaml` |
| 55 | + - `base_images[*].name` fields: `"4.21"` |
| 56 | + - `releases[*].version` fields: `"4.21"` |
| 57 | + - `zz_generated_metadata.variant`: `installation-nightly-4.21` |
| 58 | + |
| 59 | +2. **Calculate target version**: |
| 60 | + - Parse as MAJOR.MINOR format (e.g., 4.21) |
| 61 | + - Apply formula: `NEW_MINOR = CURRENT_MINOR + BUMP_INCREMENT` |
| 62 | + - Examples: |
| 63 | + - 4.21 + bump=1 → 4.22 |
| 64 | + - 4.20 + bump=2 → 4.22 |
| 65 | + |
| 66 | +### Phase 3: File Generation |
| 67 | + |
| 68 | +1. **Replace all version references** throughout the file: |
| 69 | + - `base_images[*].name`: `"4.21"` → `"4.22"` |
| 70 | + - `releases[*].version`: `"4.21"` → `"4.22"` |
| 71 | + - `zz_generated_metadata.variant`: `installation-nightly-4.21` → `installation-nightly-4.22` |
| 72 | + |
| 73 | +2. **Generate new cron schedules** for ALL test entries: |
| 74 | + - Preserve test frequency from original cron |
| 75 | + - Analyze original cron to identify frequency pattern: |
| 76 | + - f7 (weekly): 4 runs/month, all months (e.g., `2,9,16,23 * *`) |
| 77 | + - f14 (biweekly): 2 runs/month, all months (e.g., `5,19 * *`) |
| 78 | + - f28 (monthly): 1 run/month, all months (e.g., `12 * *`) |
| 79 | + - f60 (every 2 months): 1 run, alternating months (e.g., `7 2,4,6,8,10,12 *`) |
| 80 | + |
| 81 | + - Generate new random cron maintaining same frequency: |
| 82 | + - Always randomize: MINUTE (0-59), HOUR (0-23) |
| 83 | + - Preserve exactly: MONTH pattern (e.g., `2,4,6,8,10,12` stays `2,4,6,8,10,12`) |
| 84 | + - Randomize with same count: DAY values (e.g., 2 days → 2 different days) |
| 85 | + - Preserve: DOW (day of week) pattern |
| 86 | + |
| 87 | + - Examples: |
| 88 | + ``` |
| 89 | + Original: 32 14 2,9,16,23 * * (f7 - weekly) |
| 90 | + New: 45 8 3,10,17,24 * * (still f7 - different times, same frequency) |
| 91 | +
|
| 92 | + Original: 21 6 5,19 * * (f14 - biweekly) |
| 93 | + New: 18 12 7,21 * * (still f14 - different times, same frequency) |
| 94 | +
|
| 95 | + Original: 33 23 7 2,4,6,8,10,12 * * (f60 - even months) |
| 96 | + New: 40 10 15 2,4,6,8,10,12 * * (still f60 - same months, different day/time) |
| 97 | + ``` |
| 98 | +
|
| 99 | +3. **Write new file** with bumped version in filename: |
| 100 | + - Input: `openshift-verification-tests-main__installation-nightly-4.21.yaml` |
| 101 | + - Output: `openshift-verification-tests-main__installation-nightly-4.22.yaml` |
| 102 | +
|
| 103 | +### Phase 4: Verification |
| 104 | +
|
| 105 | +1. **Compare files** line-by-line to verify ONLY these changed: |
| 106 | + - Version numbers (all occurrences) |
| 107 | + - Cron schedules |
| 108 | +
|
| 109 | +2. **Report changes**: |
| 110 | + - Count version replacements |
| 111 | + - Count cron schedule updates |
| 112 | + - Flag any unexpected differences |
| 113 | +
|
| 114 | +### Phase 5: Summary Report |
| 115 | +
|
| 116 | +Provide structured summary: |
| 117 | +
|
| 118 | +``` |
| 119 | +Processing 1 file(s)... |
| 120 | +Bump increment: 1 |
| 121 | + |
| 122 | +[1/1] Processing: openshift-verification-tests-main__installation-nightly-4.21.yaml |
| 123 | + ✓ File exists |
| 124 | + ✓ Detected version: 4.21 |
| 125 | + ✓ Target version: 4.22 |
| 126 | + ✓ Created: openshift-verification-tests-main__installation-nightly-4.22.yaml |
| 127 | + ✓ Version replacements: 47 |
| 128 | + ✓ Cron schedules updated: 85 |
| 129 | + ✓ Verification passed |
| 130 | + |
| 131 | +Summary: |
| 132 | +┌────────────────────────────────────────────────────────────────┬──────────┬────────┐ |
| 133 | +│ File │ Version │ Status │ |
| 134 | +├────────────────────────────────────────────────────────────────┼──────────┼────────┤ |
| 135 | +│ openshift-verification-tests-main__installation-nightly-4.21 │ 4.21→4.22│ ✓ │ |
| 136 | +└────────────────────────────────────────────────────────────────┴──────────┴────────┘ |
| 137 | + |
| 138 | +Total: 1 processed, 1 successful, 0 failed |
| 139 | +``` |
| 140 | +
|
| 141 | +## Arguments |
| 142 | +
|
| 143 | +- **`<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. |
| 144 | +
|
| 145 | +- **`--bump=N`** or **`-b N`** (optional, default: 1): Number of minor versions to bump. Must be a positive integer. |
| 146 | +
|
| 147 | +## Important Notes |
| 148 | +
|
| 149 | +- This command creates **NEW** files; it does NOT modify the original files |
| 150 | +- Generated files should be reviewed before committing |
| 151 | +- After generation, run `make jobs` to update Prow job configurations |
| 152 | +- Ensure the new version is valid for the OpenShift release you're targeting |
| 153 | +
|
0 commit comments