Posted by: terryhowe | September 24, 2016

Jenkins Groovy Set User Password

When you want to automate Jenkins deploys, groovy is a great way to go because you don’t have to parse xml files.  I was having trouble finding out how to set a user password in Jenkins without parsing xml.  This works:

import hudson.security.HudsonPrivateSecurityRealm.Details;
def user = hudson.model.User.current();
user.addProperty(Details.fromPlainPassword('s3cRe7'))
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: