forked from GoogleCloudPlatform/python-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild_ok.yaml_golden.sh
More file actions
executable file
·31 lines (23 loc) · 1.38 KB
/
cloudbuild_ok.yaml_golden.sh
File metadata and controls
executable file
·31 lines (23 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# This is a generated file. Do not edit.
set -euo pipefail
SOURCE_DIR=.
# Setup staging directory
HOST_WORKSPACE=$(mktemp -d -t local_cloudbuild_XXXXXXXXXX)
function cleanup {
if [ "${HOST_WORKSPACE}" != '/' -a -d "${HOST_WORKSPACE}" ]; then
# Expect a single error message about /workspace busy
docker run --volume /var/run/docker.sock:/var/run/docker.sock --volume /root/.docker:/root/.docker --volume ${HOST_WORKSPACE}:/workspace --workdir /workspace gcr.io/google-appengine/debian8 rm -rf /workspace 2>/dev/null || true
# Do not expect error messages here. Display but ignore.
rmdir "${HOST_WORKSPACE}" || true
fi
}
trap cleanup EXIT
# Copy source to staging directory
echo "Copying source to staging directory ${HOST_WORKSPACE}"
rsync -avzq --exclude=.git "${SOURCE_DIR}" "${HOST_WORKSPACE}"
# Build commands
docker run --volume /var/run/docker.sock:/var/run/docker.sock --volume /root/.docker:/root/.docker --volume ${HOST_WORKSPACE}:/workspace --workdir /workspace --env 'MESSAGE=Hello World!' debian /bin/sh -c 'printenv MESSAGE'
docker run --volume /var/run/docker.sock:/var/run/docker.sock --volume /root/.docker:/root/.docker --volume ${HOST_WORKSPACE}:/workspace --workdir /workspace --env 'MESSAGE=Goodbye\n And Farewell!' --env UNUSED=unused debian /bin/sh -c 'printenv MESSAGE'
# End of build commands
echo "Build completed successfully"