Skip to content

Commit

Permalink
Add script to download all jenkins jobs configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
gforcada committed Jun 17, 2018
1 parent aeffbfa commit 80aac1c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions jobs/download_jobs.py
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)
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 80aac1c

Please sign in to comment.