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,295,398
Community Members
 
Community Events
165
Community Groups

pipe: atlassian/jenkins-job-trigger:0.1.2

When Trigger job with parameters 

JENKINS_URL: $JENKINS_URL
JENKINS_USER: $JENKINS_USER
JENKINS_TOKEN: $JENKINS_TOKEN
JOB_NAME: 'myJob'
JOB_PARAMETERS: { 'Commit_Hash': '$BITBUCKET_COMMIT' }
WAIT: 'true'
DEBUG: 'true' # Optional

 The Pipe Failed with :

 

✖ Pipe has failed with error:
HTTP ERROR 400 This page expects a form submission
You need to post /job/myJob/buildWithParameters instead of /job/myJob/build

2 answers

1 accepted

0 votes
Answer accepted

@Shahar Senior  hi. This is a bug in the pipe. We will investigate this issue and update the pipe.

But there is a hidden feature you can use instead:

JENKINS_URL: $JENKINS_URL
JENKINS_USER: $JENKINS_USER
JENKINS_TOKEN: $JENKINS_TOKEN
JOB_NAME: 'myJob'
BUILD_FROM_FILE: 'path to the file with parameters'
WAIT: 'true'
DEBUG: 'true' # Optional

 where you can paste all your job parameters.

Cheers.

 

 

@lissyaka 

I created a file build.json with params in the root dir of the repository.
I am trying to set BUILD_FROM_FILE parameter with $

BITBUCKET_CLONE_DIR/build.json 

It says Jenkins jobfile doesnt exist on running the pipeline. 

Have tried with just setting value as build.json as well. Same error.

I will check this

@Manish Pal. This pipe checks if file present in directory.

Also there is a test that checks if build from file is working correctly.

Please, ensure you have a file when you run the pipeline.
To do this you can:

step:
name: trigger
script:
- ls # check your file is presented
- pipe: atlassian/jenkins-job-trigger:0.1.2
variables:
JENKINS_URL: $JENKINS_URL
JENKINS_USER: $JENKINS_USER
JENKINS_TOKEN: $JENKINS_TOKEN
JOB_NAME: 'myJob'
BUILD_FROM_FILE: 'path to the file with parameters'
WAIT: 'true'
DEBUG: 'true' # Optional
0 votes
Patrik S Atlassian Team Jun 02, 2022

Hello @Shahar Senior ,

Welcome to Atlassian community!

From the error message you received it seems that when using parameters Jenkins expects you to call the /buildWithParameters endpoint, instead of /build

Could you please try updating your $JENKINS_URL to call the /buildWithParameters endpoint and check how it goes? 

Let me know in case you run into any issues or have any questions.

Thank you, @Shahar Senior .

Kind regards,

Patrik S

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

2,166 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you