Programmatically set users public ssh key

14 views
Skip to first unread message

Artur Szostak

unread,
Jun 20, 2018, 5:12:33 PM6/20/18
to Jenkins Users
Hi,

How does one programmatically set the "SSH Public Keys" field for a user in Jenkins? The REST API appears to be useless for this and the correct Java object to interact with is not obvious.

Kind regards.

Artur

DmitryB

unread,
Jun 21, 2018, 3:16:28 AM6/21/18
to Jenkins Users
def user = hudson.model.User.get('username')
def keysProperty = new org.jenkinsci.main.modules.cli.auth.ssh.UserPropertyImpl(keysContent)
user.addProperty(keysProperty)



четверг, 21 июня 2018 г., 1:12:33 UTC+4 пользователь Artur Szostak написал:
Reply all
Reply to author
Forward
0 new messages