Skip to content

Commit a9dd221

Browse files
Ensure ITs jobs do not share cache
1 parent 63bef71 commit a9dd221

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Write File
2+
description: Writes a file with the given content
3+
4+
inputs:
5+
file-path:
6+
description: 'Path to the file to write.'
7+
required: true
8+
content:
9+
description: 'Content to write to the file.'
10+
required: true
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Write Content to File
16+
shell: bash
17+
env:
18+
FILE_PATH: ${{ inputs.file-path }}
19+
CONTENT: ${{ inputs.content }}
20+
run: |
21+
mkdir -p "$(dirname "$FILE_PATH")"
22+
echo "$CONTENT" > "$FILE_PATH"
23+
echo "$CONTENT"

.github/workflows/build.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ jobs:
7979
version: 2025.7.12
8080
- name: Select Java Version
8181
run: mise use java@21
82+
- name: Ensure Separate Job Cache Key
83+
uses: ./.github/actions/write-file
84+
with:
85+
file-path: just_for_cache_key_calculation/pom.xml
86+
content: ${{ github.job }}-${{ toJSON(matrix.item) }}
8287
- name: Configure Maven
8388
uses: SonarSource/ci-github-actions/config-maven@v1
8489
with:
@@ -141,6 +146,11 @@ jobs:
141146
version: 2025.7.12
142147
- name: Select Java Version
143148
run: mise use java@21
149+
- name: Ensure Separate Job Cache Key
150+
uses: ./.github/actions/write-file
151+
with:
152+
file-path: just_for_cache_/pom.xml
153+
content: ${{ github.job }}-${{ matrix.sq_version }}
144154
- name: Configure Maven
145155
uses: SonarSource/ci-github-actions/config-maven@v1
146156
with:
@@ -186,6 +196,11 @@ jobs:
186196
secrets: |
187197
development/kv/data/next url | SONAR_HOST_URL;
188198
development/kv/data/next token | SONAR_TOKEN;
199+
- name: Ensure Separate Job Cache Key
200+
uses: ./.github/actions/write-file
201+
with:
202+
file-path: just_for_cache_key_calculation/pom.xml
203+
content: ${{ github.job }}
189204
- uses: SonarSource/ci-github-actions/config-maven@v1
190205
with:
191206
artifactory-reader-role: private-reader
@@ -315,6 +330,11 @@ jobs:
315330
development/kv/data/next url | SONAR_HOST_URL;
316331
development/kv/data/next token | SONAR_TOKEN;
317332
development/github/token/licenses-ro token | GITHUB_TOKEN;
333+
- name: Ensure Separate Job Cache Key
334+
uses: ./.github/actions/write-file
335+
with:
336+
file-path: just_for_cache_key_calculation/pom.xml
337+
content: ${{ github.job }}
318338
- uses: SonarSource/ci-github-actions/config-maven@v1
319339
with:
320340
artifactory-reader-role: private-reader

0 commit comments

Comments
 (0)