Skip to content

Commit 705501d

Browse files
adwk67razvan
andauthored
added workspace/crate updates for patch releases (#45)
Co-authored-by: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com>
1 parent e48889e commit 705501d

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

release/README.adoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,15 @@ To create release tags for bugfix/patch releases use the `create-bugfix-tag.sh`
213213
- `-p`: push flag (optional, default is "false"). If provided, the created commits and tags made as part of this process will be pushed to the origin.
214214
- `-c`: cleanup flag (optional, default is "false"). If provided, the repository folders will be torn down on completion.
215215
- `-w`: where to create the tag and update versions in code. It can be "products", "operators", "both".
216+
- `-i`: product image versioning flag (optional, default is "false"). If provided, updates test definitions with product image versions from this release version (i.e. assumes products have been released/tagged, too).
216217
217218
N.B. the flags cannot be combined (e.g. `-p -c` but not `-pc)
218219

219220
e.g.
220221

221222
[source]
222223
----
223-
./release/create-bugfix-tag.sh -t 23.1.0 -p -c -w both
224+
./release/create-bugfix-tag.sh -t 23.1.0 -p -c -w both -i
224225
----
225226

226227
#### What this script does
@@ -239,5 +240,7 @@ e.g.
239240
** clones the operator repositories
240241
** checks that the release branch exists and the tag doesn't
241242
** switches to the release branch
243+
** updates crate versions and the workspace
244+
** updates test definitions to use product image versions that match the release tag (if requested with "-i")
242245
** tags the branch and pushes it if the push argument is provided
243246
** deletes the temporary folder (if requested with "-c")

release/create-bugfix-tag.sh

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,20 @@ tag_operators() {
2828
if [ -f .gitmodules ]; then
2929
git submodule update --recursive --init
3030
fi
31-
31+
32+
# set tag version where relevant
33+
CARGO_VERSION="$INITIAL_DIR"/release/cargo-version.py
34+
$CARGO_VERSION --set "$RELEASE_TAG"
35+
cargo update --workspace
36+
make regenerate-charts
37+
38+
update_code "${operator}"
39+
#-----------------------------------------------------------
40+
# ensure .j2 changes are resolved
41+
#-----------------------------------------------------------
42+
"$TEMP_RELEASE_FOLDER/${operator}"/scripts/docs_templating.sh
43+
44+
git commit -am "release $RELEASE_TAG"
3245
git tag "$RELEASE_TAG"
3346
push_branch
3447
done < <(yq '... comments="" | .operators[] ' "$INITIAL_DIR"/release/config.yaml)
@@ -109,6 +122,19 @@ checks() {
109122
}
110123

111124

125+
update_code() {
126+
if $PRODUCT_IMAGE_TAGS; then
127+
echo "Updating relase tag in code..."
128+
if [ -f "$TEMP_RELEASE_FOLDER/$1/tests/test-definition.yaml" ]; then
129+
# e.g. 2.2.4-stackable0.5.0 -> 2.2.4-stackable23.1
130+
sed -i "s/-stackable.*/-stackable${RELEASE_TAG}/" "$TEMP_RELEASE_FOLDER/$1/tests/test-definition.yaml"
131+
fi
132+
else
133+
echo "Skip updating relase tag in code..."
134+
fi
135+
}
136+
137+
112138
push_branch() {
113139
if $PUSH; then
114140
echo "Pushing changes..."
@@ -117,6 +143,8 @@ push_branch() {
117143
git switch main
118144
else
119145
echo "(Dry-run: not pushing...)"
146+
git push --dry-run "${REPOSITORY}" "${RELEASE_BRANCH}"
147+
git push --dry-run "${REPOSITORY}" "${RELEASE_TAG}"
120148
fi
121149
}
122150

@@ -132,13 +160,15 @@ parse_inputs() {
132160
PUSH=false
133161
CLEANUP=false
134162
WHAT=""
163+
PRODUCT_IMAGE_TAGS=false
135164

136165
while [[ "$#" -gt 0 ]]; do
137166
case $1 in
138167
-t|--tag) RELEASE_TAG="$2"; shift ;;
139168
-w|--what) WHAT="$2"; shift ;;
140169
-p|--push) PUSH=true ;;
141170
-c|--cleanup) CLEANUP=true ;;
171+
-i|--images) PRODUCT_IMAGE_TAGS=true ;;
142172
*) echo "Unknown parameter passed: $1"; exit 1 ;;
143173
esac
144174
shift
@@ -167,7 +197,7 @@ main() {
167197
# check if tag argument provided
168198
#-----------------------------------------------------------
169199
if [ -z "${RELEASE_TAG}" ]; then
170-
echo "Usage: create-release-tag.sh -t <tag>"
200+
echo "Usage: create-bugfix-tag.sh -t <tag>"
171201
exit 1
172202
fi
173203
#-----------------------------------------------------------

0 commit comments

Comments
 (0)