forked from SAP-archive/xsk
-
Notifications
You must be signed in to change notification settings - Fork 0
293 lines (287 loc) · 14.3 KB
/
pre-release.yml
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
name: Pre-release
on:
push:
tags:
- 'pre*'
jobs:
build:
runs-on: ubuntu-latest
outputs:
XSK_VERSION_BUILD: ${{ steps.XSK_VERSION_PRINT.outputs.XSK_VERSION_OUTPUT }}
XSK_HELM_SHA: ${{ steps.XSK_HELM_SHA.outputs.XSK_HELM_SHA_PRINT }}
steps:
#--------Restore success job-------#
- name: Previous succeeded job
id: success
uses: actions/cache@v2
with:
path: success-job-${{ github.sha }}-${{ matrix.name }}
key: success-job-job-${{ github.sha }}-${{ matrix.name }}
#--------Restore success job-------#
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN }}
fetch-depth: 0
- name: Download sapmachine JDK 17
run: |
download_url="https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.2/sapmachine-jdk-17.0.2_linux-x64_bin.tar.gz"
wget -O "${RUNNER_TEMP}/sapmachine-jdk-17.tar.gz" "${download_url}"
- name: Setup sapmachine JDK 17
uses: actions/setup-java@v2
with:
distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/sapmachine-jdk-17.tar.gz
java-version: '17.0.2'
architecture: x64
- name: Set XSK Version
run: echo XSK_VERSION=${GITHUB_REF#refs/*/} | tr pre " " | sed 's/ //' >> $GITHUB_ENV
- name: XSK_VERSION_OUTPUT
run: echo "::set-output name=XSK_VERSION_OUTPUT::$XSK_VERSION"
id: XSK_VERSION_PRINT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true
- name: Maven Build
run: mvn clean install
- name: Docker Login
run: docker login -u ${{secrets.DOCKER_USER}} -p ${{secrets.DOCKER_PASSWORD}}
- name: Push XSK Base
run: |
cd releng/sap-kyma-runtime
docker build . \
--no-cache \
--platform linux/amd64 \
-t dirigiblelabs/xsk-kyma-runtime-base -f Dockerfile-base \
--push
cd ../../
- name: Push XSK
run: |
cd releng/server
cp -r "${JAVA_HOME}" jdk
docker build . \
--no-cache \
--platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 \
-t dirigiblelabs/xsk:${{ env.XSK_VERSION }} \
--push
cd ../../
- name: Push XSK Runtime
run: |
cd releng/server-runtime
cp -r "${JAVA_HOME}" jdk
docker build . \
--no-cache \
--platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 \
-t dirigiblelabs/xsk-runtime:${{ env.XSK_VERSION }} \
--push
cd ../../
- name: Push XSK for SAP Cloud Foundry
run: |
cd releng/sap-cf
cp -r "${JAVA_HOME}" jdk
docker build .
--no-cache \
--platform linux/amd64 \
-t dirigiblelabs/xsk-cf:${{ env.XSK_VERSION }}
--push
cd ../../
- name: Push XSK for SAP Kyma
run: |
cd releng/sap-kyma
docker build . \
--no-cache \
--platform linux/amd64 \
-t dirigiblelabs/xsk-kyma:${{ env.XSK_VERSION }}
--push
cd ../../
- name: Push XSK for SAP Kyma Runtime
run: |
cd releng/sap-kyma-runtime
docker build . \
--no-cache \
--platform linux/amd64 \
-t dirigiblelabs/xsk-kyma-runtime
--push
docker build . \
--no-cache \
--platform linux/amd64 \
-t dirigiblelabs/xsk-kyma-runtime-distro -f Dockerfile-distro
--push
cd ../../
- uses: buildpacks/github-actions/[email protected]
- name: XSK Buildpack
run: |
cd releng/buildpacks/xsk/
docker build --load --build-arg XSK_VERSION=${{ env.XSK_VERSION }} -t dirigiblelabs/buildpacks-stack-base-xsk . --target base
docker tag dirigiblelabs/buildpacks-stack-base-xsk dirigiblelabs/buildpacks-stack-base-xsk:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-stack-base-xsk:${{ env.XSK_VERSION }}
docker build --load --build-arg XSK_VERSION=${{ env.XSK_VERSION }} -t dirigiblelabs/buildpacks-stack-run-xsk . --target run
docker tag dirigiblelabs/buildpacks-stack-run-xsk dirigiblelabs/buildpacks-stack-run-xsk:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-stack-run-xsk:${{ env.XSK_VERSION }}
docker build --load --build-arg XSK_VERSION=${{ env.XSK_VERSION }} -t dirigiblelabs/buildpacks-stack-build-xsk . --target build
docker tag dirigiblelabs/buildpacks-stack-build-xsk dirigiblelabs/buildpacks-stack-build-xsk:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-stack-build-xsk:${{ env.XSK_VERSION }}
cd buildpack/
find *.toml -type f -exec sed -i ''s/#{XSKVersion}#/${{ env.XSK_VERSION }}/g'' {} \;
pack buildpack package dirigiblelabs/buildpacks-xsk --config ./package.toml
docker tag dirigiblelabs/buildpacks-xsk dirigiblelabs/buildpacks-xsk:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-xsk:${{ env.XSK_VERSION }}
pack builder create dirigiblelabs/buildpacks-builder-xsk --config ./builder.toml
docker tag dirigiblelabs/buildpacks-builder-xsk dirigiblelabs/buildpacks-builder-xsk:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-builder-xsk:${{ env.XSK_VERSION }}
cd ../../../../
- name: XSK Kyma Buildpack
run: |
cd releng/buildpacks/xsk-kyma/
docker build --load --build-arg XSK_VERSION=${{ env.XSK_VERSION }} -t dirigiblelabs/buildpacks-stack-base-xsk-kyma . --target base
docker tag dirigiblelabs/buildpacks-stack-base-xsk-kyma dirigiblelabs/buildpacks-stack-base-xsk-kyma:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-stack-base-xsk-kyma:${{ env.XSK_VERSION }}
docker build --load --build-arg XSK_VERSION=${{ env.XSK_VERSION }} -t dirigiblelabs/buildpacks-stack-run-xsk-kyma . --target run
docker tag dirigiblelabs/buildpacks-stack-run-xsk-kyma dirigiblelabs/buildpacks-stack-run-xsk-kyma:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-stack-run-xsk-kyma:${{ env.XSK_VERSION }}
docker build --load --build-arg XSK_VERSION=${{ env.XSK_VERSION }} -t dirigiblelabs/buildpacks-stack-build-xsk-kyma . --target build
docker tag dirigiblelabs/buildpacks-stack-build-xsk-kyma dirigiblelabs/buildpacks-stack-build-xsk-kyma:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-stack-build-xsk-kyma:${{ env.XSK_VERSION }}
cd buildpack/
find *.toml -type f -exec sed -i ''s/#{XSKVersion}#/${{ env.XSK_VERSION }}/g'' {} \;
pack buildpack package dirigiblelabs/buildpacks-xsk-kyma --config ./package.toml
docker tag dirigiblelabs/buildpacks-xsk-kyma dirigiblelabs/buildpacks-xsk-kyma:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-xsk-kyma:${{ env.XSK_VERSION }}
pack builder create dirigiblelabs/buildpacks-builder-xsk-kyma --config ./builder.toml
docker tag dirigiblelabs/buildpacks-builder-xsk-kyma dirigiblelabs/buildpacks-builder-xsk-kyma:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-builder-xsk-kyma:${{ env.XSK_VERSION }}
cd ../../../../
- name: XSK Kyma Runtime Buildpack
run: |
cd releng/buildpacks/xsk-kyma-runtime/
docker build --load -t dirigiblelabs/buildpacks-stack-base-xsk-kyma-runtime . --target base
docker push dirigiblelabs/buildpacks-stack-base-xsk-kyma-runtime
docker build --load -t dirigiblelabs/buildpacks-stack-run-xsk-kyma-runtime . --target run
docker push dirigiblelabs/buildpacks-stack-run-xsk-kyma-runtime
docker build --load -t dirigiblelabs/buildpacks-stack-build-xsk-kyma-runtime . --target build
docker push dirigiblelabs/buildpacks-stack-build-xsk-kyma-runtime
cd buildpack/
find *.toml -type f -exec sed -i ''s/#{XSKVersion}#/latest/g'' {} \;
pack buildpack package dirigiblelabs/buildpacks-xsk-kyma-runtime --config ./package.toml
docker push dirigiblelabs/buildpacks-xsk-kyma-runtime
pack builder create dirigiblelabs/buildpacks-builder-xsk-kyma-runtime --config ./builder.toml
docker push dirigiblelabs/buildpacks-builder-xsk-kyma-runtime
cd ../../../../
- name: XSK Cloud Foundry Buildpack
run: |
cd releng/buildpacks/xsk-cf/
docker build --load --build-arg XSK_VERSION=${{ env.XSK_VERSION }} -t dirigiblelabs/buildpacks-stack-base-xsk-cf . --target base
docker tag dirigiblelabs/buildpacks-stack-base-xsk-cf dirigiblelabs/buildpacks-stack-base-xsk-cf:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-stack-base-xsk-cf:${{ env.XSK_VERSION }}
docker build --load --build-arg XSK_VERSION=${{ env.XSK_VERSION }} -t dirigiblelabs/buildpacks-stack-run-xsk-cf . --target run
docker tag dirigiblelabs/buildpacks-stack-run-xsk-cf dirigiblelabs/buildpacks-stack-run-xsk-cf:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-stack-run-xsk-cf:${{ env.XSK_VERSION }}
docker build --load --build-arg XSK_VERSION=${{ env.XSK_VERSION }} -t dirigiblelabs/buildpacks-stack-build-xsk-cf . --target build
docker tag dirigiblelabs/buildpacks-stack-build-xsk-cf dirigiblelabs/buildpacks-stack-build-xsk-cf:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-stack-build-xsk-cf:${{ env.XSK_VERSION }}
cd buildpack/
find *.toml -type f -exec sed -i ''s/#{XSKVersion}#/${{ env.XSK_VERSION }}/g'' {} \;
pack buildpack package dirigiblelabs/buildpacks-xsk-cf --config ./package.toml
docker tag dirigiblelabs/buildpacks-xsk-cf dirigiblelabs/buildpacks-xsk-cf:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-xsk-cf:${{ env.XSK_VERSION }}
pack builder create dirigiblelabs/buildpacks-builder-xsk-cf --config ./builder.toml
docker tag dirigiblelabs/buildpacks-builder-xsk-cf dirigiblelabs/buildpacks-builder-xsk-cf:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-builder-xsk-cf:${{ env.XSK_VERSION }}
cd ../../../../
#----------------Helm Release------------------#
- id: install-secret-key
name: Install gpg secret key
run: |
cat <(echo -e "${{ secrets.GPG_KEY_HELM }}") | gpg --batch --import --no-tty --batch --yes
- name: Helm tool installer
uses: Azure/setup-helm@v1
- name: Helm Charts Release - Checkout gh-pages
run: |
mkdir charts-temp
cp -r releng/helm-charts/ charts-temp/
#### Git Checkout Workaround
git add .github/
git add .reuse/
git add LICENSES/
git add modules/
git add releng/
git add samples/
git reset --hard
####
git fetch
git checkout gh-pages
cp charts/* .
- name: Helm Charts Release - Set Chart Version - XSK
run: |
cd charts-temp/helm-charts/
find xsk/*.yaml -type f -exec sed -i ''s/#{XSKVersion}#/${{ env.XSK_VERSION }}/g'' {} \;
find xsk-kpack/*.yaml -type f -exec sed -i ''s/#{XSKVersion}#/${{ env.XSK_VERSION }}/g'' {} \;
find xsk-kpack/templates/*.yaml -type f -exec sed -i ''s/#{XSKVersion}#/${{ env.XSK_VERSION }}/g'' {} \;
find xsk-landscape/*.yaml -type f -exec sed -i ''s/#{XSKVersion}#/${{ env.XSK_VERSION }}/g'' {} \;
- name: Helm Charts Release
run: |
cp charts/* charts-temp/helm-charts/
cd charts-temp/helm-charts/
gpg --no-tty --batch --export-secret-keys > ~/.gnupg/secring.gpg
helm package --sign --key "XSK-gpg" --keyring /home/runner/.gnupg/secring.gpg xsk
helm package --sign --key "XSK-gpg" --keyring /home/runner/.gnupg/secring.gpg xsk-kpack
helm package --sign --key "XSK-gpg" --keyring /home/runner/.gnupg/secring.gpg xsk-landscape
- name: Verify helm chart
run: |
wget https://xsk.io/charts/pubring.gpg -O ~/.gnupg/pubring.gpg
cd charts-temp/helm-charts/
OUTPUT=$(helm verify --keyring ~/.gnupg/pubring.gpg xsk-${{ env.XSK_VERSION }}.tgz)
OUTPUT="${OUTPUT//'%'/'%25'}"
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
HELM_SHA=$(echo "$OUTPUT" | tail -n1)
SHA=$(sed -e 's#.*sha256:\(\)#\1#' <<< $HELM_SHA )
echo "::set-output name=XSK_HELM_SHA_PRINT::$SHA"
id: XSK_HELM_SHA
- name: Helm Chart Release Index
run: |
cd charts-temp/
helm repo index helm-charts/ --url https://sap.github.io/xsk/charts
cp -rf helm-charts/index.yaml ../.
cp -rf helm-charts/xsk-${{ env.XSK_VERSION }}.tgz ../charts/
cp -rf helm-charts/xsk-${{ env.XSK_VERSION }}.tgz.prov ../charts/
cp -rf helm-charts/xsk-kpack-${{ env.XSK_VERSION }}.tgz ../charts/
cp -rf helm-charts/xsk-kpack-${{ env.XSK_VERSION }}.tgz.prov ../charts/
cp -rf helm-charts/xsk-landscape-${{ env.XSK_VERSION }}.tgz ../charts/
cp -rf helm-charts/xsk-landscape-${{ env.XSK_VERSION }}.tgz.prov ../charts/
cd ..
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
git add index.yaml
git add charts/
git commit -m "Updates Helm Charts - Release ${{ env.XSK_VERSION }} - ci skip"
git push origin gh-pages
git add .
git reset --hard
git checkout main
- name: Slack Notification
if: ${{ failure() }}
uses: slackapi/[email protected]
with:
payload: "{\"type\":\"Pre-release\",\"url\":\"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Stage-release:
needs: build
uses: ./.github/workflows/stage-release.yaml
with:
XSK_VERSION: ${{ needs.build.outputs.XSK_VERSION_BUILD }}
XSK_HELM_SHA: ${{ needs.build.outputs.XSK_HELM_SHA }}
XSK_DISPATCH: 'false'
secrets:
STAGE_KYMA_CONFIG: ${{ secrets.STAGE_KYMA_CONFIG }}
STAGE_HANA_URL: ${{ secrets.STAGE_HANA_URL }}
STAGE_HANA_USERNAME: ${{ secrets.STAGE_HANA_USERNAME }}
STAGE_HANA_PASSWORD: ${{ secrets.STAGE_HANA_PASSWORD }}
STAGE_KYMA_HOST: ${{ secrets.STAGE_KYMA_HOST }}
STAGE_NAMESPACE: ${{ secrets.STAGE_NAMESPACE }}
STAGE_SERVICE_ACCOUNT: ${{ secrets.STAGE_SERVICE_ACCOUNT }}