Creating user in Jenkins via API -


i wondering if can create new user in jenkins using api. can create jobs api docs jenkins don't have related user creation.

actually, have create new user followed creating new job user, of using api.

shubham,

you're right, there no explicit cli command adding user. use groovy script (using cli execution).

the details depend on how jenkins configured. example, if jenkins uses own user database, add new user following cli call:

echo 'jenkins.model.jenkins.instance.securityrealm.createaccount("user1", "password123")' | java -jar jenkins-cli.jar -s http://localhost/ groovy = 

this shell command create new user login "user1" , password "password123". here echo feeds line of groovy code jenkins cli (note = means cli should receive code stdin).

also groovy script allows manage user permissions, however, exact code depends on authorization strategy used. use this sample script start.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -