jenkins构建python代码,在python中使用jenkinsapi触发参数化构建

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":"[email protected]"}

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":"[email protected]"}

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

解决方案

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.

你可能感兴趣的:(jenkins构建python代码,在python中使用jenkinsapi触发参数化构建)