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

bake: handle git auth token when parsing remote definition #288

Merged
merged 1 commit into from Apr 12, 2024

Conversation

crazy-max
Copy link
Member

@crazy-max crazy-max commented Mar 27, 2024

We got the following output when trying to build from a remote bake definition on a private repo: https://github.com/docker/test-docker-action/tree/remote-private

$ docker buildx bake https://github.com/docker/test-docker-action.git#remote-private
#0 building with "default" instance using docker driver

#1 [internal] load git source https://github.com/docker/test-docker-action.git#remote-private
#1 0.225 fatal: could not read Username for 'https://github.com': terminal prompts disabled
#1 ERROR: failed to fetch remote https://github.com/docker/test-docker-action.git: git error: exit status 128
stderr:
fatal: could not read Username for 'https://github.com': terminal prompts disabled

------
 > [internal] load git source https://github.com/docker/test-docker-action.git#remote-private:
0.225 fatal: could not read Username for 'https://github.com': terminal prompts disabled
------
ERROR: couldn't find a bake definition

Using a GIT_AUTH_TOKEN secret doesn't seem to work:

/usr/bin/docker buildx bake https://github.com/docker/test-docker-action.git#remote-private --set *.secrets=id=GIT_AUTH_TOKEN,src=/home/runner/work/_temp/docker-actions-toolkit-Rrz5jT/tmp-1910-aMBJe65r7Kf4 --print default
#0 building with "default" instance using docker driver
#1 [internal] load git source https://github.com/docker/test-docker-action.git#remote-private
#1 0.039 Initialized empty Git repository in /var/lib/docker/overlay2/l763ozu3v99vupy2gmketmi8t/diff/
#1 0.279 fatal: could not read Username for 'https://github.com/': terminal prompts disabled

Which makes sense as loading remote bake definitions is done by a dedicated solve request, not during build: https://github.com/docker/buildx/blob/8abef5908705e49f7ba88ef8c957e1127b597a2a/bake/remote.go#L62

docker/buildx#2363 implements git auth token support for remote bake definitions using the BUILDX_BAKE_GIT_AUTH_TOKEN env var.

@crazy-max

This comment was marked as outdated.

@crazy-max crazy-max force-pushed the bake-auth-token branch 5 times, most recently from 704f0f3 to 76b6d66 Compare April 5, 2024 11:56
@crazy-max crazy-max marked this pull request as ready for review April 5, 2024 12:01
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max crazy-max merged commit 0200700 into docker:main Apr 12, 2024
28 checks passed
@crazy-max crazy-max deleted the bake-auth-token branch April 12, 2024 08:57
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.

None yet

1 participant