Last active
May 12, 2016 14:37
-
-
Save jsrois/fb57dd4f743306a93fbdfd984fb43c15 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
domain_name=example.com | |
date_info=$(date +%s) | |
output_file=add_users_$date_info.groovy | |
echo "// Automatically generated groovy script -- $date_info" > $output_file | |
while [[ $# > 0 ]] | |
do | |
echo "generating user/password for [$1]..." | |
pass=$(date +%s | sha256sum | base64 | head -c 32 ; echo) | |
user=$1 | |
email=$user@$domain_name | |
cat <<EOT >> $output_file | |
jenkins.model.Jenkins.instance.securityRealm.createAccount("$user", "$pass") | |
def user = hudson.model.User.get("$user"); | |
def userEmail = "$email"; | |
user.addProperty(new hudson.tasks.Mailer.UserProperty(userEmail)); | |
EOT | |
shift | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment