Skip to content

Commit f7103ba

Browse files
author
Ed Rooth
committed
build: add back builder-run utility script
For executing & testing scripts via our build container for consistent builds.
1 parent 45cd261 commit f7103ba

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

builder-run

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash -e
2+
#
3+
# A utility script for executing arbitrary local scripts via docker.
4+
# This can be used for executing build/release scripts locally in our build container in the absence of Jenkins.
5+
#
6+
# USAGE:
7+
#
8+
# With env vars:
9+
# MYVAR=foo OTHERVAR=bar DOCKER_ENV=MYVAR,OTHERVAR ./builder-run ./my-script --my-script-arg1 --my-script-arg2
10+
#
11+
# Without env vars:
12+
# ./builder-run ./my-script --my-script-arg1 --my-script-arg2
13+
14+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
15+
16+
# forward whitelisted env variables to docker
17+
ENV_STR=""
18+
for VAR in ${DOCKER_ENV//,/ }; do
19+
ENV_STR="$ENV_STR -e $VAR=${!VAR}"
20+
done
21+
22+
PROJECT=$SCRIPT_DIR
23+
set -x
24+
docker run --user="${BUILDER_RUN_USER}" $ENV_STR --rm -v $PROJECT:/go/src/github.com/coreos/tectonic-installer -w /go/src/coreos/tectonic-installer $DOCKER_RUN_ARGS $BUILDER_IMAGE $@

0 commit comments

Comments
 (0)