Skip to content

Commit

Permalink
Check if job is buildable
Browse files Browse the repository at this point in the history
  • Loading branch information
jdewinne committed Nov 14, 2017
1 parent 1a36a6f commit d523937
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/resources/jenkins/FolderTrigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ def get_jobs(folder_name):
response = request.get('job/' + folder_name + '/api/json?depth=2', contentType='application/json')
if not response.isSuccessful():
raise Exception("Failed to check for folder. Server return [%s], with content [%s]" % (response.status, response.response))
for job in json.loads(response.response)["jobs"]:
if "Folder" in job["_class"]:
jenkins_cis.extend(get_jobs(folder_name + "/job/" + job["name"]))
else:
jenkins_cis.append(job)
response_json = json.loads(response.response)
if "jobs" in response_json:
for job in response_json["jobs"]:
if "buildable" not in job or not job["buildable"]:
jenkins_cis.extend(get_jobs(folder_name + "/job/" + job["name"]))
elif job["buildable"]:
jenkins_cis.append(job)
return jenkins_cis

def convert_dict_to_sorted_string(dict_jobs):
Expand Down

0 comments on commit d523937

Please sign in to comment.