mirror of
https://github.com/openshift/installer.git
synced 2026-02-05 15:47:14 +01:00
25 lines
838 B
Bash
Executable File
25 lines
838 B
Bash
Executable File
#!/bin/bash -e
|
|
#
|
|
# A utility script for executing arbitrary local scripts via docker.
|
|
# This can be used for executing build/release scripts locally in our build container in the absence of Jenkins.
|
|
#
|
|
# USAGE:
|
|
#
|
|
# With env vars:
|
|
# MYVAR=foo OTHERVAR=bar DOCKER_ENV=MYVAR,OTHERVAR ./builder-run ./my-script --my-script-arg1 --my-script-arg2
|
|
#
|
|
# Without env vars:
|
|
# ./builder-run ./my-script --my-script-arg1 --my-script-arg2
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
# forward whitelisted env variables to docker
|
|
ENV_STR=""
|
|
for VAR in ${DOCKER_ENV//,/ }; do
|
|
ENV_STR="$ENV_STR -e $VAR=${!VAR}"
|
|
done
|
|
|
|
PROJECT=$SCRIPT_DIR
|
|
set -x
|
|
docker run --user="${BUILDER_RUN_USER}" $ENV_STR --rm -v $PROJECT:/go/src/github.com/openshift/installer -w /go/src/github.com/openshift/installer $DOCKER_RUN_ARGS $BUILDER_IMAGE $@
|