Home > Software design >  Jenkins - receive build status from remotely started build
Jenkins - receive build status from remotely started build

Time:11-10

I got multi-thread python code that starts remotely Jenkins job I used the common code

nextBuildReq=urllib.request.urlopen(serverURL '/job/' jobName '/api/json')
jobStream=json.load(nextBuildReq)
nextBuild=str(jobStream['nextBuildNumber'])
jenkinsStream = urllib.request.urlopen(serverURL '/job/' jobName '/buildWithParameters?token=myToken')

I need a way to avoid requesting the next build number and "follow" the results for job the thread started since I got simultaneous requests

I also tried using

status = requests.get(job_url)

but status doesn't contains any needed information

CodePudding user response:

Using jenkins-cli solvs the issue

java -jar {self.local_cli_path} -noCertificateCheck build {self.jobName} -s -w -v

The return value is job ID

  • Related