Skip to content

Commit

Permalink
Add log messages while setting credentials for ecr.
Browse files Browse the repository at this point in the history
  • Loading branch information
varshavaradarajan committed Mar 30, 2019
1 parent 57d8b12 commit fb7edfc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
import com.amazonaws.services.ecr.AmazonECRClientBuilder;
import com.amazonaws.services.ecr.model.GetAuthorizationTokenRequest;
import com.amazonaws.services.ecr.model.GetAuthorizationTokenResult;
import com.thoughtworks.go.plugin.api.logging.Logger;

import java.util.Base64;

import static org.apache.commons.lang.StringUtils.isNotBlank;

public class AWSTokenRequestGenerator {
public static final Logger LOG = Logger.getLoggerFor(AWSTokenRequestGenerator.class);
private AwsSyncClientBuilder<AmazonECRClientBuilder, AmazonECR> builder;

AWSTokenRequestGenerator() {
Expand All @@ -58,9 +60,11 @@ void setCredentialsProvider(ArtifactStoreConfig artifactStoreConfig) {
if (isNotBlank(artifactStoreConfig.getAwsAccessKeyId()) || isNotBlank(artifactStoreConfig.getAwsSecretAccessKey())) {
AWSStaticCredentialsProvider awsStaticCredentialsProvider = new AWSStaticCredentialsProvider(new BasicAWSCredentials(artifactStoreConfig.getAwsAccessKeyId(), artifactStoreConfig.getAwsSecretAccessKey()));
builder.setCredentials(awsStaticCredentialsProvider);
LOG.debug("Using the AWS keys configured in the specified artifact store.");
}
else {
builder.setCredentials(new DefaultAWSCredentialsProviderChain());
LOG.debug("Setting the default aws credentials chain provider. This happens if the specified artifact store does not have aws keys configured. The default chain checks for environment variables, system properties, credentials profile, instance profile.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package cd.go.artifact.docker.registry;

import cd.go.artifact.docker.registry.model.ArtifactStoreConfig;
import com.amazonaws.services.ecr.AmazonECRClient;
import com.spotify.docker.client.DefaultDockerClient;
import com.spotify.docker.client.DockerClient;
import com.spotify.docker.client.exceptions.DockerCertificateException;
Expand Down

0 comments on commit fb7edfc

Please sign in to comment.