Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading Jenkins jobs failed #24

Open
frbimo opened this issue Dec 15, 2024 · 3 comments
Open

Loading Jenkins jobs failed #24

frbimo opened this issue Dec 15, 2024 · 3 comments

Comments

@frbimo
Copy link

frbimo commented Dec 15, 2024

Description

I tried example in https://github.com/collivier/ansible-role-xtesting?tab=readme-ov-file#deploy-your-xtesting-cicd-toolchain-jenkins but failed.

Output

...
fatal: [127.0.0.1]: FAILED! => {"changed": false, "cmd": ["jenkins-jobs", "--conf", "/tmp/jenkins_jobs.ini", "update", "/tmp/xtesting.yaml"], "delta": "0:00:01.939284", "end": "2024-12-15 15:49:16.659240", "msg": "non-zero return code", "rc": 1, "start": "2024-12-15 15:49:14.719956", "stderr": "INFO:jenkins_jobs.cli.subcommand.update:Updating jobs in ['/tmp/xtesting.yaml'] ([])\nINFO:root:Caching type builders of builders = jenkins_jobs.modules.builders:Builders\nINFO:root:Caching type parameters of parameters = jenkins_jobs.modules.parameters:Parameters\nINFO:root:Caching type properties of properties = jenkins_jobs.modules.properties:Properties\nINFO:root:Caching type triggers of triggers = jenkins_jobs.modules.triggers:Triggers\nINFO:jenkins_jobs.builder:Number of jobs generated:  11\n ...  __init__.py\", line 775, in get_info", "    return json.loads(self.jenkins_open(", "                      ^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 564, in jenkins_open", "    return self.jenkins_request(req, add_crumb, resolve_auth).text", "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 580, in jenkins_request", "    self.maybe_add_crumb(req)", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 369, in maybe_add_crumb", "    response = self.jenkins_open(requests.Request(", "               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 564, in jenkins_open", "    return self.jenkins_request(req, add_crumb, resolve_auth).text", "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 583, in jenkins_request", "    self._request(req))", "    ^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 557, in _request", "    return self._session.send(r, **_settings)", "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/requests/sessions.py\", line 703, in send", "    r = adapter.send(request, **kwargs)", "        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/requests/adapters.py\", line 483, in send", "    timeout = TimeoutSauce(connect=timeout, read=timeout)", "              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/urllib3/util/timeout.py\", line 119, in __init__", "    self._connect = self._validate_timeout(connect, \"connect\")", "                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/urllib3/util/timeout.py\", line 156, in _validate_timeout", "    raise ValueError(", "ValueError: Timeout value connect was <object object at 0x72f097978a10>, but it must be an int, float or None.", "", "During handling of the above exception, another exception occurred:", "", "Traceback (most recent call last):", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/parallel.py\", line 63, in run", "    res = task[\"func\"](*task[\"args\"], **task[\"kwargs\"])", "          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/builder.py\", line 353, in parallel_update_job", "    self.update_job(job.name, job.output().decode(\"utf-8\"))", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/builder.py\", line 132, in update_job", "    if self.is_job(job_name):", "       ^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/builder.py\", line 143, in is_job", "    if job_name in self.job_list:", "                   ^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/builder.py\", line 102, in job_list", "    self._job_list = set(job[\"fullname\"] for job in self.jobs)", "                                                    ^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/builder.py\", line 94, in jobs", "    self._jobs = self.jenkins.get_all_jobs()", "                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 1027, in get_all_jobs", "    jobs = [(0, [], self.get_info(query=jobs_query)['jobs'])]", "                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 782, in get_info", "    raise JenkinsException(\"Could not parse JSON info for server[%s]\"", "jenkins.JenkinsException: Could not parse JSON info for server[http://192.168.8.78:8080/]", "Traceback (most recent call last):", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 775, in get_info", "    return json.loads(self.jenkins_open(", "                      ^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 564, in jenkins_open", "    return self.jenkins_request(req, add_crumb, resolve_auth).text", "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 580, in jenkins_request", "    self.maybe_add_crumb(req)", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 369, in maybe_add_crumb", "    response = self.jenkins_open(requests.Request(", "               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 564, in jenkins_open", "    return self.jenkins_request(req, add_crumb, resolve_auth).text", "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 583, in jenkins_request", "    self._request(req))", "    ^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 557, in _request", "    return self._session.send(r, **_settings)", "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/requests/sessions.py\", line 703, in send", "    r = adapter.send(request, **kwargs)", "        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/requests/adapters.py\", line 483, in send", "    timeout = TimeoutSauce(connect=timeout, read=timeout)", "              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/urllib3/util/timeout.py\", line 119, in __init__", "    self._connect = self._validate_timeout(connect, \"connect\")", "                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/urllib3/util/timeout.py\", line 156, in _validate_timeout", "    raise ValueError(", "ValueError: Timeout value connect was <object object at 0x72f097978a10>, but it must be an int, float or None.", "", "During handling of the above exception, another exception occurred:", "", "Traceback (most recent call last):", "  File \"/usr/bin/jenkins-jobs\", line 10, in <module>", "    sys.exit(main())", "             ^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/cli/entry.py\", line 174, in main", "    jjb.execute()", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/cli/entry.py\", line 154, in execute", "    ext.obj.execute(self.options, self.jjb_config)", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/cli/subcommand/update.py\", line 151, in execute", "    jobs, num_updated_jobs = builder.update_jobs(", "                             ^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/builder.py\", line 340, in update_jobs", "    raise result", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/parallel.py\", line 63, in run", "    res = task[\"func\"](*task[\"args\"], **task[\"kwargs\"])", "          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/builder.py\", line 353, in parallel_update_job", "    self.update_job(job.name, job.output().decode(\"utf-8\"))", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/builder.py\", line 132, in update_job", "    if self.is_job(job_name):", "       ^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/builder.py\", line 143, in is_job", "    if job_name in self.job_list:", "                   ^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/builder.py\", line 102, in job_list", "    self._job_list = set(job[\"fullname\"] for job in self.jobs)", "                                                    ^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins_jobs/builder.py\", line 94, in jobs", "    self._jobs = self.jenkins.get_all_jobs()", "                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 1027, in get_all_jobs", "    jobs = [(0, [], self.get_info(query=jobs_query)['jobs'])]", "                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "  File \"/usr/lib/python3/dist-packages/jenkins/__init__.py\", line 782, in get_info", "    raise JenkinsException(\"Could not parse JSON info for server[%s]\"", "jenkins.JenkinsException: Could not parse JSON info for server[http://192.168.8.78:8080/]"], "stdout": "", "stdout_lines": []}

Steps

  1. Activate virtualenv
  2. Install dependencies for ubuntu
  3. Run steps on here

Expected output

ansible steps should be finished normally with no failed/error

Env

$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy

collivier.xtesting (4.6.0)
@collivier
Copy link
Owner

@frbimo Thank you for the issue.

Could you please provide some details (versions, etc.) about urllib3?
It looks like the issue I saw in Debian Unstable which asked to downgrade urllib3 (same for requests because of py docker)
It might happen because of the virtualenv.

\"/usr/lib/python3/dist-packages/urllib3/util/timeout.py\", line 156, in _validate_timeout", " raise ValueError(", "ValueError: Timeout value connect was <object object at 0x72f097978a10>, but it must be an int, float or None."

I'm reproducing it, but meanwhile, be free not to use virtualenv which provides very limited values in case of Ubuntu 22.04 because most of the dependencies are installed by python packages (and the other deps don't exist as Ubuntu package).

@frbimo
Copy link
Author

frbimo commented Dec 17, 2024

Hi @collivier thanks for the response.

pip show urllib3
Name: urllib3
Version: 2.2.2

@collivier
Copy link
Owner

@frbimo It passed successfully here

That seems to be because you installed via pip a newer version of urllib3 which asks for an update of jenkins job builder.
python3-urllib3 is 1.26.5 in Ubuntu 22.04.

Could you please remove the pip package and force reinstall of the distrib one if present (note: the playbook would install it if missing but wouldn't reinstall it if pip removed the system files) ?

Debian unstable proposes urllib3 2.2.3 but I'm checking how much they patch jenkins-job-builder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants