build-setup: Make ssc_dir as optional environment
ssc_dir was set to ${HOME} and could not be set by environment.
There is a need to split the ${ssc_dir} and ${HOME} to resolve an issue
related to git-proxy (see below TL;DR), so make it an optional
environment of this script.
TL;DR
When building behind a proxy or using proxy to speedup the downloads, it
is necessary to use git-proxy globally.
The git-proxy script itself is in the ${WORKSPACE}, and the .gitconfig
is in ${HOME}.
When building matrix jobs, say job-a and job-b
1. job-a will set .gitconfig to use git-proxy in it's own ${WORKSPACE}.
2. When job-b starts, it will set .gitconfig to use git-proxy in b's
${WORKSPACE}, which typically is a different dir.
So far it's OK, because the git-proxy's content is the same and both
files exists.
3. Say job-b finishes, and job-a is still building.
4. The queued job2 starts, and job2-b starts.
5. Now b's ${WORKSPACE} will be cleaned up, while job-a is still
using the git-proxy in b's ${WORKSPACE}, and job-a will fail with below
log:
fatal: cannot run
/path/to/job-b-workspace/.../bin/git-proxy: No such file or directory
The fix is to use separated ${HOME} for each job, so that the proxy will
not conflict anymore.
But the jobs could still share the downloads and sstate directories by
${ssc_dir}.
The the job setup will be:
* Set a shared directory between jobs for ${ssc_dir};
* Set different directories between jobs for ${HOME}.
Tested: Verify there is no above build error anymore.
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: If07086a862c2a7854cc2571139895013951ad616
diff --git a/build-setup.sh b/build-setup.sh
index 5d99bc1..7a5cacf 100755
--- a/build-setup.sh
+++ b/build-setup.sh
@@ -53,6 +53,9 @@
# obmc_dir Path of the OpenBMC repo directory used as a reference
# for the build inside the container.
# Default: "${WORKSPACE}/openbmc"
+# ssc_dir Path of the OpenBMC shared directory that contains the
+# downloads dir and the sstate dir.
+# Default: "${HOME}"
# xtrct_small_copy_dir
# Directory within build_dir that should be copied to
# xtrct_path. The directory and all parents up to, but not
@@ -89,7 +92,7 @@
# Deployment variables
obmc_dir=${obmc_dir:-${WORKSPACE}/openbmc}
-ssc_dir=${HOME}
+ssc_dir=${ssc_dir:-${HOME}}
xtrct_small_copy_dir=${xtrct_small_copy_dir:-deploy/images}
xtrct_path="${obmc_dir}/build/tmp"
xtrct_copy_timeout="300"