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

Release and publish helm charts via a Github Action Release workflow. #457

Merged
merged 8 commits into from
Jan 30, 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
62 changes: 60 additions & 2 deletions .github/workflows/publish-charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,71 @@ on:
version:
description: "Temporal version to use for release (for example 1.22.4)"
required: true
bump:
description: "Chart version bump level"
required: true
type: choice
default: minor
options:
- minor
- patch

jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Empty
- name: Generate token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.TEMPORAL_CICD_APP_ID }}
private-key: ${{ secrets.TEMPORAL_CICD_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: true
token: ${{ steps.generate_token.outputs.token }}
ref: rh-chart-publish
fetch-depth: 0
fetch-tags: true

- name: Configure Git
run: |
echo Doing nothing
git config --local user.name 'Temporal Data'
git config --local user.email 'commander-data@temporal.io'

- name: Update Temporal chart version
working-directory: charts/temporal
run: |
RE='([0-9]+)\.([0-9]+)\.([0-9]+)'

current="$(grep -m 1 '^version:' Chart.yaml | awk '{print $2}')"

MAJOR=`echo $current | sed -E "s#$RE#\1#"`
MINOR=`echo $current | sed -E "s#$RE#\2#"`
PATCH=`echo $current | sed -E "s#$RE#\3#"`

if [ "${{ github.event.inputs.bump }}" == "minor" ]; then
let MINOR+=1
let PATCH=0
else
let PATCH+=1
fi
NEW_VERSION="$MAJOR.$MINOR.$PATCH"

sed -i -e "s/^version: .*/version: $NEW_VERSION/" Chart.yaml
sed -i -e "s/^appVersion: .*/appVersion: ${{ github.event.inputs.version }}/" Chart.yaml

git commit -m "Update Chart to $NEW_VERSION, Temporal v${{ github.event.inputs.version }}" Chart.yaml
git push origin
Copy link

@dandavison dandavison Jan 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nice; I learned a couple of things from it; grep -m and I didn't know about the let arithmetic at all, I thought one had to use ((...)). Could use sed -E to make the regex more readable?


- name: Install Helm
uses: azure/setup-helm@v3

- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ This Helm Chart code is tested by a dedicated test pipeline. It is also used ext
This sequence assumes
* that your system is configured to access a kubernetes cluster (e. g. [AWS EKS](https://aws.amazon.com/eks/), [kind](https://kind.sigs.k8s.io/), or [minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/)), and
* that your machine has
- [AWS CLI V2](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html),
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/), and
- [Helm v3](https://helm.sh)
installed and able to access your cluster.

This repo only contains one chart currently, but is structured in the standard helm repo way. This means you will find the chart in the `charts/temporal` directory. All example `helm` commands below should be run from that directory.

## Download Helm Chart Dependencies

Download Helm dependencies:

```bash
~/temporal-helm$ helm dependencies update
helm dependencies update
```

## Install Temporal with Helm Chart
Expand All @@ -44,8 +45,8 @@ The sections that follow describe various deployment configurations, from a mini

To install Temporal in a limited but working and self-contained configuration (one replica of Cassandra and each of Temporal's services, no metrics or ElasticSearch), you can run the following command

```
~/temporal-helm$ helm install \
```bash
helm install \
--set server.replicaCount=1 \
--set cassandra.config.cluster_size=1 \
--set prometheus.enabled=false \
Expand Down Expand Up @@ -80,15 +81,15 @@ By default, Temporal Helm Chart configures Temporal to run with a three node Cas
To install Temporal with all of its dependencies run this command:

```bash
~/temporal-helm$ helm install temporaltest . --timeout 900s
helm install temporaltest . --timeout 900s
```

To use your own instance of ElasticSearch, MySQL, PostgreSQL, or Cassandra, please read the "Bring Your Own" sections below.

Other components (Prometheus, Grafana) can be omitted from the installation by setting their corresponding `enable` flag to `false`:

```bash
~/temporal-helm$ helm install \
helm install \
--set prometheus.enabled=false \
--set grafana.enabled=false \
temporaltest . --timeout 900s
Expand All @@ -103,7 +104,7 @@ To do so, you may look at the example for Google's `cloud sql proxy` in the `val
Example:

```bash
~/temporal-helm$ helm install -f values/values.cloudsqlproxy.yaml temporaltest . --timeout 900s
helm install -f values/values.cloudsqlproxy.yaml temporaltest . --timeout 900s
```

### Install with your own ElasticSearch
Expand All @@ -115,7 +116,7 @@ To do so, fill in the relevant configuration values in `values.elasticsearch.yam
Example:

```bash
~/temporal-helm$ helm install -f values/values.elasticsearch.yaml temporaltest . --timeout 900s
helm install -f values/values.elasticsearch.yaml temporaltest . --timeout 900s
```

### Install with your own MySQL
Expand Down Expand Up @@ -243,7 +244,7 @@ CASSANDRA_KEYSPACE=temporal_visibility ./temporal-cassandra-tool update -schema-
Once you initialized the two keyspaces, fill in the configuration values in `values/values.cassandra.yaml`, and run

```bash
~/temporal-helm$ helm install -f values/values.cassandra.yaml temporaltest . --timeout 900s
helm install -f values/values.cassandra.yaml temporaltest . --timeout 900s
```

### Enable Archival
Expand Down Expand Up @@ -454,19 +455,19 @@ By default dynamic config is empty, if you want to override some properties for
2. Populate it with some values under server.dynamicConfig prefix (use the sample provided at `values/values.dynamic_config.yaml` as a starting point)
3. Install your helm configuration:
```bash
$ helm install -f values/values.dynamic_config.yaml temporaltest . --timeout 900s
helm install -f values/values.dynamic_config.yaml temporaltest . --timeout 900s
```
Note that if you already have a running cluster you can use the "helm upgrade" command to change dynamic config values:
```bash
$ helm upgrade -f values/values.dynamic_config.yaml temporaltest . --timeout 900s
helm upgrade -f values/values.dynamic_config.yaml temporaltest . --timeout 900s
```

WARNING: The "helm upgrade" approach will trigger a rolling upgrade of all the pods.

If a rolling upgrade is not desirable, you can also generate the ConfigMap file explicitly and then apply it using the following command:

```bash
$ kubectl apply -f dynamicconfigmap.yaml
kubectl apply -f dynamicconfigmap.yaml
```
You can use helm upgrade with the "--dry-run" option to generate the content for the dynamicconfigmap.yaml.

Expand All @@ -480,7 +481,7 @@ the config file `server/config.yml` for the temporal web ui is referenced as a m
Note: in this example chart, uninstalling a Temporal instance also removes all the data that might have been created during its lifetime.

```bash
~/temporal-helm $ helm uninstall temporaltest
helm uninstall temporaltest
```

## Upgrading
Expand Down Expand Up @@ -533,8 +534,8 @@ To upgrade your MySQL database, please use `temporal-sql-tool` tool instead of `

Here is an example of a `helm upgrade` command that can be used to upgrade a cluster:

```
helm-charts $ helm \
```bash
helm \
upgrade \
temporaltest \
-f values/values.cassandra.yaml \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.