Skip to content

Commit

Permalink
SONARPY-2041 Implement orchestrator cache (SonarSource#1918)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghislainpiot authored Aug 8, 2024
1 parent e440aff commit ccfa9e0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,27 @@ build_container_definition: &BUILD_CONTAINER_DEFINITION
only_sonarsource_qa: &ONLY_SONARSOURCE_QA
only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == "" && ($CIRRUS_PR != "" || $CIRRUS_BRANCH == 'master' || $CIRRUS_BRANCH =~ "branch-.*" || $CIRRUS_BUILD_SOURCE == 'api' || $CIRRUS_BRANCH =~ "dogfood-on-.*")

orchestrator_cache_definition: &ORCHESTRATOR_CACHE_DEFINITION
set_orchestrator_home_script: |
# Check if SQ_VERSION exists and create an intermediary variable
if [ -n "$SQ_VERSION" ]; then
TASK_NAME_WITH_VERSION="${CIRRUS_TASK_NAME}-${SQ_VERSION}"
else
TASK_NAME_WITH_VERSION="${CIRRUS_TASK_NAME}"
fi
echo "CURRENT_MONTH=$(date +"%B")" >> $CIRRUS_ENV
echo "ORCHESTRATOR_HOME=${CIRRUS_WORKING_DIR}/orchestrator/${TASK_NAME_WITH_VERSION}/${CURRENT_MONTH}" >> $CIRRUS_ENV
echo "TASK_NAME_WITH_VERSION=${TASK_NAME_WITH_VERSION}" >> $CIRRUS_ENV
mkdir_orchestrator_home_script: |
echo "Create dir ${ORCHESTRATOR_HOME} if needed"
mkdir -p ${ORCHESTRATOR_HOME}
orchestrator_cache:
folder: ${ORCHESTRATOR_HOME}
fingerprint_script: echo ${TASK_NAME_WITH_VERSION}-${CURRENT_MONTH}
reupload_on_changes: "true"

build_task:
<<: *BUILD_CONTAINER_DEFINITION
<<: *ONLY_SONARSOURCE_QA
Expand Down Expand Up @@ -134,6 +155,7 @@ plugin_qa_task:
- SQ_VERSION: DEV
maven_cache:
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
<<: *ORCHESTRATOR_CACHE_DEFINITION
qa_script:
- source cirrus-env QA
- source set_maven_build_version $BUILD_NUMBER
Expand All @@ -154,6 +176,7 @@ ruling_task:
SONARSOURCE_QA: true
maven_cache:
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
<<: *ORCHESTRATOR_CACHE_DEFINITION
submodules_script:
- git submodule update --init
ruling_script:
Expand All @@ -176,6 +199,7 @@ extended_ruling_task:
SONARSOURCE_QA: true
maven_cache:
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
<<: *ORCHESTRATOR_CACHE_DEFINITION
submodules_script:
- git submodule update --init
ruling_script:
Expand All @@ -199,6 +223,7 @@ pr_analysis_qa_task:
SONARSOURCE_QA: true
maven_cache:
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
<<: *ORCHESTRATOR_CACHE_DEFINITION
qa_script:
- source cirrus-env QA
- source set_maven_build_version $BUILD_NUMBER
Expand Down

0 comments on commit ccfa9e0

Please sign in to comment.