File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,28 @@ if [[ "$(plugin_read_config USE_ALIASES "false")" == "true" ]] ; then
131131 run_params+=(--use-aliases)
132132fi
133133
134+ # Optionally handle the mount-buildkite-agent option
135+ if [[ " $( plugin_read_config MOUNT_BUILDKITE_AGENT " false" ) " == " true" ]]; then
136+ if [[ -z " ${BUILDKITE_AGENT_BINARY_PATH:- } " ]] ; then
137+ if ! command -v buildkite-agent > /dev/null 2>&1 ; then
138+ echo -n " +++ 🚨 Failed to find buildkite-agent in PATH to mount into container, "
139+ echo " you can disable this behaviour with 'mount-buildkite-agent:false'"
140+ else
141+ BUILDKITE_AGENT_BINARY_PATH=$( command -v buildkite-agent)
142+ fi
143+ fi
144+ fi
145+
146+ # Mount buildkite-agent if we have a path for it
147+ if [[ -n " ${BUILDKITE_AGENT_BINARY_PATH:- } " ]] ; then
148+ run_params+=(
149+ " --env" " BUILDKITE_JOB_ID"
150+ " --env" " BUILDKITE_BUILD_ID"
151+ " --env" " BUILDKITE_AGENT_ACCESS_TOKEN"
152+ " --volume" " $BUILDKITE_AGENT_BINARY_PATH :/usr/bin/buildkite-agent"
153+ )
154+ fi
155+
134156run_params+=(" $run_service " )
135157
136158if [[ " ${BUILDKITE_PLUGIN_DOCKER_COMPOSE_REQUIRE_PREBUILD:- } " =~ ^(true| on| 1)$ ]] && [[ ! -f " $override_file " ]] ; then
Original file line number Diff line number Diff line change @@ -66,6 +66,8 @@ configuration:
6666 type : boolean
6767 workdir :
6868 type : string
69+ mount-buildkite-agent :
70+ type : boolean
6971 oneOf :
7072 - required :
7173 - run
@@ -92,3 +94,4 @@ configuration:
9294 tty : [ run ]
9395 workdir : [ run ]
9496 user : [ run ]
97+ mount-buildkite-agent : [ run ]
You can’t perform that action at this time.
0 commit comments