jenkinsapi icon indicating copy to clipboard operation
jenkinsapi copied to clipboard

BuildParameters with file option failing

Open premkumar970 opened this issue 5 years ago • 2 comments

Jenkinsapi 0.3.9
Jenkins VERSION
SUMMARY

Trying to send a file, as part of the job ,seeing this error , the file content is not json format.its text file

EXPECTED RESULTS

to submit the job successfully

ACTUAL RESULTS

exception raised

USEFUL INFORMATION
import jenkinsapi
#from jenkinsapi.job import *
from jenkinsapi.jenkins import Jenkins
import os.path

data_file = open('test-data.txt', 'r')
build_params = {"IMAGE":"test-image","test_URL":"www.test.com/test","AREA_NAME":"test","PARA":"4","TYPE":"custom"}

jenkins_url = "https://jenkins-pc.test.cci.test.com"
username = "test_user"
password = "passcode"

server = Jenkins(jenkins_url, username=username, password=password, timeout = 1200, lazy = True)
job = "tenant/sec/value-Check"
new_job = server[job]
running_job_object = new_job.invoke(block=True,
build_params=build_params,
files={'tests.custom': data_file})
data_file.close()

TRACEBACK
Traceback (most recent call last):
File "executeJob.py_t", line 23, in
files={'tests.custom': data_file})
File "/test/prem-test/lib/python3.6/site-packages/jenkinsapi/job.py", line 180, in invoke
if build_params and (not self.has_params()):
File "/test/prem-test/lib/python3.6/site-packages/jenkinsapi/job.py", line 730, in has_params
if any("parameterDefinitions" in a for a in (self._data["actions"])
TypeError: 'NoneType' object is not subscriptable

premkumar970 avatar Feb 20 '20 14:02 premkumar970

same issue here

nickyfoster avatar Jul 23 '20 09:07 nickyfoster

you may want to try https://api4jenkins.readthedocs.io/en/latest/index.html

joelee2012 avatar Jan 07 '21 07:01 joelee2012