I am calling pipe in my script section to call a jenkins job from BB yml. The stage (in BB) is getting success however, no job got triggered in Jenkins
--env=BITBUCKET_GIT_HTTP_ORIGIN="$BITBUCKET_GIT_HTTP_ORIGIN" \
--env=BITBUCKET_PROJECT_UUID="$BITBUCKET_PROJECT_UUID" \
--env=BITBUCKET_REPO_IS_PRIVATE="$BITBUCKET_REPO_IS_PRIVATE" \
--env=BITBUCKET_WORKSPACE="$BITBUCKET_WORKSPACE" \
--env=BITBUCKET_REPO_OWNER_UUID="$BITBUCKET_REPO_OWNER_UUID" \
--env=BITBUCKET_BRANCH="$BITBUCKET_BRANCH" \
--env=BITBUCKET_REPO_UUID="$BITBUCKET_REPO_UUID" \
--env=BITBUCKET_PROJECT_KEY="$BITBUCKET_PROJECT_KEY" \
--env=BITBUCKET_REPO_SLUG="$BITBUCKET_REPO_SLUG" \
--env=CI="$CI" \
--env=BITBUCKET_REPO_OWNER="$BITBUCKET_REPO_OWNER" \
--env=BITBUCKET_STEP_RUN_NUMBER="$BITBUCKET_STEP_RUN_NUMBER" \
--env=BITBUCKET_BUILD_NUMBER="$BITBUCKET_BUILD_NUMBER" \
--env=BITBUCKET_GIT_SSH_ORIGIN="$BITBUCKET_GIT_SSH_ORIGIN" \
--env=BITBUCKET_PIPELINE_UUID="$BITBUCKET_PIPELINE_UUID" \
--env=BITBUCKET_COMMIT="$BITBUCKET_COMMIT" \
--env=BITBUCKET_CLONE_DIR="$BITBUCKET_CLONE_DIR" \
--env=PIPELINES_JWT_TOKEN="$PIPELINES_JWT_TOKEN" \
--env=BITBUCKET_STEP_UUID="$BITBUCKET_STEP_UUID" \
--env=BITBUCKET_DOCKER_HOST_INTERNAL="$BITBUCKET_DOCKER_HOST_INTERNAL" \
--env=DOCKER_HOST="tcp://host.docker.internal:2375" \
--env=BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" \
--env=BITBUCKET_PIPE_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/jenkins-job-trigger" \
--env=JENKINS_TOKEN="secureToken" \
--env=JENKINS_URL="https://jenkins.p.morconnect.com/online/job" \
--env=JENKINS_USER="sarathnagarajan" \
--env=JOB_NAME="online-mymorrisons-automation/sonar-reporting" \
--add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \
bitbucketpipelines/jenkins-job-trigger:0.1.1
Unable to find image 'bitbucketpipelines/jenkins-job-trigger:0.1.1' locally
0.1.1: Pulling from bitbucketpipelines/jenkins-job-trigger
b4d181a07f80: Pulling fs layer
a1111a8f2ec3: Pulling fs layer
ed53099fbce6: Pulling fs layer
dc539afda2c1: Pulling fs layer
77bc0d833cb6: Pulling fs layer
ea1ffd508d33: Pulling fs layer
e201113b9485: Pulling fs layer
00bf2b3661fe: Pulling fs layer
d7f9ccdbfde4: Pulling fs layer
dc539afda2c1: Waiting
77bc0d833cb6: Waiting
ea1ffd508d33: Waiting
e201113b9485: Waiting
00bf2b3661fe: Waiting
d7f9ccdbfde4: Waiting
a1111a8f2ec3: Verifying Checksum
a1111a8f2ec3: Download complete
ed53099fbce6: Verifying Checksum
ed53099fbce6: Download complete
b4d181a07f80: Verifying Checksum
b4d181a07f80: Download complete
ea1ffd508d33: Verifying Checksum
ea1ffd508d33: Download complete
dc539afda2c1: Verifying Checksum
dc539afda2c1: Download complete
77bc0d833cb6: Verifying Checksum
77bc0d833cb6: Download complete
00bf2b3661fe: Verifying Checksum
00bf2b3661fe: Download complete
e201113b9485: Verifying Checksum
e201113b9485: Download complete
d7f9ccdbfde4: Verifying Checksum
d7f9ccdbfde4: Download complete
b4d181a07f80: Pull complete
a1111a8f2ec3: Pull complete
ed53099fbce6: Pull complete
dc539afda2c1: Pull complete
77bc0d833cb6: Pull complete
ea1ffd508d33: Pull complete
e201113b9485: Pull complete
00bf2b3661fe: Pull complete
d7f9ccdbfde4: Pull complete
Digest: sha256:2cebbe81f365578b04a955fb1be97083181863d1755f9fd0ca122e0d7e8c0629
Status: Downloaded newer image for bitbucketpipelines/jenkins-job-trigger:0.1.1
WARNING: Could not find released pipe version for atlassian/jenkins-job-trigger. Data matched: {}
INFO: Submitting jenkins job...
✔ Pipe has finished successfully.
@Sarath Nagarajan hi. Thanks for your question.
You received response 200 from your jenkins. Maybe:
Regards, Igor.
Thanks @Igor Stoyanov now i can see some debug logs where jenkins job is being called however there are certain redirections. May be the org policy etc that i'll check it internally
Just one other q. I am getting the below message
Traceback (most recent call last):
File "/pipe.py", line 145, in <module>
pipe.run()
File "/pipe.py", line 136, in run
self.wait_for_job(build_response.headers['Location'])
File "/usr/local/lib/python3.9/site-packages/requests/structures.py", line 54, in __getitem__
return self._store[key.lower()][1]
KeyError: 'location'
Any idea?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Sarath Nagarajan hi. By default jenkins response is something like this:
HTTP/1.1 201 Created
Location: http://localhost:8080/queue/item/16/
In your case seems like no `Location` header present in response.
Regards, Igor.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I got your point. so if the redirect issue is fixed then i think this can be resolved
i'll try and keep you posted.
BTW. Thank you so much for your responses
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
All worked thanks for your help @Igor Stoyanov
problem was with the URL used .. there is a proxy'd one that i am suppose to use... and that did the magic.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.