1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 # Setup for build cache
7 # builds where buildprops didn't have the data (eg: taskcluster) and without sccache disabled:
8 if test -z "$bucket" -a -z "$SCCACHE_DISABLE" -a -z "$MOZ_PGO"; then
10 # prevent rerun if az is set, or wget is not available
11 if test -z "$availability_zone" -a -x "$(command -v wget)"; then
12 if test -n "${TASKCLUSTER_WORKER_GROUP}"; then
13 # TASKCLUSTER_WORKER_GROUP is just the region now, so
14 # stick an extra character on to make the already-convoluted logic
16 availability_zone="${TASKCLUSTER_WORKER_GROUP}x"
18 # timeout after 1 second, and don't retry (failure indicates instance is not in ec2 or network issue)
19 # availability_zone is of the form <region><letter> where region is e.g. us-west-2, and az is us-west-2a
20 availability_zone=$(wget -T 1 -t 1 -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone || true)
22 if test -z "$availability_zone" -o "$availability_zone" = "not-ec2"; then
23 availability_zone=not-ec2
25 # region is az with last letter trimmed
26 region=${availability_zone%?}
27 # set S3 bucket according to tree (level)
28 case "${GECKO_HEAD_REPOSITORY}" in
30 bucket=taskcluster-level-1-sccache-${region}
32 *hg.mozilla.org/integration/autoland*|*hg.mozilla.org/integration/mozilla-inbound*)
33 bucket=taskcluster-level-3-sccache-${region}
40 if test -n "$bucket"; then
41 mk_add_options "export SCCACHE_BUCKET=$bucket"
42 export CCACHE="$topsrcdir/sccache2/sccache"
43 export SCCACHE_VERBOSE_STATS=1
44 mk_add_options MOZBUILD_MANAGE_SCCACHE_DAEMON=${topsrcdir}/sccache2/sccache