Skip to content

Commit

Permalink
update cuelabs.dev/oci/ociregistry to pull in fix for #2934
Browse files Browse the repository at this point in the history
Some tools in the Docker space add a default credential helper
to the configuration file, even when said helper may not be installed.
The docker CLI ignores errors from the default credential helper,
and for consistency and to avoid unnecessary errors, ociauth no longer
considers a default credential helper which is not installed as fatal.

We add an integration test in cmd/cue even though ociauth has unit tests
so that we can be extra sure that cmd/cue does not regress.

Fixes #2934.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: Ib3f3278ba966139fd7e8bbe45bcd3f4ab0aea754
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1183396
TryBot-Result: CUEcueckoo <cueckoo@gmail.com>
Reviewed-by: Paul Jolly <paul@myitcv.io>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
  • Loading branch information
mvdan committed Mar 14, 2024
1 parent 24f93c9 commit 0e33883
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
20 changes: 19 additions & 1 deletion cmd/cue/cmd/testdata/script/registry_auth.txtar
Expand Up @@ -6,11 +6,19 @@ exec cue export .
cmp stdout expect-stdout

# Sanity-check that we get an error when using the wrong password.
env CUE_CACHE_DIR=$WORK/.tmp/different-cache
rm $CUE_CACHE_DIR
env-fill dockerconfig/badpassword.json
cp dockerconfig/badpassword.json dockerconfig/config.json
! exec cue export .
stderr 'import failed: cannot find package "example.com/e": cannot fetch example.com/e@v0.0.1: module example.com/e@v0.0.1: error response: 401 Unauthorized; body: "invalid credentials'

# Sanity-check that a configured default helper which is not installed
# is not treated as a fatal error. See https://cuelang.org/issue/2934.
rm $CUE_CACHE_DIR
env-fill dockerconfig/missing_default_helper.json
cp dockerconfig/missing_default_helper.json dockerconfig/config.json
exec cue export .
cmp stdout expect-stdout
-- dockerconfig/config.json --
{
"auths": {
Expand All @@ -29,6 +37,16 @@ stderr 'import failed: cannot find package "example.com/e": cannot fetch example
}
}
}
-- dockerconfig/missing_default_helper.json --
{
"credsStore": "definitely-not-found-executable",
"auths": {
"${DEBUG_REGISTRY_HOST}": {
"username": "someone",
"password": "something"
}
}
}
-- expect-stdout --
"ok"
-- main.cue --
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -3,7 +3,7 @@ module cuelang.org/go
go 1.21

require (
cuelabs.dev/go/oci/ociregistry v0.0.0-20240311165848-2bd90cc6df5e
cuelabs.dev/go/oci/ociregistry v0.0.0-20240314152124-224736b49f2e
github.com/cockroachdb/apd/v3 v3.2.1
github.com/emicklei/proto v1.10.0
github.com/go-quicktest/qt v1.101.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
@@ -1,5 +1,5 @@
cuelabs.dev/go/oci/ociregistry v0.0.0-20240311165848-2bd90cc6df5e h1:J+NGQOAyDdyCrkPujaypjk9dk1PBx28jZ9mK1jo1q64=
cuelabs.dev/go/oci/ociregistry v0.0.0-20240311165848-2bd90cc6df5e/go.mod h1:ApHceQLLwcOkCEXM1+DyCXTHEJhNGDpJ2kmV6axsx24=
cuelabs.dev/go/oci/ociregistry v0.0.0-20240314152124-224736b49f2e h1:GwCVItFUPxwdsEYnlUcJ6PJxOjTeFFCKOh6QWg4oAzQ=
cuelabs.dev/go/oci/ociregistry v0.0.0-20240314152124-224736b49f2e/go.mod h1:ApHceQLLwcOkCEXM1+DyCXTHEJhNGDpJ2kmV6axsx24=
github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg=
github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
Expand Down

0 comments on commit 0e33883

Please sign in to comment.