Skip to content

Commit c651ad5

Browse files
SONARJAVA-6231 Set up orchestrator cache (#5549)
1 parent 79aacab commit c651ad5

3 files changed

Lines changed: 78 additions & 5 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Setup Orchestrator Cache
2+
description: Sets up orchestrator cache
3+
4+
inputs:
5+
sq-version:
6+
description: 'SonarQube version. If DEV, cache will be disabled.'
7+
required: true
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Set Orchestrator Cache Variables
13+
shell: bash
14+
run: |
15+
# year-week
16+
CACHE_KEY=$(date +'%Y-%U')
17+
echo "ORCHESTRATOR_CACHE_KEY=$CACHE_KEY" >> $GITHUB_ENV
18+
echo "ORCHESTRATOR_HOME=${{ github.workspace }}/orchestrator" >> $GITHUB_ENV
19+
20+
- name: Cache Orchestrator
21+
if: inputs.sq-version != 'DEV'
22+
uses: SonarSource/gh-action_cache@v1
23+
with:
24+
path: ${{ env.ORCHESTRATOR_HOME }}
25+
key: orchestrator-${{ inputs.sq-version }}-${{ env.ORCHESTRATOR_CACHE_KEY }}-${{ github.run_id }}
26+
restore-keys: orchestrator-${{ inputs.sq-version }}-${{ env.ORCHESTRATOR_CACHE_KEY }}-
27+
28+
- name: Setup Orchestrator Home Directory
29+
shell: bash
30+
run: |
31+
mkdir -p "$ORCHESTRATOR_HOME"
32+
ls -lRh "$ORCHESTRATOR_HOME"

.github/workflows/build.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ jobs:
5656
fail-fast: false
5757
matrix:
5858
item:
59-
- { runner: github-ubuntu-latest-m, profile: without-sonarqube-project }
60-
- { runner: github-ubuntu-latest-m, profile: only-sonarqube-project }
61-
- { runner: github-windows-latest-m, profile: without-sonarqube-project }
62-
- { runner: github-windows-latest-m, profile: only-sonarqube-project }
59+
- { runner: github-ubuntu-latest-m, profile: without-sonarqube-project, sq_version: LATEST_RELEASE }
60+
- { runner: github-ubuntu-latest-m, profile: only-sonarqube-project, sq_version: LATEST_RELEASE }
61+
- { runner: github-windows-latest-m, profile: without-sonarqube-project, sq_version: LATEST_RELEASE }
62+
- { runner: github-windows-latest-m, profile: only-sonarqube-project, sq_version: LATEST_RELEASE }
6363
name: Ruling QA
6464
needs:
6565
- build
@@ -91,14 +91,18 @@ jobs:
9191
with:
9292
secrets: |
9393
development/github/token/licenses-ro token | GITHUB_TOKEN;
94+
- name: Orchestrator Cache
95+
uses: ./.github/actions/orchestrator-cache
96+
with:
97+
sq-version: ${{ matrix.item.sq_version }}
9498
- name: Run ruling tests
9599
shell: bash # Set explicitly so Bash is used on Windows runners too.
96100
env:
97101
MAVEN_OPTS: "-Xmx3g"
98102
GITHUB_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN }}
99103
run: |
100104
cd its/ruling
101-
mvn package ${MAVEN_OUTPUT_ARGS} "-Pit-ruling,${{ matrix.item.profile }}" -Dsonar.runtimeVersion=LATEST_RELEASE -Dmaven.test.redirectTestOutputToFile=false -Dparallel=methods -DuseUnlimitedThreads=true
105+
mvn package ${MAVEN_OUTPUT_ARGS} "-Pit-ruling,${{ matrix.item.profile }}" -Dsonar.runtimeVersion=${{ matrix.item.sq_version }} -Dmaven.test.redirectTestOutputToFile=false -Dparallel=methods -DuseUnlimitedThreads=true
102106
- name: Upload Actual Results On Failure
103107
if: failure()
104108
uses: ./.github/actions/upload-actual
@@ -148,6 +152,10 @@ jobs:
148152
with:
149153
secrets: |
150154
development/github/token/licenses-ro token | GITHUB_TOKEN;
155+
- name: Orchestrator Cache
156+
uses: ./.github/actions/orchestrator-cache
157+
with:
158+
sq-version: ${{ matrix.item.sq_version }}
151159
- name: Plugin QA
152160
env:
153161
GITHUB_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Cleanup S3 Cache
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
description: "Branch name (e.g., 'feature/my-branch'). Leave empty to list all entries."
8+
required: false
9+
type: string
10+
default: ""
11+
key:
12+
description: "Cache key prefix (e.g., 'sccache-Linux-')"
13+
required: false
14+
type: string
15+
default: ""
16+
dry-run:
17+
description: "Preview deletions without executing them"
18+
required: false
19+
type: boolean
20+
default: true
21+
22+
jobs:
23+
cleanup:
24+
runs-on: github-ubuntu-latest-s
25+
permissions:
26+
id-token: write
27+
contents: read
28+
steps:
29+
- uses: SonarSource/gh-action_cache/cleanup@v1
30+
with:
31+
branch: ${{ inputs.branch }}
32+
key: ${{ inputs.key }}
33+
dry-run: ${{ inputs.dry-run }}

0 commit comments

Comments
 (0)