The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Bitbucket pipeline with Jenkins integration WAIT doesn't work when pipeline returns 302

Lara de Albuquerque Danconi Oliani
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 26, 2024
I have a Bitbucket pipeline with Jenkins Job Trigger Integration using WAIT variable.

- When the Jenkins pipeline is created by a BuildConfig: POST returns status code 302 and then the Bitbucket pipeline fails.
The Jenkins pipeline runs successfully. When I don't use WAIT, the Bitbucket pipeline also runs successfully.

- When the Jenkins pipeline is created manually: POST returns 201 and the Bitbucket pipeline can wait and completes successfully.



Logs:
**********ERROR**********

DEBUG: Starting new HTTPS connection (1): bitbucket.org:8080
DEBUG: https://bitbucket.org:8080 "GET /bitbucketpipelines/official-pipes/raw/master/pipes.prod.json HTTP/1.1" 200 None
INFO: None
INFO: Submitting jenkins job...
DEBUG: Starting new HTTPS connection (1): jenkins-env.apps.com:8080
DEBUG: https://jenkins-env.apps.com:8080 "POST /job/env/job/jobName/build HTTP/1.1" 302 0
DEBUG: https://jenkins-env.apps.com:8080 "GET /job/env/job/jobName/ HTTP/1.1" 200 9573
Traceback (most recent call last):
File "/pipe.py", line 187, in <module>
pipe.run()
File "/pipe.py", line 178, in run
self.wait_for_job(build_response.headers['Location'])
File "/usr/local/lib/python3.10/site-packages/requests/structures.py", line 52, in __getitem__
return self._store[key.lower()][1]
KeyError: 'location'

**********OK**********

DEBUG: Starting new HTTPS connection (1): bitbucket.org:8080
DEBUG: https://bitbucket.org:8080 "GET /bitbucketpipelines/official-pipes/raw/master/pipes.prod.json HTTP/1.1" 200 None
INFO: None
INFO: Submitting jenkins job...
DEBUG: Starting new HTTPS connection (1): jenkins-env.apps.com:8080
DEBUG: https://jenkins-env.apps.com:8080 "POST /job/env/job/jobName/build HTTP/1.1" 201 0
DEBUG: Starting new HTTPS connection (1): jenkins-env.apps.com:8080
DEBUG: https://jenkins-env.apps.com:8080 "GET /queue/item/9118//api/json HTTP/1.1" 200 422
INFO: Jenkins build not started yet: In the quiet period. Expires in 0.94 sec
DEBUG: Starting new HTTPS connection (1): jenkins-env.apps.com:8080
DEBUG: https://jenkins-env.apps.com:8080 "GET /queue/item/9118//api/json HTTP/1.1" 200 418
DEBUG: Starting new HTTP connection (1): jenkins-env.apps.com:80
DEBUG: http://jenkins-env.apps.com:80 "GET /job/env/job/jobName/65//api/json HTTP/1.1" 302 0
DEBUG: Starting new HTTPS connection (1): jenkins-env.apps.com:8080
DEBUG: https://jenkins-env.apps.com:8080 "GET /job/env/job/jobName/65//api/json HTTP/1.1" 200 1086
✔ Jenkins build with number 65 has finished successfully.
✔ Pipe has finished successfully.



Thanks!

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events