Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only use accessKey and secretKey if they are not blank - fix NullPointerException: Access key ID cannot be blank #265

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

samholton
Copy link

@samholton samholton commented Jan 9, 2025

Only use the accessKey and secretKey if they are provided. Before it was only checking if role was blank. This allows the creation of a secret that uses the instance profile. This is useful if you want to parameterize the secret being passed in - one for the instance profile and a different one for a different account. This functionality existed before in earlier versions of the plugin, this is restoring that functionality.

Fixes #264

Testing done

  • Installed latest version 240.v6d844a_6f5480
  • Created two credentials:
    • one named withKey that had a valid access and secret access key (from a second account) and blank role
    • one named withBlanks that had a blank access key, blank secret access key, and blank role
  • Ran a job that called aws s3 ls wrapped in withCredentials with both credentials
  • The one using withKey worked and listed buckets in the second account
  • The one using withBlanks failed with NullPointerException
  • Installed the plugin version from the PR and reran the job
  • This time both blocks printed out buckets, one from the second account and one from the account the Jenkins node was running within

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@samholton samholton force-pushed the feature/allow-blank-creds-for-instance-profile branch from 1fc2394 to 1bae0e6 Compare January 9, 2025 18:44
@samholton samholton marked this pull request as ready for review January 9, 2025 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use instance profile of builder (blank access key, blank secret access and blank role)
1 participant