我尝试在我的系统上第一次运行jenkins-jobs update
,但验证失败。
jenkins-jobs --conf ./jjb.ini update jobs/
jobs
包含test.yml
- 一个仅用于测试的微型构建项目。 jjb.ini
是:
[jenkins]
user=admin
password={{ admin_api_token }} # Inserted API token here.
url=http://127.0.0.1:8080
query_plugins_info=False
成功,并将示例构建项目导入Jenkins。
INFO:jenkins_jobs.cli.subcommand.update:Updating jobs in ['jobs/'] ([])
INFO:jenkins_jobs.builder:Number of jobs generated: 1
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/jenkins/__init__.py", line 557, in jenkins_request
self._request(req))
File "/usr/local/lib/python3.5/dist-packages/jenkins/__init__.py", line 508, in _response_handler
response.raise_for_status()
File "/usr/lib/python3/dist-packages/requests/models.py", line 840, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Invalid password/token for user: b'admin' for url: http://127.0.0.1:8080/crumbIssuer/api/json
我在这里引起注意的是b'admin
的身份验证失败,而admin
的身份验证失败。这也反映在" People" Jenkins Web界面上的页面,在尝试登录之前仅显示admin
,但在尝试登录后显示:
从我能够弄清楚的结果来看,JJB的登录请求中的编码可能存在问题,但我在寻找如何解决问题方面寻求帮助此
Ubuntu 16.04.4 LTS
Jenkins 2.125 (working as expected, at :8080)
jenkins-job-builder 2.0.9
Python 3.5.2
pip 10.0.1 from /usr/local/lib/python3.5/dist-packages/pip-10.0.1-py3.5.egg/pip (python 3.5)
java -version: openjdk version "1.8.0_171"
答案 0 :(得分:1)
它适用于请求== 2.19.1
sudo pip uninstall requests
sudo pip install requests
$ pip freeze | grep requests
requests==2.19.1
答案 1 :(得分:0)
以下步骤解决了我的问题:
pip3.7 freeze | grep requests
pip3.7 uninstall requests
pip3.7 install requests
pip3.7 freeze | grep requests