Nussknacker helm CI #1789
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nussknacker helm CI | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
- release-* | |
tags: | |
- '*' | |
workflow_dispatch: | |
inputs: | |
nussknacker_version: | |
description: "Nussknacker version" | |
required: false | |
type: string | |
env: | |
NUSSKNACKER_VERSION: ${{ inputs.nussknacker_version != '' && inputs.nussknacker_version || 'staging-latest' }} | |
CHART_SRC_DIR: ./src | |
XDG_CACHE_HOME: $GITHUB_WORKSPACE/.cache/ | |
RELEASE_NAME: nu-helm-release-${{github.run_id}} | |
NAME: nussknacker | |
CHART_REPOSITORY_AUTH: "${{ secrets.CHARTS_PUBLIC_AUTH}}" | |
CHARTS_PUBLIC_SNAPSHOTS_URL: "https://helm-charts.touk.pl/nexus/repository/helm-snapshots/" | |
CHARTS_PUBLIC_RELEASES_URL: "https://helm-charts.touk.pl/nexus/repository/helm-releases/" | |
HELM_VERSION: 'version.BuildInfo{Version:"v3.13.1", GitCommit:"3547a4b5bf5edb5478ce352e18858d8a552a4110", GitTreeState:"clean", GoVersion:"go1.20.8"}' | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: build | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.setVersion.outputs.version }} | |
steps: | |
- name: Verify helm version | |
run: current_helm_version=$(helm version) && echo "Current helm version $current_helm_version" && [ "$current_helm_version" = "$HELM_VERSION" ] && echo "Helm is in expected version" || echo "::warning title=Helm version is different than expected!::Helm has been updated on runner's image. It could lead to unexpected behaviour during pipeline execution!" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Print Nussknacker version | |
run: | | |
echo "Nussknacker version: $NUSSKNACKER_VERSION" | |
- name: setVersion | |
id: setVersion | |
run: echo "version=$(helm show chart ${{env.CHART_SRC_DIR}} | grep ^version | sed -e "s/.*:\ //;s/SNAPSHOT/SNAPSHOT.${{github.run_id}}/")" >> $GITHUB_OUTPUT | |
- name: buildAll | |
run: ./setup.sh | |
- name: checkTemplate | |
run: helm template -f deploy-values.yaml --set "image.tag=${{env.NUSSKNACKER_VERSION}}" ${{env.CHART_SRC_DIR}} | |
- name: packageAll | |
run: helm package ${{env.CHART_SRC_DIR}} -d dist --version "${{steps.setVersion.outputs.version}}" | |
- name: Store target | |
uses: actions/upload-artifact@v3 | |
with: | |
name: helm-build | |
path: "dist/${{env.NAME}}-${{steps.setVersion.outputs.version}}.tgz" | |
test-flink: | |
name: test flink mode | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: helm-build | |
path: dist | |
- uses: AbsaOSS/[email protected] | |
with: | |
cluster-name: "k3s-default" | |
k3d-version: "v5.6.0" | |
args: >- | |
--config=.k3d/single-cluster.yml | |
--trace | |
- name: Set Nussknacker image version | |
id: setNussknackerVersion | |
run: '[[ $GITHUB_REF == refs/heads/release-* || $GITHUB_REF == refs/tags/release-* ]] && version=${GITHUB_REF##*/release-} && echo "Using version based on release branch/tag name: $version" && echo "nuVersion=$version" >> $GITHUB_OUTPUT || (echo "Using default version" && echo "nuVersion=${{env.NUSSKNACKER_VERSION}}" >> $GITHUB_OUTPUT)' | |
- name: helmUpgrade | |
run: helm upgrade -i "${{env.RELEASE_NAME}}" dist/*.tgz --version "${{needs.build.outputs.version}}" --wait --debug -f deploy-values.yaml -f deploy-values-kafka-config.yaml --set "image.tag=${{steps.setNussknackerVersion.outputs.nuVersion}}_scala-2.12" | |
- name: helmTestRelease | |
run: ./test.sh "${{env.RELEASE_NAME}}" | |
test-streaming-lite-postgres: | |
name: test streaming-lite mode postgres | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: helm-build | |
path: dist | |
- uses: AbsaOSS/[email protected] | |
with: | |
cluster-name: "k3s-default" | |
k3d-version: "v5.6.0" | |
args: >- | |
--config=.k3d/single-cluster.yml | |
--trace | |
- name: Set Nussknacker image version | |
id: setNussknackerVersion | |
run: '[[ $GITHUB_REF == refs/heads/release-* || $GITHUB_REF == refs/tags/release-* ]] && version=${GITHUB_REF##*/release-} && echo "Using version based on release branch/tag name: $version" && echo "nuVersion=$version" >> $GITHUB_OUTPUT || (echo "Using default version" && echo "nuVersion=${{env.NUSSKNACKER_VERSION}}" >> $GITHUB_OUTPUT)' | |
- name: helmUpgrade | |
run: helm upgrade -i "${{env.RELEASE_NAME}}" dist/*.tgz --version "${{needs.build.outputs.version}}" --wait --debug -f deploy-values.yaml -f deploy-values-kafka-config.yaml -f deploy-values-streaming-lite.yaml --set "image.tag=${{steps.setNussknackerVersion.outputs.nuVersion}}_scala-2.12" | |
- name: helmTestRelease | |
run: ./test.sh "${{env.RELEASE_NAME}}" | |
test-streaming-lite-hsql: | |
name: test streaming-lite mode hsql | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: helm-build | |
path: dist | |
- uses: AbsaOSS/k3d-action@v2 | |
with: | |
cluster-name: "k3s-default" | |
args: >- | |
--config=.k3d/single-cluster.yml | |
--trace | |
- name: helmUpgrade | |
run: | | |
helm upgrade -i "${{env.RELEASE_NAME}}" dist/*.tgz \ | |
--version "${{needs.build.outputs.version}}" \ | |
--wait --debug \ | |
-f deploy-values.yaml \ | |
-f deploy-values-kafka-config.yaml \ | |
-f deploy-values-streaming-lite.yaml \ | |
-f deploy-values-db-hsql.yaml \ | |
--set "image.tag=${{env.NUSSKNACKER_VERSION}}" | |
- name: helmTestRelease | |
run: ./test.sh "${{env.RELEASE_NAME}}" | |
test-request-response: | |
name: test request-response mode | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: helm-build | |
path: dist | |
- uses: AbsaOSS/[email protected] | |
with: | |
cluster-name: "k3s-default" | |
k3d-version: "v5.6.0" | |
args: >- | |
--config=.k3d/single-cluster.yml | |
--trace | |
- name: Set Nussknacker image version | |
id: setNussknackerVersion | |
run: '[[ $GITHUB_REF == refs/heads/release-* || $GITHUB_REF == refs/tags/release-* ]] && version=${GITHUB_REF##*/release-} && echo "Using version based on release branch/tag name: $version" && echo "nuVersion=$version" >> $GITHUB_OUTPUT || (echo "Using default version" && echo "nuVersion=${{env.NUSSKNACKER_VERSION}}" >> $GITHUB_OUTPUT)' | |
- name: helmUpgrade | |
run: helm upgrade -i "${{env.RELEASE_NAME}}" dist/*.tgz --version "${{needs.build.outputs.version}}" --wait --debug -f deploy-values.yaml -f deploy-values-request-response.yaml --set "image.tag=${{steps.setNussknackerVersion.outputs.nuVersion}}_scala-2.12" | |
- name: helmTestRelease | |
run: ./test.sh "${{env.RELEASE_NAME}}" | |
publish-snapshot: | |
name: publish-snapshot | |
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.head_ref, 'preview/') }} | |
runs-on: ubuntu-latest | |
needs: [ build, test-flink, test-streaming-lite-postgres, test-streaming-lite-hsql, test-request-response ] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: helm-build | |
path: dist | |
- run: curl -u ${{env.CHART_REPOSITORY_AUTH}} --fail --upload-file "dist/${{env.NAME}}-${{needs.build.outputs.version}}.tgz" ${{env.CHARTS_PUBLIC_SNAPSHOTS_URL}} | |
publish-release: | |
name: publish-release | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
runs-on: ubuntu-latest | |
needs: [ build, test-flink, test-streaming-lite-postgres, test-streaming-lite-hsql, test-request-response ] | |
steps: | |
- uses: actions/download-artifact@v2 | |
with: | |
name: helm-build | |
path: dist | |
- run: curl -u ${{env.CHART_REPOSITORY_AUTH}} --fail --upload-file "dist/${{env.NAME}}-${{needs.build.outputs.version}}.tgz" ${{env.CHARTS_PUBLIC_RELEASES_URL}} |