Commit dfea2ed7 authored by Jan Kiene's avatar Jan Kiene
Browse files

fix bug in api url suffix when getting jobs for pipelines

parent 0e745b05
Loading
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -52,12 +52,17 @@ job_id = -1
# check last 500 pipelines max
for page in range(100):
    url_pls = API_BASE_URL + "/pipelines"

    # need both suffixes here to descend through the pages and get also older pipelines
    suffix = PER_PAGE_SUFFIX + PAGE_SUFFIX.format(page)
    resp_pls = requests.get(url_pls + suffix)
    for pl in resp_pls.json():
        if pl["ref"] == branch_name:
            url_jobs = url_pls + f"/{pl['id']}/jobs"
            resp_jobs = requests.get(url_jobs + suffix)
            
            # only one of the suffixes here - this assumes only max of 50 jobs per pipeline
            # so only one page needed
            resp_jobs = requests.get(url_jobs + PER_PAGE_SUFFIX)

            if job_name not in resp_jobs.text:
                continue