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
@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 $
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Shahar Senior @Manish Pal we released a new version of jenkins-job-trigger:0.2.0 where we fixed usage of BUILD_FROM_FILE and JOB_PARAMETERS.
script: - pipe: atlassian/jenkins-job-trigger:0.2.0 variables: JENKINS_URL: 'http://my-jenkinsio-host/job' JENKINS_USER: $JENKINS_USER JENKINS_TOKEN: $JENKINS_TOKEN JOB_NAME: 'staging-awesome-project-job' BUILD_FROM_FILE: 'path_to_file_from_repo/jenkins_file' JENKINS_FILE_PATH: 'path_to_file_on_jenkins_job_parameter/jenkins_file' WAIT: 'true' WAIT_MAX_TIME: 120
script: - pipe: atlassian/jenkins-job-trigger:0.2.0 variables: JENKINS_URL: 'http://my-jenkinsio-host/job' JENKINS_USER: $JENKINS_USER JENKINS_TOKEN: $JENKINS_TOKEN JOB_NAME: 'staging-awesome-project-job' JOB_PARAMETERS: > { "test1": $TEST1, "test2": "test2" } WAIT: 'true' WAIT_MAX_TIME: 120
Please, provide us feedback if all works as expected.
Regards, Igor.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.