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
Add support for GoogleRobotPrivateKeyCredentials #861
Add support for GoogleRobotPrivateKeyCredentials #861
Conversation
…botPrivateKeyCredentials
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know the exact plugin but the syntax looks correct.
files/puppet_helper.groovy
Outdated
@@ -546,6 +546,10 @@ class Actions { | |||
throw new UnsupportedCredentialsClass("unsupported " + keyStoreSource) | |||
} | |||
break | |||
case 'com.google.jenkins.plugins.credentials.oauth.GoogleRobotPrivateKeyCredentials': | |||
info['account_id'] = cred.getServiceAccountConfig().getAccountId() | |||
info['private_key'] = new String(cred.getServiceAccountConfig().getPrivateKey().getEncoded()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Others use IOUtils.toString
. As someone not that familiar with groovy, is there a difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I'm not sure either but I'm happy to make that change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe some more experienced Jenkins/groovy user could comment on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks OK as-is. A literal string is being used to avoid requiring all of those classes to be loaded.
I restarted the travis bulid last night after the first failure but it looks like the last build was only 4 hours ago. Was the PR updated with a fix? I want to make sure we're not seeing unstable test behavior. |
@jhoblitt, I hasn't updated it since the first commit. I think I need to update the |
I've also extended the ``credentials_update_json` method so that we could add credentials of this type. |
Thanks for the work @thaiphv ! |
Extends the
credentials_list_json
method in thepuppet_helpers.groovy
script to supportcom.google.jenkins.plugins.credentials.oauth.GoogleRobotPrivateKeyCredentials
.