diff --git a/.github/workflows/check-chart-migration.yaml b/.github/workflows/check-chart-migration.yaml deleted file mode 100644 index 06d0a73..0000000 --- a/.github/workflows/check-chart-migration.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: Check Helm Chart Migration - -on: - push: - -jobs: - check-migration: - runs-on: ubuntu-latest - - steps: - - name: Checkout current repository - uses: actions/checkout@v2 - - - name: Checkout banzaicloud/banzai-charts at tag cadence/0.24.1 - uses: actions/checkout@v2 - with: - repository: banzaicloud/banzai-charts - ref: cadence/0.24.2 - path: banzai-charts - - - name: Compare Helm Charts excluding README.md - run: | - for file in $(find banzai-charts/cadence -type f ! -name "README.md"); do - relative_path=${file#banzai-charts/cadence/} - diff "$file" "charts/cadence/$relative_path" || { echo "Difference found in $file"; exit 1; } - done - - - name: Compare CI Pipeline - run: | - diff .github/workflows/ci.yaml banzai-charts/.github/workflows/ci.yaml || { echo "CI pipelines are not identical!"; exit 1; } diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5cd0d70..a7f50c6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,123 +1,39 @@ -name: Helm chart - +name: Helm Continuous Integration on: push: - branches: - - master - tags: - - "**/[0-9]+.[0-9]+.[0-9]+" - - "**/[0-9]+.[0-9]+.[0-9]+-dev.[0-9]+" + branches: "main" pull_request: env: - HELM_PLUGIN_CHARTMUSEUM_PUSH_VERSION: 0.9.0 - HELM_PUSH_REPOSITORY_NAME: chartmuseum - HELM_VERSION: 3.1.1 + HELM_VERSION: 3.12.1 + PYTHON_VERSION: 3.11 jobs: helm: - name: Helm - runs-on: ubuntu-latest - + name: Chart Linting + runs-on: ubuntu-22.04 steps: - - name: Check out code + - name: Checkout uses: actions/checkout@v2 - - - uses: azure/setup-helm@v1 with: - version: ${{ env.HELM_VERSION }} - - - name: Add Helm repositories - run: | - helm repo add incubator https://charts.helm.sh/incubator - helm repo add chartmuseum https://kubernetes-charts.banzaicloud.com - helm repo add banzaicloud-stable http://kubernetes-charts.banzaicloud.com/branch/master - helm repo add rimusz https://charts.rimusz.net - - - name: Update Helm repositories - run: | - helm repo update - helm repo list - - - name: Update Helm dependencies - run: | - find -H '.' \ - -maxdepth 2 \ - -name 'Chart.yaml' \ - -execdir helm dependency update \; - - - name: Lint Helm charts - run: | - find -H '.' \ - -maxdepth 2 \ - -name 'Chart.yaml' \ - -printf '%h\n' \ - | xargs helm lint - - - name: Set Git refname - id: set-git-refname - run: | - GIT_REFNAME="$(echo "${{ github.ref }}" | sed -r 's@refs/(heads|pull|tags)/@@g')" - - echo "GIT_REFNAME=${GIT_REFNAME}" - echo "git_refname=${GIT_REFNAME}" >> $GITHUB_OUTPUT - - - name: Set Helm push enabled - id: set-helm-push-enabled - run: | - HELM_PUSH_ENABLED="" - if [ "${{ github.event_name }}" == "push" ] && echo "${{ steps.set-git-refname.outputs.git_refname }}" | grep -E -q "^(chart/)?[^/]+/[0-9]+\.[0-9]+\.[0-9]+"; then - HELM_PUSH_ENABLED=1 - else - printf >&2 "Unstable chart (%s) from %s event, chart will not be pushed" "${{ steps.set-git-refname.outputs.git_refname }}" "${{ github.event_name }}" - fi + fetch-depth: 0 - echo "HELM_PUSH_ENABLED=${HELM_PUSH_ENABLED}" - echo "helm_push_enabled=${HELM_PUSH_ENABLED}" >> $GITHUB_OUTPUT - - - if: ${{ steps.set-helm-push-enabled.outputs.helm_push_enabled == 1 }} - name: Set chart name - id: set-chart-name - run: | - CHART_NAME="$(echo "${{ steps.set-git-refname.outputs.git_refname }}}" | awk -F '/' '{print $(NF-1)}')" - - echo "CHART_NAME=${CHART_NAME}" - echo "chart_name=${CHART_NAME}" >> $GITHUB_OUTPUT - - - if: ${{ steps.set-helm-push-enabled.outputs.helm_push_enabled == 1 }} - name: Package Helm chart - id: package-chart - run: | - HELM_PACKAGE_OUTPUT=$(helm package "${{ github.workspace }}/${{ steps.set-chart-name.outputs.chart_name }}") || exit 1 - HELM_PACKAGE_PATH="${HELM_PACKAGE_OUTPUT##"Successfully packaged chart and saved it to: "}" - - echo "HELM_PACKAGE_PATH=${HELM_PACKAGE_PATH}" - echo "helm_package_path=${HELM_PACKAGE_PATH}" >> $GITHUB_OUTPUT - - - if: ${{ steps.set-helm-push-enabled.outputs.helm_push_enabled == 1 }} - name: Check Helm chart version in repository - run: | - CHART_PATH="${{ github.workspace }}/${{ steps.set-chart-name.outputs.chart_name }}" - EXPECTED_CHART_VERSION="$(echo "${{ steps.set-git-refname.outputs.git_refname }}" | awk -F '/' '{print $NF}')" || exit 1 - ACTUAL_CHART_VERSION="$(awk '/version: [0-9]+\.[0-9]+\.[0-9]+/ {print $2}' "${CHART_PATH}/Chart.yaml")" || exit 1 - - if [ "${EXPECTED_CHART_VERSION}" != "${ACTUAL_CHART_VERSION}" ]; then - printf >&2 "chart version mismatches, name: %s, expected version (from tag): %s, actual version (from chart): %s" "${{ steps.set-chart-name.outputs.chart_name }}" "${EXPECTED_CHART_VERSION}" "${ACTUAL_CHART_VERSION}" - exit 1 - fi + - name: Set up Helm + uses: azure/setup-helm@v3.5 + with: + version: ${{ env.HELM_VERSION }} - if helm search repo "${{ env.HELM_PUSH_REPOSITORY_NAME }}/${{ steps.set-chart-name.outputs.chart_name }}" --version "${ACTUAL_CHART_VERSION}" --output json | jq --exit-status 'length > 0'; then - printf >&2 "chart version already exists in the repository, repository: %s, name: %s, version: %s" "${{ env.HELM_PUSH_REPOSITORY_NAME }}" "${{ steps.set-chart-name.outputs.chart_name }}" "${ACTUAL_CHART_VERSION}" - exit 1 - fi + # Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and + # yamllint (https://github.com/adrienverge/yamllint) which require Python + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} - - if: ${{ steps.set-helm-push-enabled.outputs.helm_push_enabled == 1 }} - name: Install Helm ChartMuseum push plugin - run: helm plugin install "https://github.com/chartmuseum/helm-push.git" --version "${{ env.HELM_PLUGIN_CHARTMUSEUM_PUSH_VERSION }}" + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.4.0 + with: + version: v3.9.0 - - if: ${{ steps.set-helm-push-enabled.outputs.helm_push_enabled == 1 }} - name: Push Helm chart - env: - HELM_REPO_PASSWORD: ${{ secrets.HELM_REPO_PASSWORD }} - HELM_REPO_USERNAME: ${{ secrets.HELM_REPO_USERNAME }} - run: helm push "${{ steps.package-chart.outputs.helm_package_path }}" "${{ env.HELM_PUSH_REPOSITORY_NAME }}" + - name: Lint chart + run: ct lint --all --config ct.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..a4e7517 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,63 @@ +name: Helm Release + +on: + push: + tags: + - "**/[0-9]+.[0-9]+.[0-9]+" + - "**/[0-9]+.[0-9]+.[0-9]+-dev.[0-9]+" + + +env: + HELM_VERSION: 3.1.1 + +jobs: + helm: + name: Publish to Github Pages + runs-on: ubuntu-22.04 + permissions: + contents: write + + steps: + - name: Check out code + uses: actions/checkout@v2 + + - uses: azure/setup-helm@v1 + with: + version: ${{ env.HELM_VERSION }} + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Set Git refname + id: set-git-refname + run: | + GIT_REFNAME="$(echo "${{ github.ref }}" | sed -r 's@refs/(heads|pull|tags)/@@g')" + + echo "GIT_REFNAME=${GIT_REFNAME}" + echo ::set-output name=git_refname::${GIT_REFNAME} + + + - name: Check Git Tag consistency with Chart version + run: | + EXPECTED_CHART_VERSION="$(echo "${{ steps.set-git-refname.outputs.git_refname }}" | awk -F '/' '{print $NF}')" || exit 1 + ACTUAL_CHART_VERSION="$(awk '/version: [0-9]+\.[0-9]+\.[0-9]+/ {print $2}' "./charts/cadence/Chart.yaml")" || exit 1 + + if [ "${EXPECTED_CHART_VERSION}" != "${ACTUAL_CHART_VERSION}" ]; then + printf >&2 "chart version mismatches, expected version (from tag): %s, actual version (from chart): %s" "${EXPECTED_CHART_VERSION}" "${ACTUAL_CHART_VERSION}" + exit 1 + fi + + - name: Checkout forked chart-releaser + uses: actions/checkout@v3 + with: + repository: edmondop/chart-releaser-action + path: chart-releaser-action + ref: ef58c21b3f93daff872ba384abd9cdb16e715334 + + - name: Run chart-releaser + uses: ./chart-releaser-action + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + diff --git a/README.md b/README.md index 6ede33d..b42e43f 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,16 @@ [Cadence](https://cadenceworkflow.io/) is a distributed, scalable, durable, and highly available orchestration engine to execute asynchronous long-running business logic in a scalable and resilient way. +## Important information + +BanzaiCloud is not maintaining anymore the Helm Chart for Cadence, so if you have been using the Cadence Helm Chart for some time you might need to change few things from now on. A special thanks to their team for the great work. ## TL;DR; +The new release process allows anybody to quickly publish the chart on GitHub repo, using `chart-releaser-action` GitHub action that creates public Helm Chart Repo. If your repo is not hosted under user `edmondop`, please replace the right username + ```bash -$ helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com +$ helm repo add cadence https://edmondop.github.io/cadence-helm-chart/ $ helm repo update ``` @@ -27,7 +32,7 @@ This chart bootstraps a [Cadence](https://github.com/uber/cadence) and a [Cadenc To install the chart with the release name `my-release`: ```bash -$ helm install --name my-release --namespace cadence banzaicloud-stable/cadence +$ helm install --name my-release --namespace cadence cadence/cadence ``` > **Tip**: List all releases using `helm list` @@ -37,7 +42,7 @@ $ helm install --name my-release --namespace cadence banzaicloud-stable/cadence ```console # Helm -$ helm upgrade [RELEASE_NAME] banzaicloud-stable/cadence +$ helm upgrade [RELEASE_NAME] cadence/cadence ``` ### From 0.20.x (or below) to 0.21.y (or above) @@ -133,13 +138,13 @@ The command removes all the Kubernetes components associated with the chart and The chart comes with a single node Cassandra by default (from [incubator/cassandra](https://github.com/helm/charts/tree/master/incubator/cassandra)). ```bash -$ helm install banzaicloud-stable/cadence +$ helm install cadence/cadence ``` You can increase the number of Cassandra nodes if you want: ```bash -$ helm install --set cassandra.config.cluster_size=3 banzaicloud-stable/cadence +$ helm install --set cassandra.config.cluster_size=3 cadence/cadence ``` > **Note:** It takes a few minutes to start Cassandra. You can speed it up by using configuration from `values.dev.yaml`. @@ -175,13 +180,13 @@ $ kubectl exec -it cassandra-0 -- cqlsh -e "CREATE KEYSPACE cadence_visibility W ``` ```bash -$ helm install -f values/values.cassandra.yaml banzaicloud-stable/cadence +$ helm install -f values/values.cassandra.yaml cadence/cadence ``` Alternatively, install the chart with manual migrations. Follow the steps in [migrations.md](migrations.md). ```bash -$ helm install -f values/values.cassandra.yaml --set schema.setup.enabled=false --set schema.update.enabled=false banzaicloud-stable/cadence +$ helm install -f values/values.cassandra.yaml --set schema.setup.enabled=false --set schema.update.enabled=false cadence/cadence ``` @@ -192,7 +197,7 @@ $ helm install -f values/values.cassandra.yaml --set schema.setup.enabled=false The chart can be installed with a single node MySQL (from [stable/mysql](https://github.com/helm/charts/tree/master/stable/mysql)). ```bash -$ helm install --set cassandra.enabled=false --set mysql.enabled=true --set mysql.mysqlPassword=cadence banzaicloud-stable/cadence +$ helm install --set cassandra.enabled=false --set mysql.enabled=true --set mysql.mysqlPassword=cadence cadence/cadence ``` > **Note:** When installing MySQL from within the chart with automatic migrations, you **must** configure a password. @@ -222,13 +227,13 @@ $ kubectl wait --for=condition=Ready pod/$(kubectl get pods -l 'app=mysql' -o js ``` ```bash -$ helm install -f values/values.mysql.yaml banzaicloud-stable/cadence +$ helm install -f values/values.mysql.yaml cadence/cadence ``` Alternatively, install the chart with manual migrations. Follow the steps in [migrations.md](migrations.md). ```bash -$ helm install -f values/values.mysql.yaml --set schema.setup.enabled=false --set schema.update.enabled=false banzaicloud-stable/cadence +$ helm install -f values/values.mysql.yaml --set schema.setup.enabled=false --set schema.update.enabled=false cadence/cadence ``` @@ -238,13 +243,13 @@ As of 0.5.8 Cadence exports Prometheus metrics. The chart supports annotating Ca so that Prometheus can scrape them: ```bash -$ helm install --set server.metrics.annotations.enabled=true banzaicloud-stable/cadence +$ helm install --set server.metrics.annotations.enabled=true cadence/cadence ``` Alternatively, you can enable ServiceMonitor when using [Prometheus Operator](https://github.com/coreos/prometheus-operator): ```bash -$ helm install --set server.metrics.serviceMonitor.enabled=true banzaicloud-stable/cadence +$ helm install --set server.metrics.serviceMonitor.enabled=true cadence/cadence ``` Note that you can enable monitoring for each service separately. See the configuration reference bellow. @@ -279,7 +284,7 @@ The reason behind this limitation is that migrations are executed as helm hooks, ## Port forwarding to Cadence frontend -As of version 0.5.1 of this chart service (frontend, history, matching, worker) pods use the [pod IP as bind address](https://github.com/banzaicloud/banzai-charts/pull/997). +As of version 0.5.1 of this chart service (frontend, history, matching, worker) pods use the [pod IP as bind address](https://github.com/cadence/banzai-charts/pull/997). This is a limitation of how Cadence cluster membership works and is required for scaling Cadence components. @@ -393,18 +398,22 @@ Global options overridable per service are marked with an asterisk. Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example: ```bash -$ helm install --name my-release --set server.image.tag=0.7.1 banzaicloud-stable/cadence +$ helm install --name my-release --set server.image.tag=0.7.1 cadence/cadence ``` Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example: ```bash -$ helm install --name my-release --values values.yaml banzaicloud-stable/cadence +$ helm install --name my-release --values values.yaml cadence/cadence ``` ## Contributing +### New release process. +The new release process use GitHub Pages as an Helm Chart Repository. In order to test the release, set up GitHub Pages for your fork. This will allow you to see how your changes affect the final outcome. Please create a branch named `gh-pages` and enabled on your repository GitHub Pages from that branch. If you need more information, please consult the [Chart Releaser Action Documentation](https://github.com/helm/chart-releaser-action) + + ### Chart upgrade For contributions involving an upgrade to the Cadence server version or diff --git a/charts/cadence/Chart.yaml b/charts/cadence/Chart.yaml index 72476f8..6a6b53f 100644 --- a/charts/cadence/Chart.yaml +++ b/charts/cadence/Chart.yaml @@ -5,12 +5,11 @@ description: Cadence is a distributed, scalable, durable, and highly available o icon: https://raw.githubusercontent.com/uber/cadence-web/master/client/assets/logo.svg apiVersion: v1 home: https://cadenceworkflow.io/ -engine: gotpl sources: - https://github.com/uber/cadence keywords: - cadence - workflow maintainers: - - name: Banzai Cloud - email: info@banzaicloud.com + - name: Edmondo Porcu + email: edmondo.porcu@gmail.com diff --git a/ct.yaml b/ct.yaml new file mode 100644 index 0000000..a3a3b6e --- /dev/null +++ b/ct.yaml @@ -0,0 +1,7 @@ +validate-maintainers: false +chart-repos: + - incubator=https://charts.helm.sh/incubator + - chartmuseum=https://kubernetes-charts.banzaicloud.com + - stable=https://charts.helm.sh/stable + - banzaicloud-stable=http://kubernetes-charts.banzaicloud.com/branch/master + - rimusz=https://charts.rimusz.net