Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable experimental docker cli in the environment hook #911

Merged
merged 2 commits into from
Sep 8, 2021

Conversation

keithduncan
Copy link
Contributor

Save the value of the EnableDockerExperimental parameter in ~/cfn-env for the environment hook to use. In the environment hook, set $DOCKER_CONFIG/config.json .experimental="enabled".

Fixes #798

@@ -10,6 +10,11 @@ BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY=$(mktemp -d)
export BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY
export DOCKER_CONFIG="$BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY"

if [ "${BUILDKITE_DOCKER_EXPERIMENTAL:-false}" = "true" ]
then
cat <<< "$(jq '.experimental="enabled"' "${DOCKER_CONFIG}/config.json")" > "${DOCKER_CONFIG}/config.json"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern is used elsewhere in the codebase without issue.

Knowing about the truncation issue I was curious whether this would work when writing it. I’ve confirmed that the multiple edits in the above link are preserved, that the former edit isn’t truncated to zero and overwritten by the latter edit.

I’d like to confirm why this is working before moving ahead with a #shellcheck disable=SC2094

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern seems to come from this long standing issue https://github.com/stedolan/jq/issues/105#issuecomment-437363987 in jq asking for edit in place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reckon this must be fine because it is redirects in a single command which bash processes in order rather than redirects in separate commands in a pipeline which are processed in parallel and race.

@keithduncan keithduncan merged commit 2ba5604 into master Sep 8, 2021
@keithduncan keithduncan deleted the keithduncan/enable-docker-cli-experimental branch September 8, 2021 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Have to add DOCKER_CLI_EXPERIMENTAL to get docker manifests pushed
1 participant