Skip to content

Commit

Permalink
Fix "NullPointerException: Access key ID cannot be blank"
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Dec 18, 2024
1 parent 6681a0e commit 4d1bdf7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,17 @@ public boolean requiresToken() {

@Override
public AwsCredentials resolveCredentials() {
AwsCredentials initialCredentials = AwsBasicCredentials.create(accessKey, secretKey.getPlainText());

if (StringUtils.isBlank(iamRoleArn)) {
return initialCredentials;
return AwsBasicCredentials.create(accessKey, secretKey.getPlainText());
} else {
AwsCredentialsProvider baseProvider;
// Handle the case of delegation to instance profile
if (StringUtils.isBlank(accessKey) && StringUtils.isBlank(secretKey.getPlainText())) {
baseProvider = null;
} else {
baseProvider = StaticCredentialsProvider.create(initialCredentials);
baseProvider = StaticCredentialsProvider.create(
AwsBasicCredentials.create(accessKey, secretKey.getPlainText()));

Check warning on line 180 in src/main/java/com/cloudbees/jenkins/plugins/awscredentials/AWSCredentialsImpl.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 172-180 are not covered by tests
}

StsClient client = buildStsClient(baseProvider);
Expand Down

0 comments on commit 4d1bdf7

Please sign in to comment.