Skip to content

Commit 34beedd

Browse files
authored
CICD: Pull image before running the test (#339)
* Pull CCM image before the test * Remove RC images from test list
1 parent d642afa commit 34beedd

File tree

1 file changed

+44
-26
lines changed

1 file changed

+44
-26
lines changed

.github/workflows/[email protected]

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ jobs:
160160
- name: Checkout source
161161
uses: actions/checkout@v4
162162

163-
- name: Set up JDK 8
163+
- name: Set up JDK ${{ matrix.java-version }}
164164
uses: actions/setup-java@v4
165165
with:
166166
java-version: ${{ matrix.java-version }}
@@ -185,47 +185,56 @@ jobs:
185185
id: cassandra-version
186186
run: |
187187
if [[ "${{ matrix.cassandra-version }}" == "RELEASE-3.X" ]]; then
188-
echo "value=$(python3 ci/version_fetch.py --version-index 1 cassandra3-stable:1)" >> $GITHUB_OUTPUT
188+
echo "value=$(python3 ci/version_fetch.py --version-index 1 cassandra3-stable:1 | tr -d '\"')" >> $GITHUB_OUTPUT
189189
elif [[ "${{ matrix.cassandra-version }}" == "RELEASE-4.X" ]]; then
190-
echo "value=$(python3 ci/version_fetch.py --version-index 1 cassandra4-stable:1)" >> $GITHUB_OUTPUT
190+
echo "value=$(python3 ci/version_fetch.py --version-index 1 cassandra4-stable:1 | tr -d '\"')" >> $GITHUB_OUTPUT
191191
else
192192
echo "Unknown cassandra version name `${{ matrix.cassandra-version }}`"
193193
fi
194194
195-
- name: Restore CCM image cache
195+
- name: Pull CCM image from the cache
196196
uses: actions/cache/restore@v4
197197
id: ccm-cache
198198
with:
199199
path: ~/.ccm/repository
200200
key: ccm-cassandra-${{ runner.os }}-${{ steps.cassandra-version.outputs.value }}
201201

202-
- name: Run integration tests on Cassandra (${{ steps.cassandra-version.outputs.value }})
203-
run: mvn -B -e verify -Dccm.version=${{ steps.cassandra-version.outputs.value }} -Dfmt.skip=true -Dclirr.skip=true -Danimal.sniffer.skip=true
202+
- name: Download Cassandra (${{ steps.cassandra-version.outputs.value }}) image
203+
if: steps.ccm-cache.outputs.cache-hit != 'true'
204+
run: |
205+
rm -rf /tmp/download.ccm || true
206+
mkdir /tmp/download.ccm || true
207+
ccm create ccm_1 -i 127.0.1. -n 3:0 -v "${{ steps.cassandra-version.outputs.value }}" --config-dir=/tmp/download.ccm
208+
rm -rf /tmp/download.ccm
204209
205-
- name: Save CCM image cache
206-
uses: actions/cache/save@v4
210+
- name: Save CCM image into the cache
207211
if: steps.ccm-cache.outputs.cache-hit != 'true'
212+
uses: actions/cache/save@v4
208213
with:
209214
path: ~/.ccm/repository
210215
key: ccm-cassandra-${{ runner.os }}-${{ steps.cassandra-version.outputs.value }}
211216

217+
- name: Run integration tests on Cassandra (${{ steps.cassandra-version.outputs.value }})
218+
id: run-integration-tests
219+
run: mvn -B -e verify -Dccm.version=${{ steps.cassandra-version.outputs.value }} -Dfmt.skip=true -Dclirr.skip=true -Danimal.sniffer.skip=true
220+
212221
- name: Copy test results
213-
if: success() || failure()
222+
if: steps.run-integration-tests.outcome == 'failure'
214223
run: |
215224
shopt -s globstar
216225
mkdir cassandra-${{ matrix.cassandra-version }}
217226
cp --parents ./**/target/*-reports/*.xml cassandra-${{ matrix.cassandra-version }}/
218227
219228
- name: Upload test results
229+
if: steps.run-integration-tests.outcome == 'failure'
220230
uses: actions/upload-artifact@v4
221-
if: success() || failure()
222231
with:
223232
name: test-results-${{ matrix.java-version }}-${{ matrix.cassandra-version }}
224233
path: "*/**/target/*-reports/*.xml"
225234

226235
- name: Upload CCM logs
227236
uses: actions/upload-artifact@v4
228-
if: ${{ failure() }}
237+
if: failure()
229238
with:
230239
name: ccm-log-cassandra-${{ matrix.java-version }}-${{ matrix.cassandra-version }}
231240
path: /tmp/ccm*/ccm*/node*/logs/*
@@ -238,15 +247,15 @@ jobs:
238247

239248
strategy:
240249
matrix:
241-
scylla-version: [ENTERPRISE-RELEASE, ENTERPRISE-PRIOR-RELEASE, OSS-RELEASE, OSS-PRIOR-RELEASE, ENTERPRISE-RC, OSS-RC]
250+
scylla-version: [ENTERPRISE-RELEASE, ENTERPRISE-PRIOR-RELEASE, OSS-RELEASE, OSS-PRIOR-RELEASE]
242251
java-version: [8]
243252
fail-fast: false
244253

245254
steps:
246255
- name: Checkout source
247256
uses: actions/checkout@v4
248257

249-
- name: Set up JDK 8
258+
- name: Set up JDK ${{ matrix.java-version }}
250259
uses: actions/setup-java@v4
251260
with:
252261
java-version: ${{ matrix.java-version }}
@@ -272,56 +281,65 @@ jobs:
272281
id: scylla-version
273282
run: |
274283
if [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-RELEASE" ]]; then
275-
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-enterprise-stable:1)" >> $GITHUB_OUTPUT
284+
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-enterprise-stable:1 | tr -d '\"')" >> $GITHUB_OUTPUT
276285
elif [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-PRIOR-RELEASE" ]]; then
277-
echo "value=$(python3 ci/version_fetch.py --version-index 2 scylla-enterprise-stable:2)" >> $GITHUB_OUTPUT
286+
echo "value=$(python3 ci/version_fetch.py --version-index 2 scylla-enterprise-stable:2 | tr -d '\"')" >> $GITHUB_OUTPUT
278287
elif [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-RC" ]]; then
279-
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-enterprise-rc)" >> $GITHUB_OUTPUT
288+
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-enterprise-rc | tr -d '\"')" >> $GITHUB_OUTPUT
280289
elif [[ "${{ matrix.scylla-version }}" == "OSS-RELEASE" ]]; then
281-
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-oss-stable:1)" >> $GITHUB_OUTPUT
290+
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-oss-stable:1 | tr -d '\"')" >> $GITHUB_OUTPUT
282291
elif [[ "${{ matrix.scylla-version }}" == "OSS-PRIOR-RELEASE" ]]; then
283-
echo "value=$(python3 ci/version_fetch.py --version-index 2 scylla-oss-stable:2)" >> $GITHUB_OUTPUT
292+
echo "value=$(python3 ci/version_fetch.py --version-index 2 scylla-oss-stable:2 | tr -d '\"')" >> $GITHUB_OUTPUT
284293
elif [[ "${{ matrix.scylla-version }}" == "OSS-RC" ]]; then
285-
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-oss-rc)" >> $GITHUB_OUTPUT
294+
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-oss-rc | tr -d '\"')" >> $GITHUB_OUTPUT
286295
else
287296
echo "Unknown scylla version name `${{ matrix.scylla-version }}`"
288297
exit 1
289298
fi
290299
291-
- name: Restore CCM image cache
300+
- name: Pull CCM image from the cache
292301
uses: actions/cache/restore@v4
293302
id: ccm-cache
294303
with:
295304
path: ~/.ccm/repository
296305
key: ccm-scylla-${{ runner.os }}-${{ steps.scylla-version.outputs.value }}
297306

298-
- name: Run integration tests on Scylla (${{ steps.scylla-version.outputs.value }})
299-
run: mvn -B verify -Dccm.version=${{ steps.scylla-version.outputs.value }} -Dccm.scylla=true -Dfmt.skip=true -Dclirr.skip=true -Danimal.sniffer.skip=true
307+
- name: Download Scylla (${{ steps.scylla-version.outputs.value }}) image
308+
if: steps.ccm-cache.outputs.cache-hit != 'true'
309+
run: |
310+
rm -rf /tmp/download.ccm || true
311+
mkdir /tmp/download.ccm || true
312+
ccm create ccm_1 -i 127.0.1. -n 3:0 -v "release:${{ steps.scylla-version.outputs.value }}" --scylla --config-dir=/tmp/download.ccm
313+
rm -rf /tmp/download.ccm
300314
301-
- name: Save CCM image cache
315+
- name: Save CCM image into the cache
302316
uses: actions/cache/save@v4
303317
if: steps.ccm-cache.outputs.cache-hit != 'true'
304318
with:
305319
path: ~/.ccm/repository
306320
key: ccm-scylla-${{ runner.os }}-${{ steps.scylla-version.outputs.value }}
307321

322+
- name: Run integration tests on Scylla (${{ steps.scylla-version.outputs.value }})
323+
id: run-integration-tests
324+
run: mvn -B verify -Dccm.version=${{ steps.scylla-version.outputs.value }} -Dccm.scylla=true -Dfmt.skip=true -Dclirr.skip=true -Danimal.sniffer.skip=true
325+
308326
- name: Copy test results
309-
if: success() || failure()
327+
if: steps.run-integration-tests.outcome == 'failure'
310328
run: |
311329
shopt -s globstar
312330
mkdir scylla-${{ matrix.scylla-version }}
313331
cp --parents ./**/target/*-reports/*.xml scylla-${{ matrix.scylla-version }}/
314332
315333
- name: Upload test results
316334
uses: actions/upload-artifact@v4
317-
if: success() || failure()
335+
if: steps.run-integration-tests.outcome == 'failure'
318336
with:
319337
name: test-results-${{ matrix.java-version }}-${{ matrix.scylla-version }}
320338
path: "*/**/target/*-reports/*.xml"
321339

322340
- name: Upload CCM logs
323341
uses: actions/upload-artifact@v4
324-
if: ${{ failure() }}
342+
if: failure()
325343
with:
326344
name: ccm-log-scylla-${{ matrix.java-version }}-${{ matrix.scylla-version }}
327345
path: /tmp/ccm*/ccm*/node*/logs/*

0 commit comments

Comments
 (0)