When attempting to trigger a test plan using the Bamboo REST API, a connection timeout is occurring. The code and corresponding error are shown below.
Code:
base_url = "http://bamboo.delawarenorth.com:8085/rest/api/latest/"
execution_response = requests.post(
base_url + "queue/EDC-NITCS",
auth=(args['<user>'], args['<password>']),
data="JOB1&ExecuteAllStages",
headers={'Accept': 'application/json'}
).json()
Error:
17-Jan-2023 17:40:32 | Traceback (most recent call last): |
17-Jan-2023 17:40:32 | File "scripts/validate_staging_environment.py", line 54, in <module> |
17-Jan-2023 17:40:32 | main(docopt(__doc__)) |
17-Jan-2023 17:40:32 | File "scripts/validate_staging_environment.py", line 32, in main |
17-Jan-2023 17:40:32 | headers={'Accept': 'application/json'}).json() |
17-Jan-2023 17:40:32 | File "/home/bamboo/.local/share/virtualenvs/19496961-76316673-E-qKXQIp/lib/python3.6/site-packages/requests/models.py", line 897, in json |
17-Jan-2023 17:40:32 | return complexjson.loads(self.text, **kwargs) |
17-Jan-2023 17:40:32 | File "/home/bamboo/.local/share/virtualenvs/19496961-76316673-E-qKXQIp/lib/python3.6/site-packages/simplejson/__init__.py", line 525, in loads |
17-Jan-2023 17:40:32 | return _default_decoder.decode(s) |
17-Jan-2023 17:40:32 | File "/home/bamboo/.local/share/virtualenvs/19496961-76316673-E-qKXQIp/lib/python3.6/site-packages/simplejson/decoder.py", line 372, in decode |
17-Jan-2023 17:40:32 | obj, end = self.raw_decode(s) |
17-Jan-2023 17:40:32 | File "/home/bamboo/.local/share/virtualenvs/19496961-76316673-E-qKXQIp/lib/python3.6/site-packages/simplejson/decoder.py", line 402, in raw_decode |
17-Jan-2023 17:40:32 | return self.scan_once(s, idx=_w(s, idx).end()) |
17-Jan-2023 17:40:32 | simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0) |
My team has done the following:
What are next steps we can take to resolve this issue?
Hello @Jake Roach
Welcome to Atlassian Community!
Can you connect to the main Bamboo URL via curl? Does that work with an authenticated user as well?
Timing out may be something other than Bamboo such as a Reverse Proxy, a Firewall, etc so you need to make sure that you can reach Bamboo on the specified port and hostname.
I was able to trigger a build using the code inspired by the Bamboo REST API documentation.
Ran this:
#!/usr/bin/python3
# This code sample uses the 'requests' library:
# http://docs.python-requests.org
import requests
import json
url = "https://bamboo.mydomain.net/rest/api/latest/queue/ABC-MF1"
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
response = requests.request(
"POST",
url,
headers=headers,
auth=('admin', 'admin')
)
print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
Got this:
{
"buildNumber": 5,
"buildResultKey": "ABC-MF1-5",
"link": {
"href": "https://bamboo.mydomain.net/rest/api/latest/result/ABC-MF1-5",
"rel": "self"
},
"planKey": "ABC-MF1",
"triggerReason": "Manual build"
}
Sincerely,
Eduardo Alvarenga
Atlassian Support APAC
--please don't forget to Accept the answer if the reply is helpful--
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.