Search in sources :

Example 1 with NonexistentServerUrlDockerCredentialHelperException

use of com.google.cloud.tools.jib.registry.credentials.NonexistentServerUrlDockerCredentialHelperException in project jib by google.

the class RetrieveRegistryCredentialsStep method retrieveFromCredentialHelper.

/**
 * Attempts to retrieve authorization for the registry using {@code
 * docker-credential-[credentialHelperSuffix]}.
 */
@VisibleForTesting
@Nullable
Authorization retrieveFromCredentialHelper(String credentialHelperSuffix) throws NonexistentDockerCredentialHelperException, IOException {
    buildConfiguration.getBuildLogger().info("Checking credentials from docker-credential-" + credentialHelperSuffix);
    try {
        Authorization authorization = dockerCredentialHelperFactory.withCredentialHelperSuffix(credentialHelperSuffix).retrieve();
        logGotCredentialsFrom("docker-credential-" + credentialHelperSuffix);
        return authorization;
    } catch (NonexistentServerUrlDockerCredentialHelperException ex) {
        buildConfiguration.getBuildLogger().info("No credentials for " + registry + " in docker-credential-" + credentialHelperSuffix);
        return null;
    }
}
Also used : Authorization(com.google.cloud.tools.jib.http.Authorization) NonexistentServerUrlDockerCredentialHelperException(com.google.cloud.tools.jib.registry.credentials.NonexistentServerUrlDockerCredentialHelperException) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Nullable(javax.annotation.Nullable)

Aggregations

Authorization (com.google.cloud.tools.jib.http.Authorization)1 NonexistentServerUrlDockerCredentialHelperException (com.google.cloud.tools.jib.registry.credentials.NonexistentServerUrlDockerCredentialHelperException)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Nullable (javax.annotation.Nullable)1