-
Bug
-
Resolution: Fixed
-
Major
-
Jenkins 1.642.3, Pipeline 2.0, Git Plugin 2.4.4, Git Client Plugin 1.19.6
Using Jenkins 1.642.3 and Pipeline 2.0, an exception is thrown when the DataBoundConstructor is missing from plugin code. The problem can be reproduced with the following line up: Jenkins 1.642.3, Pipeline 2.0, Git Plugin 2.4.4, Git Client Plugin 1.19.6.
The problem did not exists with Pipeline 1.15 and Jenkins 1.642.1.
To reproduce the problem, install those plugins, create a Pipeline job, and go in the snippet generator, then:
- select the "checkout" step
- select Git
- Additional behaviors: Merge Before Build
- Click "Generate Groovy"
The stacktrace in the console should contain:
Caused by: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.jenkinsci.plugins.gitclient.MergeCommand$Strategy
And there is no groovy code generated.
- is duplicated by
-
JENKINS-37224 Snippet Generator produces incorrect output for "Merge strategy" of "Merge before build" for GIT
-
- Resolved
-
-
JENKINS-36092 Pipeline Syntax Generator throws 500 on merge before build
-
- Closed
-
- is related to
-
JENKINS-31925 GitSCM default values not properly defined
-
- Open
-
-
JENKINS-34459 There's no @DataBoundConstructor on any constructor of class org.jenkinsci.plugins.gitclient.MergeCommand$Strategy
-
- Closed
-
- relates to
-
JENKINS-51638 No Enum Constant Found - Default PreBuildMerge Failure
-
- Closed
-
- links to
Not sure offhand what caused this to regress but it is clear from looking at the code in the Git plugin what is wrong; perhaps it just worked by accident before. UserMergeOptions has conflicting types for the mergeStrategy parameter: as a String in the @DataBoundConstructor, but as an Enum (MergeCommand.Strategy) in the matching getter.
It must use a single consistent type for both. Best would be to use the enum in both (ideally taking the opportunity to switch to @DataBoundSetter for the optional parameters). fastForwardMode is already done this way, so following suit would allow DescriptorImpl.doFillMergeStrategyItems to be deleted in favor of f:enum in the config.jelly.
Ironically, it seems to be you who added the new field with the proper usage style in
JENKINS-12402, without fixing the definition of the existing field.As an aside, the two id attributes in the config.jelly are unnecessary and should be deleted.