Bug 1704668 [wpt PR 28449] - Fix surface layer size for remote frames, a=testonly
[gecko.git] / build / mozconfig.cache
blob1bd202b17d859087735dff74cc4a90a7fa722508
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 # Thunderbird builds will have this set prior to including this file
8 aws_prefix=${aws_prefix:-taskcluster}
10 # builds where buildprops didn't have the data (eg: taskcluster) and without sccache disabled:
11 if test -z "$bucket" -a -z "$SCCACHE_DISABLE"; then
13     # prevent rerun if az is set, or wget is not available
14     if test -z "$availability_zone" -a -x "$(command -v wget)"; then
15         if test -n "$TASKCLUSTER_WORKER_LOCATION" -a -x "$(command -v jq)"; then
16             cloud=$(echo $TASKCLUSTER_WORKER_LOCATION | jq .cloud | tr -d \")
17             case $cloud in
18                 aws|google)
19                     availability_zone=$(echo $TASKCLUSTER_WORKER_LOCATION | jq .availabilityZone | tr -d \")
20                     region=$(echo $TASKCLUSTER_WORKER_LOCATION | jq .region | tr -d \")
21                     ;;
22             esac
23         fi
24         if test -z "$availability_zone" -o -z "$region"; then
25             if test -n "${TASKCLUSTER_WORKER_GROUP}"; then
26                 # TASKCLUSTER_WORKER_GROUP is just the region now, so
27                 # stick an extra character on to make the already-convoluted logic
28                 # here simpler.
29                 availability_zone="${TASKCLUSTER_WORKER_GROUP}x"
30             elif [ -n "${SCCACHE_GCS_KEY_PATH}" ]; then
31                 # gcp availability_zone is of the form <region>-<letter> where region is e.g. us-west2, and az is us-west2-a
32                 gcp_zone=$(wget -T 1 -t 1 -q -O - http://169.254.169.254/computeMetadata/v1beta1/instance/zone || true)
33                 availability_zone=${gcp_zone##*/}
34             else
35                 # timeout after 1 second, and don't retry (failure indicates instance is not in ec2 or network issue)
36                 # ec2 availability_zone is of the form <region><letter> where region is e.g. us-west-2, and az is us-west-2a
37                 availability_zone=$(wget -T 1 -t 1 -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone || true)
38             fi
39         fi
40         if test -z "$availability_zone" -o "$availability_zone" = "not-ec2"; then
41             availability_zone=not-ec2
42         elif test -n "$cloud"; then
43             case $cloud in
44             google)
45                 bucket=sccache-l${MOZ_SCM_LEVEL}-${region}
46                 ;;
47             aws)
48                 bucket=${aws_prefix}-level-${MOZ_SCM_LEVEL}-sccache-${region}
49                 ;;
50             esac
51         elif [ -n "${SCCACHE_GCS_KEY_PATH}" ]; then
52             # gcp region is az with last two letters trimmed
53             if test -z "$region"; then
54                 region=${availability_zone::${#availability_zone}-2}
55             fi
56             bucket=${aws_prefix}-level-${MOZ_SCM_LEVEL}-sccache-${region}
57         else
58             # ec2 region is az with last letter trimmed
59             if test -z "$region"; then
60                 region=${availability_zone%?}
61             fi
62             bucket=${aws_prefix}-level-${MOZ_SCM_LEVEL}-sccache-${region}
63         fi
64     fi
67 if test -n "$bucket"; then
68     if test "$cloud" = "google"; then
69         mk_add_options "export SCCACHE_GCS_BUCKET=$bucket"
70         mk_add_options "export SCCACHE_GCS_RW_MODE=READ_WRITE"
71         mk_add_options "export SCCACHE_GCS_CREDENTIALS_URL=http://taskcluster/auth/v1/gcp/credentials/$SCCACHE_GCS_PROJECT/${bucket}@$SCCACHE_GCS_PROJECT.iam.gserviceaccount.com"
72     elif [ -n "${SCCACHE_GCS_KEY_PATH}" ]; then
73         mk_add_options "export SCCACHE_GCS_BUCKET=$bucket"
74     else
75         mk_add_options "export SCCACHE_BUCKET=$bucket"
76         # instruct sccache to fetch the credentials from the Auth service's awsS3Credentials endpoint, via the Taskcluster proxy.
77         mk_add_options "export AWS_IAM_CREDENTIALS_URL=http://taskcluster/auth/v1/aws/s3/read-write/${bucket}/?format=iam-role-compat"
78     fi
79     export CCACHE="sccache"
80     export SCCACHE_VERBOSE_STATS=1
81     # Workaround for https://github.com/mozilla/sccache/issues/459#issuecomment-618756635
82     mk_add_options "export SCCACHE_MAX_FRAME_LENGTH=50000000"
83     mk_add_options MOZBUILD_MANAGE_SCCACHE_DAEMON=${MOZ_FETCHES_DIR}/sccache/sccache