Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,360,265
Community Members
 
Community Events
168
Community Groups

pipe: atlassian/jenkins-job-trigger:0.1.1

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

 

- step: &functionalTest
name: functional test
script:
- pipe: atlassian/jenkins-job-trigger:0.1.1
variables:
JENKINS_URL: '<<my jenkins URL>>'
JENKINS_USER: '<<my jenkins username>>'
JENKINS_TOKEN: '<<my jenkins token>>'
JOB_NAME: '<<my jenkins jobname>>'
No error but Jenkins job isnt triggered
--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_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.

2 answers

1 accepted

1 vote
Answer accepted

@Sarath Nagarajan  hi.  Thanks for your question.

You received response 200 from your jenkins. Maybe:

  • try to add `DEBUG: true` to your bitbucket-pipelines.yml to get more details
  • try to add `WAIT: true` to wait for triggered job to complete.

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?

@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.

Like Sarath Nagarajan likes this

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

Like Igor Stoyanov likes this

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. 

please ignore this empty submission   

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

3,473 views 3 10
Read article

Atlassian Community Events