Nussknacker helm CI #1138
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 | |
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/" | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: build | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.setVersion.outputs.version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Print Nussknacker version | |
run: | | |
echo "Nussknacker version: $NUSSKNACKER_VERSION" | |
- name: setVersion | |
id: setVersion | |
run: echo "::set-output name=version::$(helm show chart ${{env.CHART_SRC_DIR}} | grep ^version | sed -e "s/.*:\ //;s/SNAPSHOT/SNAPSHOT.${{github.run_id}}/")" | |
- 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@v2 | |
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 ] | |
env: | |
NUSSKNACKER_VERSION: staging-latest_scala-2.12 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: helm-build | |
path: dist | |
- uses: AbsaOSS/[email protected] | |
with: | |
cluster-name: "k3s-default" | |
k3d-version: "v5.4.9" # default version - change with caution, there was some problem after upgrade | |
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 --set "image.tag=${{env.NUSSKNACKER_VERSION}}" | |
- name: helmTestRelease | |
run: ./test.sh "${{env.RELEASE_NAME}}" | |
test-streaming-lite: | |
name: test streaming-lite mode | |
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 | |
- 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@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-request-response.yaml --set "image.tag=${{env.NUSSKNACKER_VERSION}}" | |
- 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, 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_SNAPSHOTS_URL}} | |
publish-release: | |
name: publish-release | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
runs-on: ubuntu-latest | |
needs: [ build, test-flink, test-streaming-lite, 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}} |