Skip to content

Commit

Permalink
fix: Support global credsStore in docker config (#602)
Browse files Browse the repository at this point in the history
  • Loading branch information
msiebuhr authored and alexeagle committed Jun 7, 2024
1 parent 681abb0 commit 3be6471
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions e2e/pull/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ EOF
assert_success
}

@test "global credstore" {
cat > "$DOCKER_CONFIG/config.json" <<EOF
{
"credsStore": "oci"
}
EOF
update_assert '{"Authorization": ["Basic dGVzdGluZzpvY2k="]}'
run bazel build @empty_image//... $BAZEL_FLAGS
assert_success
}

@test "credstore misbehaves" {
cat > "$DOCKER_CONFIG/config.json" <<EOF
{
Expand Down
4 changes: 4 additions & 0 deletions oci/private/authn.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ def _get_auth(rctx, state, registry):
"password": auth_val["password"],
}

# look for generic credentials-store all lookups for host-specific auth fails
if "credsStore" in config and len(pattern.keys()) == 0:
pattern = _fetch_auth_via_creds_helper(rctx, registry, config["credsStore"])

# cache the result so that we don't do this again unnecessarily.
state["auth"][registry] = pattern

Expand Down

0 comments on commit 3be6471

Please sign in to comment.