Reputation: 1592
The scenario I ran into is that I had a build queued and a build running that was spawned from an entirely different source than the jenkins api that would both eventually succeed or fail. I then spawned a build from the jenkins api a which would eventually fail. If I invoke the build with the block parameter set to true and another build gets queued up while my jenkins api job is building, when the job is done how do I tell if the job I spawned succeeded for sure?
jen = jenkinsapi.jenkins.Jenkins(os.getenv('JENKINS_URL'), 'user', 'password')
builds = jj.get_build_dict()
returned_value = jj.invoke(block=True, params=buildparams)
#
# I tried getting the build number to query out of the build dictonairy using jj.get_build_dict() again, but the problem is that there are multiple builds that my build could be. Is there a way in the jenkins cli or the jenkins api to get the build number back after calling the invoke method with the wait parameter?
Upvotes: 0
Views: 2149
Reputation: 1592
Easy install installs an old deprecated version of the Jenkins api. Going directly to the source and installing will give you a version that you can get an invocation object back from the invoke method. https://github.com/salimfadhley/jenkinsapi https://github.com/paramiko/paramiko/pull/58/files
Upvotes: 1