Run parameterized build using jenkinsapi in python

I am using the following code to create a job in jenkinsapi

from jenkinsapi.jenkins import *
from jenkinsapi.job import *
import os.path
import urllib2

jenkin = Jenkins('http://hudsonserver','hudson','hudson')

file0=open("data.log")
file1=open("full.log")

myJob = Job("http://hudsonserver/job/LTT_JOB/","LTT_JOB", jenkin)
parameters = {"data.log":file0,"full.log":file1,"REQUESTER_EMAIL_ID":"test@test.com"}
print myJob.get_last_buildnumber()

myJob.invoke('check',False,False,3,15,parameters)

In invoke () call, I use the 'check' token. It appears that the call fails due to the presentation of parameter parameters. Can someone tell if the following representation for parameters is correctly specified?

parameters = {"data.log":file0,"full.log":file1,"REQUESTER_EMAIL_ID":"test@test.com"}

I would be very helpful if anyone could point out examples written with jenkinsapi

+3
source share
1 answer

No, this is definitely not true. Parameters dict will be converted to GET parameters. And file objects cannot be converted to strings. You can pass the file path as parameters and write or read them inside your CI job.

0
source

All Articles