You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: Filing this under bug because its unexpected behavior, but this could also be considered an enhancement
Version Info
Parameterized Builds for Jenkins: 4.0.10
Bitbucket Server: 6.9.1
Jenkins: 2.206
How to reproduce
Create a job in Jenkins with at least one parameter and give it a default value
Create a job entry in 'ParameterizedBuilds' config to build that Jenkins job and give it NO parameters
Trigger the build -> receive 400 Bad Request
Some detail:
There's two endpoints that Jenkins uses to trigger jobs, .../build and .../buildWithParameters. When not provided any parameters, the ParameterizedBuilds plugin posts to .../build (since it assumes the job takes no parameters). If a job has any parameters, even if they have defaults, this returns 400. For those jobs, we should post to .../buildWithParameters with no params specified. Unfortunately, posting to .../buildWithParameters when a job takes no parameters causes a 500.
I think a good solution to this would be some way to specify that a job takes parameters, even if we don't have any we want to send (i.e. change this argument to setUrlPath).
Nginx logs for what I'm talking about:
# Current behavior
"POST /job/verify.bugspray.multi/job/trigger-test/build HTTP/1.1" 400 524 "-" "Java/1.8.0_172" "-"
# Manually specify the missing parameter, user has to click through the confirmation form
"POST /job/verify.bugspray.multi/job/trigger-test/buildWithParameters?DEBUG_TIME=0 HTTP/1.1" 201 5 "-" "Java/1.8.0_172" "-"
# Made an empty parameter (just whitespace in Build Parameters box), still has popup but works
"POST /job/verify.bugspray.multi/job/trigger-test/buildWithParameters?+= HTTP/1.1" 201 5 "-" "Java/1.8.0_172" "-"
# Manual verification that buildWithParameters without params works
"POST /job/verify.bugspray.multi/job/trigger-test/buildWithParameters HTTP/1.1" 201 5 "-" "curl/7.64.1" "-"
# Manually showing triggering a no-parameter job with buildWithParameters doesn't work
"POST /job/verify.bugspray.multi/job/master/buildWithParameters HTTP/1.1" 500 18133 "-" "curl/7.64.1" "-"
I'm not really blocked here; I'll just have users click through the form and accept the default parameters, but this seems like unexpected behavior
Expected Behavior
Builds with all default parameters trigger successfully. Ideally, I'd like to click the 'Build in Jenkins' button and have the build start without showing a form, the same as a job that takes no parameters.
Current Behavior
Build fails with 'Bad Request' notification
The text was updated successfully, but these errors were encountered:
I think this has to do with jenkins, rather than parametrized-builds. If you use jenkins with multibranch Pipeline, jenkins can't do the first build with parameters specified. Don't know if that's your use case or not.
I know about that quirk, but this is a bit different. Even with regular (non-pipeline) jobs where the parameters are defined, this behavior can be reproduced
I see what you mean @Musi13. I started looking into this but it seems like the only options are to either
Get the job configuration and parse the xml or json for a parameters section. The issue here is that parameters seem to be defined in two different places and it isn't clear if those locations are the only locations especially for pipelines or multibranch pipelines. I also haven't checked if this would require different permissions from builds but I would assume so.
Just try one endpoint and if it fails, try the other. This could work but I'm a little hesitant to implement this. It feels clunky and that code already is a bit messy to begin with.
A workaround for now is that you can add a parameter to Bitbucket hook settings that doesn't actually exist on the job. That will make the addon assume that the job is parameterized and when a build is triggered, Jenkins will just ignore the bad parameter. It may not be ideal but it should work.
Note: Filing this under bug because its unexpected behavior, but this could also be considered an enhancement
Version Info
How to reproduce
Some detail:
There's two endpoints that Jenkins uses to trigger jobs, .../build and .../buildWithParameters. When not provided any parameters, the ParameterizedBuilds plugin posts to .../build (since it assumes the job takes no parameters). If a job has any parameters, even if they have defaults, this returns 400. For those jobs, we should post to .../buildWithParameters with no params specified. Unfortunately, posting to .../buildWithParameters when a job takes no parameters causes a 500.
I think a good solution to this would be some way to specify that a job takes parameters, even if we don't have any we want to send (i.e. change this argument to setUrlPath).
Nginx logs for what I'm talking about:
I'm not really blocked here; I'll just have users click through the form and accept the default parameters, but this seems like unexpected behavior
Expected Behavior
Builds with all default parameters trigger successfully. Ideally, I'd like to click the 'Build in Jenkins' button and have the build start without showing a form, the same as a job that takes no parameters.
Current Behavior
Build fails with 'Bad Request' notification
The text was updated successfully, but these errors were encountered: