public RegistryImage addCredentialRetriever(CredentialRetriever credentialRetriever) {
    credentialRetrievers.add(credentialRetriever);
    return this;
  }
Adds {@link CredentialRetriever} to fetch push/pull credentials for the image. Credential
retrievers are attempted in the order in which they are specified until credentials are
successfully retrieved.

<p>Example usage:

<pre>{@code
.addCredentialRetriever(() -> {
  if (!Files.exists("secret.txt") {
    return Optional.empty();
  }
  try {
    String password = fetchPasswordFromFile("secret.txt");
    return Credential.basic("myaccount", password);

  } catch (IOException ex) {
    throw new CredentialRetrievalException("Failed to load password", ex);
  }
})
}</pre>

@param credentialRetriever the {@link CredentialRetriever} to add
@return this
jib-core/src/main/java/com/google/cloud/tools/jib/api/RegistryImage.java