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

Add support for GoogleRobotPrivateKeyCredentials #861

Merged

Conversation

thaiphv
Copy link
Contributor

@thaiphv thaiphv commented Mar 28, 2018

Extends the credentials_list_json method in the puppet_helpers.groovy script to support com.google.jenkins.plugins.credentials.oauth.GoogleRobotPrivateKeyCredentials.

Copy link
Member

@ekohl ekohl left a 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.

@@ -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())
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

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.

@jhoblitt
Copy link
Member

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.

@thaiphv
Copy link
Contributor Author

thaiphv commented Mar 29, 2018

@jhoblitt, I hasn't updated it since the first commit. I think I need to update the credentials_update_json method as well.

@thaiphv
Copy link
Contributor Author

thaiphv commented Apr 4, 2018

I've also extended the ``credentials_update_json` method so that we could add credentials of this type.

@bastelfreak
Copy link
Member

Thanks for the work @thaiphv !

@bastelfreak bastelfreak merged commit ac2bdb2 into voxpupuli:master Apr 4, 2018
@bastelfreak bastelfreak added the enhancement New feature or request label Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants