Skip to content

Commit ccfa9e0

Browse files
authored
SONARPY-2041 Implement orchestrator cache (#1918)
1 parent e440aff commit ccfa9e0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

.cirrus.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,27 @@ build_container_definition: &BUILD_CONTAINER_DEFINITION
5454
only_sonarsource_qa: &ONLY_SONARSOURCE_QA
5555
only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == "" && ($CIRRUS_PR != "" || $CIRRUS_BRANCH == 'master' || $CIRRUS_BRANCH =~ "branch-.*" || $CIRRUS_BUILD_SOURCE == 'api' || $CIRRUS_BRANCH =~ "dogfood-on-.*")
5656

57+
orchestrator_cache_definition: &ORCHESTRATOR_CACHE_DEFINITION
58+
set_orchestrator_home_script: |
59+
60+
# Check if SQ_VERSION exists and create an intermediary variable
61+
if [ -n "$SQ_VERSION" ]; then
62+
TASK_NAME_WITH_VERSION="${CIRRUS_TASK_NAME}-${SQ_VERSION}"
63+
else
64+
TASK_NAME_WITH_VERSION="${CIRRUS_TASK_NAME}"
65+
fi
66+
67+
echo "CURRENT_MONTH=$(date +"%B")" >> $CIRRUS_ENV
68+
echo "ORCHESTRATOR_HOME=${CIRRUS_WORKING_DIR}/orchestrator/${TASK_NAME_WITH_VERSION}/${CURRENT_MONTH}" >> $CIRRUS_ENV
69+
echo "TASK_NAME_WITH_VERSION=${TASK_NAME_WITH_VERSION}" >> $CIRRUS_ENV
70+
mkdir_orchestrator_home_script: |
71+
echo "Create dir ${ORCHESTRATOR_HOME} if needed"
72+
mkdir -p ${ORCHESTRATOR_HOME}
73+
orchestrator_cache:
74+
folder: ${ORCHESTRATOR_HOME}
75+
fingerprint_script: echo ${TASK_NAME_WITH_VERSION}-${CURRENT_MONTH}
76+
reupload_on_changes: "true"
77+
5778
build_task:
5879
<<: *BUILD_CONTAINER_DEFINITION
5980
<<: *ONLY_SONARSOURCE_QA
@@ -134,6 +155,7 @@ plugin_qa_task:
134155
- SQ_VERSION: DEV
135156
maven_cache:
136157
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
158+
<<: *ORCHESTRATOR_CACHE_DEFINITION
137159
qa_script:
138160
- source cirrus-env QA
139161
- source set_maven_build_version $BUILD_NUMBER
@@ -154,6 +176,7 @@ ruling_task:
154176
SONARSOURCE_QA: true
155177
maven_cache:
156178
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
179+
<<: *ORCHESTRATOR_CACHE_DEFINITION
157180
submodules_script:
158181
- git submodule update --init
159182
ruling_script:
@@ -176,6 +199,7 @@ extended_ruling_task:
176199
SONARSOURCE_QA: true
177200
maven_cache:
178201
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
202+
<<: *ORCHESTRATOR_CACHE_DEFINITION
179203
submodules_script:
180204
- git submodule update --init
181205
ruling_script:
@@ -199,6 +223,7 @@ pr_analysis_qa_task:
199223
SONARSOURCE_QA: true
200224
maven_cache:
201225
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
226+
<<: *ORCHESTRATOR_CACHE_DEFINITION
202227
qa_script:
203228
- source cirrus-env QA
204229
- source set_maven_build_version $BUILD_NUMBER

0 commit comments

Comments
 (0)