jenkinsapi icon indicating copy to clipboard operation
jenkinsapi copied to clipboard

get_downstream_builds returning empty values

Open abhirambs opened this issue 8 years ago • 6 comments

ISSUE TYPE
  • How to...
Jenkinsapi VERSION

0.3.2

Jenkins VERSION

1.544

SUMMARY

get_downstream_builds() on a known build number is returning empty list.

EXPECTED RESULTS

I am trying to obtain downstream builds from a top level job. I am expecting it to return the list of builds using get_downstream_builds

ACTUAL RESULTS

In the code snippet, where jenkins_url, job_name and build_num are appropriately input to the program, build.get_downstream_builds() is returning empty values. However, I can see all the downstream jobs when I use the job.get_downstream_jobs. I know for a fact that my input build number and build job do have downstream builds. Not sure if I am missing something.

USEFUL INFORMATION
        from jenkinsapi.jenkins import Jenkins
        from jenkinsapi.build import Build

        jenkins = Jenkins(jenkins_url, username=xxxxxx, password=xxxxxx)
        job = jenkins.get_job(job_name)
        build = Build(jenkins_url, build_num, job)

        build_info = build.get_downstream_builds()
        print "build list -%s" %build_info

        job_info = job.get_downstream_jobs()
        print "job list -%s" %job_info

abhirambs avatar Sep 22 '16 21:09 abhirambs

Faced with the same problem with either depth=1 or depth=2: MacOS 10.12.1 Python 3.5.2 jenkinsapi (0.3.3) Jenkins 2.30

Using the default depth=1, I'm getting an empty list of get_downstream_builds. build = Build(jenkins_url, build_num, job) time python3 jenkins_api_test.py [] jenkins_api_test.py 0.47s user 0.08s system 17% cpu 3.077 total

build = Build(jenkins_url, build_num, job, depth=2) time python3 jenkins_api_test.py [] python3 jenkins_api_test.py 14.34s user 1.49s system 26% cpu 59.084 total

shat00n avatar Nov 26 '16 09:11 shat00n

Any update on this?

TheKaur avatar Aug 15 '18 00:08 TheKaur

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 18 '19 17:10 stale[bot]

Closed due to inactivity

stale[bot] avatar Oct 25 '19 18:10 stale[bot]

still an issue! can't we reopen this? I can see the downstream build can get the upstream but not the other way:

print upstream_build.get_downstream_builds() # result = [] :( 
print downstream_build.get_upstream_build()  # result = `<jenkinsapi.build.Build Application » job_name #job_number>`

NegarehMir avatar May 28 '20 16:05 NegarehMir

I have trouble finding where the Jenkins API is even queried in the code, but according to this answer on SO, there is an action "triggeredBuilds" that gets the information regarding downstream builds from the API. Currently in the code, it seems a little overcomplicated with making use of job information, fingerprints etc.

I can't tell if the answer needs a specific plugin or not though. https://stackoverflow.com/a/53656658

kutschkem avatar Mar 12 '22 20:03 kutschkem