3

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 the invoke() call, I am using the token 'check'. It looks like the call is failing due to way parameters are represented, Can anyone tell if the following representation for parameters is correct?

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

I would be really helpful if anyone can point to examples written with jenkinsapi

santhosh
  • 111
  • 1
  • 3
  • 6

1 Answers1

0

No, this is definitly incorrect. Paramters dict would be converted to GET parameters. And file objects couldn't be converted to strings. You can pass path to files as parameters and write or read them inside your CI job.

simplylizz
  • 1,686
  • 14
  • 28