Skip to content

Commit 899a877

Browse files
committed
Update bump-periodics.sh
The path of the config directory changed in the release repository. Copy TP jobs as well. Drop code that would remove out of support releases. This is not reliable with newer long term releases so we do the cleanup manually. Also, point all maintenance jobs to nightly (TP and upgrade, and not just the main jobs). And finally, do not update the interval as these were not consistent and are likely better left off for now.
1 parent c577df2 commit 899a877

File tree

1 file changed

+22
-65
lines changed

1 file changed

+22
-65
lines changed

bump-periodics.sh

Lines changed: 22 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -6,80 +6,37 @@ set -Eeuo pipefail
66
# "$0" 4.12 ~/code/src/github.com/openshift/release
77

88
NEW_VERSION="$1"
9-
PERIODICS_DIR="${2}/ci-operator/config/shiftstack/shiftstack-ci"
9+
PERIODICS_DIR="${2}/ci-operator/config/shiftstack/ci"
1010

1111
OLD_VERSION="4.$(( ${NEW_VERSION#4.} - 1 ))"
1212
OLD_OLD_VERSION="4.$(( ${OLD_VERSION#4.} - 1 ))"
13-
OUT_OF_SUPPORT_VERSION="4.$(( ${OLD_VERSION#4.} - 5 ))"
1413

15-
OLD_PERIODIC="${PERIODICS_DIR}/shiftstack-shiftstack-ci-main__periodic-${OLD_VERSION}.yaml"
16-
NEW_PERIODIC="${PERIODICS_DIR}/shiftstack-shiftstack-ci-main__periodic-${NEW_VERSION}.yaml"
17-
OUT_OF_SUPPORT_PERIODIC="${PERIODICS_DIR}/shiftstack-shiftstack-ci-main__periodic-${OUT_OF_SUPPORT_VERSION}.yaml"
14+
OLD_PERIODIC="${PERIODICS_DIR}/shiftstack-ci-release-${OLD_VERSION}.yaml"
15+
NEW_PERIODIC="${PERIODICS_DIR}/shiftstack-ci-release-${NEW_VERSION}.yaml"
1816

19-
OLD_UPGRADE_PERIODIC="${PERIODICS_DIR}/shiftstack-shiftstack-ci-main__periodic-${OLD_VERSION}-upgrade-from-stable-${OLD_OLD_VERSION}.yaml"
20-
NEW_UPGRADE_PERIODIC="${PERIODICS_DIR}/shiftstack-shiftstack-ci-main__periodic-${NEW_VERSION}-upgrade-from-stable-${OLD_VERSION}.yaml"
17+
OLD_TP_PERIODIC="${PERIODICS_DIR}/shiftstack-ci-release-${OLD_VERSION}__techpreview.yaml"
18+
NEW_TP_PERIODIC="${PERIODICS_DIR}/shiftstack-ci-release-${NEW_VERSION}__techpreview.yaml"
2119

22-
# Copy-paste "simple install" periodics
23-
# shellcheck disable=SC2016 # Shellcheck appears confused by the proliferation of quotes
24-
yq --yaml-output '.
25-
# Replace the old version in base images (.base_images.*.name)
26-
| ( .base_images[] | select(.name == "'"${OLD_VERSION}"'") | .name ) |= "'"${NEW_VERSION}"'"
20+
OLD_UPGRADE_PERIODIC="${PERIODICS_DIR}/shiftstack-ci-release-${OLD_VERSION}__upgrade-from-stable-${OLD_OLD_VERSION}.yaml"
21+
NEW_UPGRADE_PERIODIC="${PERIODICS_DIR}/shiftstack-ci-release-${NEW_VERSION}__upgrade-from-stable-${OLD_VERSION}.yaml"
2722

28-
# Replace the old version in release images (.releases.{initial,latest}.{prerelease,candidate}.version)
29-
| ( .releases[][] | select(.version == "'"${OLD_VERSION}"'") | .version ) |= "'"${NEW_VERSION}"'"
23+
# Pointing development branch to `ci` stream, while maintenance branches point
24+
# to `nightly` to reduce the noise
3025

31-
# Ensure that the release stream is set to "ci"
32-
| ( .releases[][] | select(.stream == "nightly") | .stream ) |= "ci"
26+
cp "${OLD_PERIODIC}" "${NEW_PERIODIC}"
27+
sed -i "s/${OLD_VERSION}/${NEW_VERSION}/" "${NEW_PERIODIC}"
28+
sed -i "s/stream: nightly/stream: ci/" "${NEW_PERIODIC}"
29+
sed -i "s/stream: ci/stream: nightly/" "${OLD_PERIODIC}"
3330

34-
# Replace the version in the footer generated metadata, just to be on the safe side
35-
# (although it will probably be rewritten when running `make update`
36-
| .zz_generated_metadata.variant="periodic-'"${NEW_VERSION}"'"
31+
cp "${OLD_TP_PERIODIC}" "${NEW_TP_PERIODIC}"
32+
sed -i "s/${OLD_VERSION}/${NEW_VERSION}/" "${NEW_TP_PERIODIC}"
33+
sed -i "s/stream: nightly/stream: ci/" "${NEW_TP_PERIODIC}"
34+
sed -i "s/stream: ci/stream: nightly/" "${OLD_TP_PERIODIC}"
3735

38-
' "$OLD_PERIODIC" > "$NEW_PERIODIC"
39-
40-
# Copy-paste "upgrade" periodics
41-
# shellcheck disable=SC2016 # Shellcheck appears confused by the proliferation of quotes
42-
yq --yaml-output '.
43-
# Replace the old version in base images (.base_images.*.name)
44-
| ( .base_images[] | select(.name == "'"${OLD_VERSION}"'") | .name ) |= "'"${NEW_VERSION}"'"
45-
46-
# Replace the previous starting version in base images (.base_images.*.name)
47-
| ( .base_images[] | select(.name == "'"${OLD_OLD_VERSION}"'") | .name ) |= "'"${OLD_VERSION}"'"
48-
49-
# Replace the old version in release images (.releases.*.*.version)
50-
| ( .releases[][] | select(.version == "'"${OLD_VERSION}"'") | .version ) |= "'"${NEW_VERSION}"'"
51-
52-
# Replace the previous starting version release images (.releases.*.*.version_bounds.lower)
53-
| ( .releases[][] | select(.version_bounds != null) | .version_bounds.lower ) |= "'"${OLD_VERSION}.0-0"'"
54-
55-
# Replace the old version release images (.releases.*.*.version_bounds.upper)
56-
| ( .releases[][] | select(.version_bounds != null) | .version_bounds.upper ) |= "'"${NEW_VERSION}.0-0"'"
57-
58-
# Replace the version in the footer generated metadata, just to be on the safe side
59-
# (although it will probably be rewritten when running `make update`
60-
| .zz_generated_metadata.variant="periodic-'"${NEW_VERSION}"'-upgrade-from-stable-'"${OLD_VERSION}"'"
61-
62-
' "$OLD_UPGRADE_PERIODIC" > "$NEW_UPGRADE_PERIODIC"
63-
64-
# Set all intervals to 72h for the branch that is not the newest any more
65-
yq --yaml-output --in-place '.
66-
# Set the release stream to "nightly" to reduce noise on maintenance branches
67-
| ( .releases[][] | select(.stream == "ci") | .stream ) |= "nightly"
68-
69-
# Set a conveniently long interval to all tests in the old periodics
70-
| del(.tests[].interval)
71-
| del(.tests[].cron)
72-
| .tests[].minimum_interval |= "72h"
73-
74-
' "$OLD_PERIODIC"
75-
76-
# Set maximum interval for branch that fell off support
77-
yq --yaml-output --in-place '.
78-
# Set a conveniently long interval to all tests in the old periodics
79-
| del(.tests[].interval)
80-
| del(.tests[].cron)
81-
| .tests[].minimum_interval |= "8766h"
82-
83-
' "$OUT_OF_SUPPORT_PERIODIC"
36+
cp "${OLD_UPGRADE_PERIODIC}" "${NEW_UPGRADE_PERIODIC}"
37+
sed -i "s/${OLD_VERSION}/${NEW_VERSION}/" "${NEW_UPGRADE_PERIODIC}"
38+
sed -i "s/${OLD_OLD_VERSION}/${OLD_VERSION}/" "${NEW_UPGRADE_PERIODIC}"
39+
sed -i "s/stream: nightly/stream: ci/" "${NEW_UPGRADE_PERIODIC}"
40+
sed -i "s/stream: ci/stream: nightly/" "${OLD_UPGRADE_PERIODIC}"
8441

8542
echo "Done. Now go to '${2}' and run a good 'make update' before pushing the patch."

0 commit comments

Comments
 (0)