From 6deec513842ada3fdd5e5a544e1535cd5a05abf4 Mon Sep 17 00:00:00 2001 From: Maxim Kuvyrkov Date: Sun, 8 Aug 2021 10:12:51 +0000 Subject: round-robin.sh: Share ccache between builds on different executors Change-Id: Ib5ae287428eca03b72825e419688affb59c60989 --- jenkins-helpers.sh | 10 +++++----- round-robin.sh | 14 ++++++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh index f862a4ab..2b089799 100644 --- a/jenkins-helpers.sh +++ b/jenkins-helpers.sh @@ -817,17 +817,17 @@ print_volume_mounts () # Add ccache volume for tcwg_* jobs. # These jobs depend on ccache for fast rebuilds of LLVM and GCC with # the host compiler. - # tcwg_* jobs use per-executor WORKSPACES, and ccache uses separate - # cache entries for different paths. Therefore we need to use - # separate caches for different $WORKSPACES. Otherwise we get - # a lot of cache polution on high-executor machines, e.g., for - # tcwg_bmk builds on tcwg-x86_64-dev-01 node. local prefix if [ x"${WORKSPACE+set}" = x"set" ]; then prefix=$(basename $WORKSPACE) else prefix=$(echo $job | cut -d- -f 1) fi + # tcwg_* jobs use per-executor WORKSPACES, and we configure ccache + # to use CCACHE_BASEDIR=$WORKSPACE so that ccache sees same paths + # for builds on different executors. + # Strip "_$EXECUTOR_NUMBER" from the job/workspace ID. + prefix="${prefix%_[0-9]*}" volume_id=$(print_docker_name "$prefix$suffix") mounts+=(ccache-"$volume_id":"$HOME"/.ccache) ;; diff --git a/round-robin.sh b/round-robin.sh index de33c873..48834ce8 100644 --- a/round-robin.sh +++ b/round-robin.sh @@ -184,6 +184,9 @@ prepare_abe () clone_or_update_repo abe tested https://git-us.linaro.org/toolchain/abe.git > /dev/null + local workspace + workspace=$(pwd) + cd abe # Add ccache wrappers. @@ -193,14 +196,14 @@ prepare_abe () cat > "$(pwd)/bin/gcc" < "$(pwd)/bin/g++" < "$(pwd)/bin/cc" < "$(pwd)/bin/c++" <