-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to download all jenkins jobs configurations
- Loading branch information
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from requests.auth import HTTPBasicAuth | ||
|
||
import os | ||
import requests | ||
import subprocess | ||
|
||
output = subprocess.check_output(['jenkins-jobs', '--conf', 'config.ini', 'list']) | ||
if not os.path.isdir('current-jobs'): | ||
os.makedirs('current-jobs') | ||
|
||
for jobname in output.splitlines(): | ||
job = jobname.strip() | ||
print('Downloading configuration for job {0}'.format(job)) | ||
result = requests.get( | ||
'https://jenkins.plone.org/job/{0}/config.xml'.format(job), | ||
auth=HTTPBasicAuth( | ||
os.environ['JENKINS_USER_ID'], | ||
os.environ['JENKINS_USER_TOKEN'], | ||
) | ||
) | ||
with open('current-jobs/{}'.format(job), 'w') as result_file: | ||
result_file.write(result.content) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,6 @@ pyasn1==0.4.3 | |
pycparser==2.18 | ||
pycrypto==2.6.1 | ||
pyparsing==2.2.0 | ||
requests==2.19.1 | ||
PyYAML==3.12 | ||
six==1.11.0 |