Created
February 8, 2021 23:26
-
-
Save Klice/7282c73b3b6f154ff30930f26240fa41 to your computer and use it in GitHub Desktop.
Goorvy script to set SSH key for jenkins admin user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hudson.model.User | |
import org.jenkinsci.main.modules.cli.auth.ssh.UserPropertyImpl | |
User admin = User.getById("admin", false); | |
UserPropertyImpl adminUserSSHKey = new UserPropertyImpl("some_key_here") | |
admin.addProperty(adminUserSSHKey); | |
admin.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment