-
Notifications
You must be signed in to change notification settings - Fork 0
187 lines (184 loc) · 8.15 KB
/
helm-test-workflow.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
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@v4
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@v4
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@v4
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@v4
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@v4
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@v4
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}}