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

Invoking job build with block=True fails on network errors #825

Open
cedrak opened this issue Sep 23, 2022 · 0 comments
Open

Invoking job build with block=True fails on network errors #825

cedrak opened this issue Sep 23, 2022 · 0 comments

Comments

@cedrak
Copy link

cedrak commented Sep 23, 2022

ISSUE TYPE
  • Bug Report
Jenkinsapi VERSION

0.3.11

Jenkins VERSION

2.176.3

SUMMARY

Blocking for build completion breaks when networking is unreliable.

EXPECTED RESULTS

I would expect that block would be (at least to some extent) resilient to network errors like in the case of queue.block_until_building.

ACTUAL RESULTS

Blocking for build completion breaks when Jenkins instance will respond with one non-200 response.

USEFUL INFORMATION

How to reproduce:

  1. Make connection to Jenkins
  2. Invoke job with block=True
  3. During building on Jenkins receive 502 response from server
16:11:16 Traceback (most recent call last):
(...)
16:11:16   File "/home/jenkins/workspace/***.py", line 105, in build
16:11:16     queue_item = job.invoke(build_params=params, block=True)
16:11:16   File "/tmp/venv/lib/python3.8/site-packages/jenkinsapi/job.py", line 238, in invoke
16:11:16     qi.block_until_complete(delay=delay)
16:11:16   File "/tmp/venv/lib/python3.8/site-packages/jenkinsapi/queue.py", line 142, in block_until_complete
16:11:16     return build.block_until_complete(delay=delay)
16:11:16   File "/tmp/venv/lib/python3.8/site-packages/jenkinsapi/build.py", line 417, in block_until_complete
16:11:16     while self.is_running():
16:11:16   File "/tmp/venv/lib/python3.8/site-packages/jenkinsapi/build.py", line 399, in is_running
16:11:16     data = self.poll(tree='building')
16:11:16   File "/tmp/venv/lib/python3.8/site-packages/jenkinsapi/jenkinsbase.py", line 60, in poll
16:11:16     data = self._poll(tree=tree)
16:11:16   File "/tmp/venv/lib/python3.8/site-packages/jenkinsapi/build.py", line 63, in _poll
16:11:16     return self.get_data(url, params={'depth': self.depth}, tree=tree)
16:11:16   File "/tmp/venv/lib/python3.8/site-packages/jenkinsapi/jenkinsbase.py", line 84, in get_data
16:11:16     response.raise_for_status()
16:11:16   File "/tmp/venv/lib/python3.8/site-packages/requests/models.py", line 1021, in raise_for_status
16:11:16     raise HTTPError(http_error_msg, response=self)
16:11:16 requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url:

I could make PR, but I would need some assistance, to confirm if my solution proposition is correct.

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

1 participant