Open Musi13 opened 4 years ago
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
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