python-jenkins远程创建作业失败,并出现错误:jenkins.EmptyResponseException:与服务器[服务器]通信时出错:空响应

时间:2019-04-19 10:05:02

标签: python jenkins jenkins-pipeline jenkins-api

我正在使用python-jenkins https://python-jenkins.readthedocs.io/en/latest/库来远程创建多分支管道作业。

我有以下代码:

import jenkins
xmlfilecontent = "config.xml content in string"
server = jenkins.Jenkins('https://jenkins.example.com', username='tom', password='11sometoken6')
server.create_job('myjobname', xmlfilecontent )

当我运行以上命令时,作业在我的Jenkins服务器中创建,但出现此错误:

Traceback (most recent call last):
  File "ex3.py", line 70, in <module>
    server.create_job('myjobname', xmlfilecontent)
  File "/home/a/.local/lib/python3.6/site-packages/jenkins/__init__.py", line 1195, in create_job
    headers=DEFAULT_HEADERS
  File "/home/a/.local/lib/python3.6/site-packages/jenkins/__init__.py", line 564, in jenkins_open
    return self.jenkins_request(req, add_crumb, resolve_auth).text
  File "/home/a/.local/lib/python3.6/site-packages/jenkins/__init__.py", line 583, in jenkins_request
    self._request(req))
  File "/home/a/.local/lib/python3.6/site-packages/jenkins/__init__.py", line 543, in _response_handler
    "empty response" % self.server)
jenkins.EmptyResponseException: Error communicating with server[https://jenkins.example.com/]: empty response

任何人都可以帮助解决以上错误。

此外,在创建以上作业之后,我在UI上收到了此消息。但是我提到的项目已经有Jenkinsfile。

enter image description here

0 个答案:

没有答案
相关问题