Skip to content

Commit 061e549

Browse files
authored
Merge pull request #756 from buildkite/isolate-docker-config
always use a fresh docker config for each step
2 parents 83569d4 + 528cf6a commit 061e549

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

packer/linux/conf/buildkite-agent/hooks/environment

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ set -eu -o pipefail
44
# shellcheck source=/dev/null
55
source ~/cfn-env
66

7+
# a clean docker config for each job, for improved isolation
8+
BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY=$(mktemp -d)
9+
export BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY
10+
export DOCKER_CONFIG="$BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY"
11+
712
echo "~~~ :llama: Setting up elastic stack environment ($BUILDKITE_STACK_VERSION)"
813
cat ~/cfn-env
914

packer/linux/conf/buildkite-agent/hooks/pre-exit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
set -eu -o pipefail
44

5+
# clean up our temporary docker config
6+
if [[ -n "${BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY:-}" && -d "$BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY" ]]; then
7+
rm -rf "$BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY"
8+
fi
9+
510
if [[ -n "${BUILDKITE_SECRETS_BUCKET:-}" && "${SECRETS_PLUGIN_ENABLED:-}" == "1" ]] ; then
611
export BUILDKITE_PLUGIN_S3_SECRETS_BUCKET="$BUILDKITE_SECRETS_BUCKET"
712

packer/windows/conf/buildkite-agent/hooks/environment

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ set -eu -o pipefail
44
# shellcheck source=/dev/null
55
source ~/cfn-env
66

7+
# a clean docker config for each job, for improved isolation
8+
BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY=$(mktemp -d)
9+
export BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY
10+
export DOCKER_CONFIG="$BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY"
11+
712
echo "~~~ :llama: Setting up elastic stack environment ($BUILDKITE_STACK_VERSION)"
813
cat ~/cfn-env
914

packer/windows/conf/buildkite-agent/hooks/pre-exit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
set -eu -o pipefail
44

5+
# clean up our temporary docker config
6+
if [[ -n "${BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY:-}" && -d "$BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY" ]]; then
7+
rm -rf "$BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY"
8+
fi
9+
510
if [[ -n "${BUILDKITE_SECRETS_BUCKET:-}" && "${SECRETS_PLUGIN_ENABLED:-}" == "1" ]] ; then
611
export BUILDKITE_PLUGIN_S3_SECRETS_BUCKET="$BUILDKITE_SECRETS_BUCKET"
712

0 commit comments

Comments
 (0)