From f45551cbf0e6cdff0d488a92c16b6d6b09faae22 Mon Sep 17 00:00:00 2001 From: Fedor Korotkov Date: Mon, 21 Aug 2023 15:44:35 -0400 Subject: [PATCH] Support Docker's `credsStore` (#591) This way for #581 we don't need to specify a fully quialified URL and can simply use the following `~/.docker/config.json`: ```json { "credsStore": "ecr-login" } ``` Related to https://github.com/docker/cli/issues/2928 --- .../tart/Credentials/DockerConfigCredentialsProvider.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/tart/Credentials/DockerConfigCredentialsProvider.swift b/Sources/tart/Credentials/DockerConfigCredentialsProvider.swift index 1e46d03..4c9a4fa 100644 --- a/Sources/tart/Credentials/DockerConfigCredentialsProvider.swift +++ b/Sources/tart/Credentials/DockerConfigCredentialsProvider.swift @@ -15,6 +15,10 @@ class DockerConfigCredentialsProvider: CredentialsProvider { return try executeHelper(binaryName: "docker-credential-\(helperProgram)", host: host) } + if let defaultCredsStore = config.credsStore { + return try executeHelper(binaryName: "docker-credential-\(defaultCredsStore)", host: host) + } + return nil } @@ -59,6 +63,7 @@ class DockerConfigCredentialsProvider: CredentialsProvider { struct DockerConfig: Codable { var auths: Dictionary? = Dictionary() var credHelpers: Dictionary? = Dictionary() + var credsStore: String? = nil } struct DockerAuthConfig: Codable {