Commit Graph

11 Commits

Author SHA1 Message Date
Sascha Grunert a6b63a5c47 Switch to ginkgo/v2
Update ginkgo to the next major version which has been released a while
ago.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-03-30 10:03:17 +02:00
Valentin Rothberg c9914e52de pkg/auth: re-allow http{s} prefixes
Until version v3.2, `podman login` trimmed http{s} prefixes along with
everything else but the host[:port] parts.  Starting with v3.3, `login`
supports storing credentials for namespaces and dropped support for
trimming prefixes due to ambiguities in registry URLs.

The aforementioned changes caused a regression (see BZ below) as some
users depend on the prefix trimming.  Fix that regression by enabling
the http{s} prefix trimming.  If present, everything but the host[:port]
parts will be stripped as well.

 * `login quay.io/repo` uses `quay.io/repo`
 * `login https://quay.io/repo` uses `quay.io`

Fixes: bugzilla.redhat.com/show_bug.cgi?id=2062072
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-17 10:11:26 +01:00
Miloslav Trmač 620331697f Stop returning a reference.Named from parseRegistryArgument
... and instead primarily use the string key.  This allows
using a docker.io/vendor namespace.

Also rename parseRegistryArgument to parseCredentialsKey,
the argument is not just a registry.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-02 15:48:44 +01:00
Miloslav Trmač 309a638347 Automate testing of ref in TestParseRegistryArgument
Make the test fully table-driven now.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-02 15:42:56 +01:00
Miloslav Trmač f1d745c0e2 Automate testing of registry in TestParseRegistryArgument
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-02 15:42:56 +01:00
Miloslav Trmač fd7d732a18 Automate testing of key in TestParseRegistryArgument
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-02 15:42:56 +01:00
Miloslav Trmač cdd07f2839 Tighten tests for the return value of ParseRegistryArgument
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-02 15:42:56 +01:00
Sascha Grunert de3880b2a9 Add a test for docker.io/library/user
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-02 15:42:56 +01:00
Sascha Grunert 9f3d6b6bdd Add support for path based registry in login/logout
We now add a new configuration option to opt-in for path based registry
authentication in containers-auth.json. This affects login and logout,
which means if the option is enabled we can now use
`my-registry.local/path/to/image` to save or remove the credentials from
the auth.json.

If the option is enabled, then we enforce a stricter validation of the
input. For example it is not allowed input `http[s]://` prefixed keys.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2021-07-23 09:41:19 +02:00
Morten Linderud 783a6c1551 pkg/auth_test: Fixup tests to assume DOCKER_CONFIG is a directory
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-04-07 16:19:39 +02:00
Daniel J Walsh 6172fd7db6 Add support for DOCKER_CONFIG
DOCKER_CONFIG environment variable is sometimes used to point
to the config.json.  The container engines use REGISTRY_AUTH_FILE
for similar functionality.  This PR causes programs that use
GetAuthFile to use DOCKER_CONFIG if it set and REGISTRY_AUTH_FILE
is not.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-21 17:07:24 -05:00