Skip to content

Propagate worker proxy settings when building docker images - #141

Merged
vito merged 2 commits into
concourse:masterfrom
boazy:propgate_proxy_settings
Dec 19, 2017
Merged

vito merged 2 commits into
concourse:masterfrom
boazy:propgate_proxy_settings

Conversation

@boazy

@boazy boazy commented Aug 31, 2017

Copy link
Copy Markdown
Contributor

Solves issue #131

Concourse supports passing the http_proxy family of environment variables from the workers to the containers running on them: concourse/concourse#319

These environment variables do not propagate, however, when building a docker image with docker-image-resource which leaves a pretty large blind spot. This PR fixes that by adding all present proxy setting environment variables as build arguments.

You may see this warning during docker image build if you have proxy environment variable enabled:
[Warning] One or more build-args [http_proxy https_proxy] were not consumed

This is because Docker fails to detect that these arguments are being used (even when they're used). It's thankfully harmless.

@pivotal-issuemaster

Copy link
Copy Markdown

@boazy Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-issuemaster

Copy link
Copy Markdown

@boazy Thank you for signing the Contributor License Agreement!

Comment thread assets/out Outdated
done

if [ -n "$build_args" ]; then
expanded_build_args=$(echo $build_args|jq -r 'with_entries(.key |= "--build-arg " + . )|with_entries(.key = .key + "=" +.value)|keys|join(" ")')

This comment was marked as spam.

This comment was marked as spam.

@boazy
boazy force-pushed the propgate_proxy_settings branch 2 times, most recently from c328139 to 52c3620 Compare September 15, 2017 10:14
@boazy

boazy commented Sep 29, 2017

Copy link
Copy Markdown
Contributor Author

@jtarchie i fixed the pull request, can you review again?

@vito

vito commented Nov 6, 2017

Copy link
Copy Markdown
Contributor

Could you add a test for this? There should be some decent tests to reference under tests/ now. They're run as part of docker build ..

@vito

vito commented Dec 18, 2017 •

Copy link
Copy Markdown
Contributor

Ugh, I have no idea what's up with GitHub's conflict resolution thing (that's what made the last commit). It never works. It makes a commit but then the conflict is still not resolved.

...In any case, this is now pretty broken via conflicts with #159 and is still in need of tests. I tried to resolve the conflicts and switch it to the new buid_arg flow, but that didn't work. Do you have time to update this, @boazy? Thanks!

(edit: managed to resolve the conflicts on a second try. 🤷‍♂️)

@boazy
boazy force-pushed the propgate_proxy_settings branch from c0831f5 to ffbb60b Compare December 19, 2017 02:30
@boazy

boazy commented Dec 19, 2017

Copy link
Copy Markdown
Contributor Author

@vito Thanks for resolving the conflict and sorry for neglecting the unit tests.
I didn't know how to merge back everything nicely into my branch, so I've just rebased everything again against the current master (with your fixes). I hope that's okay.
I've also added unit tests now.

@vito vito removed the needs-test label Dec 19, 2017
@vito

vito commented Dec 19, 2017

Copy link
Copy Markdown
Contributor

Sweet, thanks for following up! Tests look good, I'll go ahead and merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants