Skip to content

Commit

Permalink
Merge pull request #756 from buildkite/isolate-docker-config
Browse files Browse the repository at this point in the history
always use a fresh docker config for each step
  • Loading branch information
chloeruka authored Oct 26, 2020
2 parents 83569d4 + 528cf6a commit 061e549
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packer/linux/conf/buildkite-agent/hooks/environment
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ set -eu -o pipefail
# shellcheck source=/dev/null
source ~/cfn-env

# a clean docker config for each job, for improved isolation
BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY=$(mktemp -d)
export BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY
export DOCKER_CONFIG="$BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY"

echo "~~~ :llama: Setting up elastic stack environment ($BUILDKITE_STACK_VERSION)"
cat ~/cfn-env

Expand Down
5 changes: 5 additions & 0 deletions packer/linux/conf/buildkite-agent/hooks/pre-exit
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

set -eu -o pipefail

# clean up our temporary docker config
if [[ -n "${BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY:-}" && -d "$BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY" ]]; then
rm -rf "$BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY"
fi

if [[ -n "${BUILDKITE_SECRETS_BUCKET:-}" && "${SECRETS_PLUGIN_ENABLED:-}" == "1" ]] ; then
export BUILDKITE_PLUGIN_S3_SECRETS_BUCKET="$BUILDKITE_SECRETS_BUCKET"

Expand Down
5 changes: 5 additions & 0 deletions packer/windows/conf/buildkite-agent/hooks/environment
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ set -eu -o pipefail
# shellcheck source=/dev/null
source ~/cfn-env

# a clean docker config for each job, for improved isolation
BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY=$(mktemp -d)
export BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY
export DOCKER_CONFIG="$BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY"

echo "~~~ :llama: Setting up elastic stack environment ($BUILDKITE_STACK_VERSION)"
cat ~/cfn-env

Expand Down
5 changes: 5 additions & 0 deletions packer/windows/conf/buildkite-agent/hooks/pre-exit
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

set -eu -o pipefail

# clean up our temporary docker config
if [[ -n "${BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY:-}" && -d "$BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY" ]]; then
rm -rf "$BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY"
fi

if [[ -n "${BUILDKITE_SECRETS_BUCKET:-}" && "${SECRETS_PLUGIN_ENABLED:-}" == "1" ]] ; then
export BUILDKITE_PLUGIN_S3_SECRETS_BUCKET="$BUILDKITE_SECRETS_BUCKET"

Expand Down

0 comments on commit 061e549

Please sign in to comment.