Created
September 24, 2019 03:37
-
-
Save 9to6/5afa40c0029d51022ad14a17318e011c to your computer and use it in GitHub Desktop.
Bash script to restore jenkins jobs
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 | |
JENKINS_URL=$1 | |
PWD=$(pwd) | |
ls ./jobs/ | | |
while read line | |
do | |
filepath="'$PWD/jobs/$line'" | |
filename="${line%%.*}" | |
echo "$filepath" | |
echo "$filename" | |
echo "cat $filepath | java -jar jenkins-cli.jar -s $JENKINS_URL create-job '$filename'" | |
bash -c "cat $filepath | java -jar jenkins-cli.jar -s $JENKINS_URL create-job '$filename'" & | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment