Skip to content

Commit 7da653f

Browse files
committed
feat: update update_refs.sh script to replace image references
1 parent 12a11b5 commit 7da653f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

_scripts/update_refs.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,28 @@ if ! git diff-index --quiet HEAD --; then
1919
exit 2
2020
fi
2121

22-
# Warn if the branch isn't a `release-*` branch (these changes shouldn't be in a branch that gets merged to main)
2322
if [[ "$CURRENT_BRANCH" == release-* ]]; then
2423
STACKABLE_RELEASE="${CURRENT_BRANCH#release-}"
2524
echo "Updating stackableRelease to $STACKABLE_RELEASE"
2625
sed -i -E "s/(stackableRelease:\s+)(\S+)/\1${STACKABLE_RELEASE}/" stacks/stacks-v2.yaml
26+
27+
# TODO (@NickLarsenNZ): Replace 0.0.0-dev refs with ${STACKABLE_RELEASE}.0
28+
# handle patches later, and what about release-candidates?
29+
SEARCH='stackable(0\.0\.0-dev|24\.7\.\d+)' # TODO (@NickLarsenNZ): After https://github.com/stackabletech/stackable-cockpit/issues/310, only search for 0.0.0-dev
30+
REPLACEMENT="stackable${STACKABLE_RELEASE}.0" # TODO (@NickLarsenNZ): Be a bit smarter about patch releases.
31+
echo "Updating image references. Searching for $SEARCH, replacing with $REPLACEMENT"
32+
find demos stacks -type f \
33+
-exec sed -i -E "s/${SEARCH}/${REPLACEMENT}/" {} \;
34+
35+
# Look for remaining references
36+
echo "Checking files with older stackable release references which will be assumed to be intentional."
37+
grep --color=always -ronE "stackable24\.3(\.[0-9]+)"
2738
else
2839
>&2 echo "WARNING: doesn't look like a release branch. Will not update stackableRelease versions in stacks."
2940
fi
3041

42+
echo
43+
echo "Replacing githubusercontent references main->${CURRENT_BRANCH}"
3144
# Search for githubusercontent urls and replace the branch reference with a placeholder variable
3245
# This is done just in case the branch has special regex characters (like `/`).
3346
# shellcheck disable=SC2016 # We intentionally don't want to expand the variable.

0 commit comments

Comments
 (0)