Skip to content
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

chore(release): Handle updates for demos #91

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ This is the recommended release flow in a nutshell for the release 24.7:
# create and push the release tag
./release/create-release-tag.sh -t 24.7.0 -w products # Only add the -p flag after testing locally first

# monitor the GH action that builds ~80 images for success
# monitor the GH action that builds ~80 images for success.
# build failures alerts will appear in the #notifications-container-images channel.

# continue with the operators ...
# create and push the release branch
Expand All @@ -20,6 +21,11 @@ This is the recommended release flow in a nutshell for the release 24.7:
./release/create-release-tag.sh -t 24.7.0 -w operators # Only add the -p flag after testing locally first

# monitor the GH actions that build the operator images for success
# build failures are not yet sent to the #notifications-container-images channel yet.

# continue with the demos ...
# create and push the release branch
./release/create-release-branch.sh -b 24.7 -w demos # Only add the -p flag after testing locally first

# finally patch the changelog file in the main branch
# create PRs for all operators
Expand Down Expand Up @@ -54,7 +60,7 @@ A set of scripts that automates some release steps. The release process has mult
### Install requirements

> [!NOTE]
> Nix users will not need to install anything, just enter the `nix-shell` in this repository (if not done automatically via `direnv`).
> Nix users will not need to install anything, just enter the `nix-shell` in this repository (if not done automatically via `direnv`).
> The dependencies will install automatically.
> A nix-shell will be entered for each operator during certain commands, so operator dependencies will be covered too.

Expand Down Expand Up @@ -84,20 +90,20 @@ You have to be logged in when running the `post-release.sh` script. The easiest
To create release branches use the `create-release-branch.sh` script, called from the repository root folder. The syntax is given below:

```
./release/create-release-branch.sh -b <release> [-p] [-c] [-w products|operators|both]
./release/create-release-branch.sh -b <release> [-p] [-c] [-w products|operators|demos|all]
```

- `-b <release>`: the release number (mandatory). This must be a semver-compatible value (i.e. without leading zeros) such as `23.1`, `23.10` etc. and will be used to create a branch with the name `release-<release>` e.g. `release-23.1`
- `-p`: push flag (optional, default is "false"). If provided, the created branches plus any changes made as part of this process will be pushed to the origin.
- `-c`: cleanup flag (optional, default is "false"). If provided, the repository folders will be torn down on completion.
- `-w`: where to create the branch. It can be "products", "operators", "both".
- `-w`: where to create the branch. It can be "products", "operators", "demos", "all".

N.B. the flags cannot be combined (e.g. `-p -c` but not `-pc)

e.g.

```shell
./release/create-release-branch.sh -b 23.1 -p -c -w both
./release/create-release-branch.sh -b 23.1 -p -c -w all
```

##### What this script does
Expand All @@ -121,20 +127,20 @@ e.g.
To create release tags use the `create-release-tag.sh` script, called from the repository root folder. The syntax is given below:

```
./release/create-release-tag.sh -t <release-tag> [-p] [-c] [-w products|operators|both]
./release/create-release-tag.sh -t <release-tag> [-p] [-c] [-w products|operators|all]
```

- `-t <release-tag>`: the release tag (mandatory). This must be a semver-compatible value (i.e. major/minor/path, without leading zeros) such as `23.1.0`, `23.10.3` etc. and will be used to create a tag with the name
- `-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.
- `-c`: cleanup flag (optional, default is "false"). If provided, the repository folders will be torn down on completion.
- `-w`: where to create the tag and update versions in code. It can be "products", "operators", "both".
- `-w`: where to create the tag and update versions in code. It can be "products", "operators", "all".

N.B. the flags cannot be combined (e.g. `-p -c` but not `-pc)

e.g.

```shell
./release/create-release-tag.sh -t 23.1.0 -p -c -w both
./release/create-release-tag.sh -t 23.1.0 -p -c -w all
```

##### What this script does
Expand Down Expand Up @@ -226,21 +232,21 @@ Once the release is complete and all steps above have been verified, the documen
To create release tags for bugfix/patch releases use the `create-bugfix-tag.sh` script, called from the repository root folder. The syntax is given below:

```
./release/create-bugfix-tag.sh -t <release-tag> [-p] [-c] [-w products|operators|both] [-i]
./release/create-bugfix-tag.sh -t <release-tag> [-p] [-c] [-w products|operators|all] [-i]
```

- `-t <release-tag>`: the release tag (mandatory). This must be a semver-compatible value (i.e. major/minor/path, without leading zeros) such as `23.1.0`, `23.10.3` etc. and will be used to create a tag with the name
- `-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.
- `-c`: cleanup flag (optional, default is "false"). If provided, the repository folders will be torn down on completion.
- `-w`: where to create the tag and update versions in code. It can be "products", "operators", "both".
- `-w`: where to create the tag and update versions in code. It can be "products", "operators", "all".
- `-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).

N.B. the flags cannot be combined (e.g. `-p -c` but not `-pc)

e.g.

```shell
./release/create-bugfix-tag.sh -t 23.1.0 -p -c -w both -i
./release/create-bugfix-tag.sh -t 23.1.0 -p -c -w all -i
```

##### What this script does
Expand Down
3 changes: 2 additions & 1 deletion release/config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
demos-repo: demos
images-repo: docker-images
operators:
- airflow-operator
Expand All @@ -16,4 +17,4 @@ operators:
- spark-k8s-operator
- superset-operator
- trino-operator
- zookeeper-operator
- zookeeper-operator
10 changes: 5 additions & 5 deletions release/create-bugfix-tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ tag_operators() {
#-----------------------------------------------------------
"$TEMP_RELEASE_FOLDER/${operator}"/scripts/docs_templating.sh

git commit -sam "release $RELEASE_TAG"
git commit -sam "release $RELEASE_TAG"
git tag -sm "release $RELEASE_TAG" "$RELEASE_TAG"
push_branch
done < <(yq '... comments="" | .operators[] ' "$INITIAL_DIR"/release/config.yaml)
}

tag_repos() {
if [ "products" == "$WHAT" ] || [ "both" == "$WHAT" ]; then
if [ "products" == "$WHAT" ] || [ "all" == "$WHAT" ]; then
tag_products
fi
if [ "operators" == "$WHAT" ] || [ "both" == "$WHAT" ]; then
if [ "operators" == "$WHAT" ] || [ "all" == "$WHAT" ]; then
tag_operators
fi
}
Expand Down Expand Up @@ -116,10 +116,10 @@ check_operators() {
}

checks() {
if [ "products" == "$WHAT" ] || [ "both" == "$WHAT" ]; then
if [ "products" == "$WHAT" ] || [ "all" == "$WHAT" ]; then
check_products
fi
if [ "operators" == "$WHAT" ] || [ "both" == "$WHAT" ]; then
if [ "operators" == "$WHAT" ] || [ "all" == "$WHAT" ]; then
check_operators
fi
}
Expand Down
27 changes: 24 additions & 3 deletions release/create-release-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,35 @@ update_operators() {
done < <(yq '... comments="" | .operators[] ' "$INITIAL_DIR"/release/config.yaml)
}

update_demos() {
if [ -d "$BASE_DIR/$DEMOS_REPO" ]; then
cd "$BASE_DIR/$DEMOS_REPO"
git pull && git switch "${RELEASE_BRANCH}"
else
git clone --branch main --depth 1 "[email protected]:stackabletech/${DEMOS_REPO}.git" "$BASE_DIR/$DEMOS_REPO"
cd "$BASE_DIR/$DEMOS_REPO"
git switch "${RELEASE_BRANCH}" || git switch -c "${RELEASE_BRANCH}" "${REPOSITORY}/${BASE_BRANCH}"
fi

# Search and replace known references to stackableRelease, container images, branch references.
# https://github.com/stackabletech/demos/blob/main/.scripts/update_refs.sh
.scripts/update_refs.sh commit

push_branch "$DEMOS_REPO"
}

update_repos() {
local BASE_DIR="$1";

if [ "products" == "$WHAT" ] || [ "both" == "$WHAT" ]; then
if [ "products" == "$WHAT" ] || [ "all" == "$WHAT" ]; then
update_products
fi
if [ "operators" == "$WHAT" ] || [ "both" == "$WHAT" ]; then
if [ "operators" == "$WHAT" ] || [ "all" == "$WHAT" ]; then
update_operators
fi
if [ "demos" == "$WHAT" ] || [ "all" == "$WHAT" ]; then
update_demos
fi
}

push_branch() {
Expand Down Expand Up @@ -98,6 +118,7 @@ parse_inputs() {

INITIAL_DIR="$PWD"
DOCKER_IMAGES_REPO=$(yq '... comments="" | .images-repo ' "$INITIAL_DIR"/release/config.yaml)
DEMOS_REPO=$(yq '... comments="" | .demos-repo ' "$INITIAL_DIR"/release/config.yaml)
TEMP_RELEASE_FOLDER="/tmp/stackable-$RELEASE_BRANCH"

echo "Settings: ${RELEASE_BRANCH}: Push: $PUSH: Cleanup: $CLEANUP"
Expand All @@ -109,7 +130,7 @@ main() {
# check if tag argument provided
#-----------------------------------------------------------
if [ -z "${RELEASE}" ]; then
echo "Usage: create-release-branch.sh -b <branch> [-p] [-c] [-w both|products|operators]"
echo "Usage: create-release-branch.sh -b <branch> [-p] [-c] [-w products|operators|demos|all]"
exit 1
fi
#-----------------------------------------------------------
Expand Down
10 changes: 5 additions & 5 deletions release/create-release-tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ tag_operators() {
}

tag_repos() {
if [ "products" == "$WHAT" ] || [ "both" == "$WHAT" ]; then
if [ "products" == "$WHAT" ] || [ "all" == "$WHAT" ]; then
tag_products
fi
if [ "operators" == "$WHAT" ] || [ "both" == "$WHAT" ]; then
if [ "operators" == "$WHAT" ] || [ "all" == "$WHAT" ]; then
tag_operators
fi
}
Expand Down Expand Up @@ -116,10 +116,10 @@ check_operators() {
}

checks() {
if [ "products" == "$WHAT" ] || [ "both" == "$WHAT" ]; then
if [ "products" == "$WHAT" ] || [ "all" == "$WHAT" ]; then
check_products
fi
if [ "operators" == "$WHAT" ] || [ "both" == "$WHAT" ]; then
if [ "operators" == "$WHAT" ] || [ "all" == "$WHAT" ]; then
check_operators
fi
}
Expand Down Expand Up @@ -235,7 +235,7 @@ main() {
# check if tag argument provided
#-----------------------------------------------------------
if [ -z "${RELEASE_TAG}" ]; then
echo "Usage: create-release-tag.sh -t <tag> [-p] [-c] [-w both|products|operators]"
echo "Usage: create-release-tag.sh -t <tag> [-p] [-c] [-w products|operators|all]"
exit 1
fi
#-----------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
cargo-edit
gettext # envsubst
gh
yq-go
];
Expand Down