From 13eb8f461245bf7162c88919d6371cd9c26c33a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de>
Date: Thu, 18 Mar 2021 13:52:10 +0100
Subject: [PATCH] Update release process for Helm charts

---
 docs/release-process.md                       | 42 ++++++++++++++-----
 .../helm/theodolite-chart/build-package.sh    |  3 ++
 .../helm/theodolite-chart/update-index.sh     |  7 ++++
 3 files changed, 41 insertions(+), 11 deletions(-)
 create mode 100755 execution/helm/theodolite-chart/build-package.sh
 create mode 100755 execution/helm/theodolite-chart/update-index.sh

diff --git a/docs/release-process.md b/docs/release-process.md
index 2a679b90c..981306b07 100644
--- a/docs/release-process.md
+++ b/docs/release-process.md
@@ -11,22 +11,42 @@ This document describes how to perform a new Theodolite release.
 We assume that we are creating the release `v0.3.1`. Please make sure to adjust
 the following steps according to the release, you are actually performing.
 
-1. Update `codemeta.json` to match the new version. In particular, make sure that `version` points to the version you are releasing and `dateModified` points to the date you are relasing this version. [CodeMeata generator](https://codemeta.github.io/codemeta-generator/) may help you in updating the file.
+1. Create a new branch `v0.3` if it does not already exist. This branch will never
+again be merged into master.
 
-2. Update `CITATION.cff` to match the new version. At least update the `version` field.
+2. Checkout the `v0.3` branch.
 
-3. Commit these changes to the `master` branch.
+3. Update all references to artifacts which are versioned. This includes:
 
-4. Create a new branch `v0.3` if it does not already exists. This branch will never
-again be merged into master.
+    1. Update all references to Theodolite Docker images to tag `v0.3.1`. These are the Kubernetes resource definitions in
+`execution`, the references to *latest* in `run_uc.py`, the Docker Compose files in `theodolite-benchmarks/docker-test` and the example `theodolite.yaml` job.
+
+    2. Update both, the `version` and the `appVersion` fields, in the Helm `Charts.yaml` file to `0.3.1`.
+
+    3. Update `codemeta.json` to match the new version. In particular, make sure that `version` points to the version you are releasing and `dateModified` points to the date you are relasing this version. [CodeMeata generator](https://codemeta.github.io/codemeta-generator/) may help you in updating the file.
+
+    4. Update `CITATION.cff` to match the new version. At least update the `version` field.
+
+4. Create a Helm package by running `./build-package.sh` from the chart directory.
+
+5. Update the Helm repository index of located at `/docs` by running `./update-index.sh v0.3.1`.
+
+6. Commit these changes to the `v0.3` branch.
+
+7. Tag this commit `v0.3.1` (can be done via GitLab). The corresponding Docker images will be uploaded.
+
+8. Create *releases* on GitLab and GitHub. Upload the generated Helm package to these releases.
+
+9. Switch to the `master` branch.
+
+10. Re-run `./update-index.sh v0.3.1` to include the latest release in the *upstream* Helm repository. You can now delete the packaged Helm chart.
 
-5. Checkout the `v0.3` branch.
+11. If this release increments Theodolite's *latest* version number, 
 
-6. Update all references to Theodolite Docker images to tag `v0.3.1`. These are the Kubernetes resource definitions in
-`execution`, the references to *latest* in `run_uc.py`, the Docker Compose files in `docker-test` and the example `theodolite.yaml` job.
+    1. Update the Helm `Charts.yaml` file to `0.4.0-SNAPSHOT` (see Step 3).
 
-7. Commit these changes.
+    2. Update the `codemeta.json` file according to Step 3.
 
-8. Tag this commit with `v0.3.1`. The corresponding Docker images will be uploaded.
+    3. Update the `CITATION.cff` file according to Step 3.
 
-9. Create *releases* for this tag in both, GitLab and GitHub.
+12. Commit these changes to the `master` branch.
diff --git a/execution/helm/theodolite-chart/build-package.sh b/execution/helm/theodolite-chart/build-package.sh
new file mode 100755
index 000000000..e79d0497d
--- /dev/null
+++ b/execution/helm/theodolite-chart/build-package.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env sh
+
+helm package . --dependency-update && rm -r charts # We don't want to include dependencies in our index
diff --git a/execution/helm/theodolite-chart/update-index.sh b/execution/helm/theodolite-chart/update-index.sh
new file mode 100755
index 000000000..da7fb2150
--- /dev/null
+++ b/execution/helm/theodolite-chart/update-index.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env sh
+
+RELEASE_PATH="https://github.com/cau-se/theodolite/releases/download"
+RELEASE_NAME=$1 # Supposed to be equal to tag, e.g., v0.3.0
+
+helm repo index . --url $RELEASE_PATH/$RELEASE_NAME --merge ../../../docs/index.yaml && \
+  mv index.yaml ../../../docs/index.yaml
\ No newline at end of file
-- 
GitLab