#!/bin/bash -vex # Set bash options to exit immediately if a pipeline exists non-zero, expand # print a trace of commands, and make output verbose (print shell input as it's # read) # See https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html set -x -e -v -o pipefail # Prefix errors with taskcluster error prefix so that they are parsed by Treeherder raise_error() { echo echo "[taskcluster-image-build:error] $1" exit 1 } # Ensure that the PROJECT is specified so the image can be indexed test -n "$PROJECT" || raise_error "PROJECT must be provided." test -n "$HASH" || raise_error "Context HASH must be provided." test -n "$IMAGE_NAME" || raise_error "IMAGE_NAME must be provided." # The docker socket is mounted by the taskcluster worker in a way that prevents # us changing its permissions to allow the worker user to access it. Create a # proxy socket that the worker user can use. export DOCKER_SOCKET=/var/run/docker.proxy socat UNIX-LISTEN:$DOCKER_SOCKET,fork,group=worker,mode=0775 UNIX-CLIENT:/var/run/docker.sock