Skip to content

Instantly share code, notes, and snippets.

@sj26
Forked from bauidch/jenkins-createUser.groovy
Last active June 16, 2025 01:57
Show Gist options
  • Save sj26/8819aac024ba474666516228a7995868 to your computer and use it in GitHub Desktop.
Save sj26/8819aac024ba474666516228a7995868 to your computer and use it in GitHub Desktop.
Create a Jenkins user via Groovy
import jenkins.model.*
import hudson.tasks.Mailer
def user = Jenkins.instance.securityRealm.createAccount("username", "Amin12345#")
user.addProperty(new Mailer.UserProperty("[email protected]"));
user.setFullName("Full Name")
user.setDescription("Account via groovy generated")
user.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment