I've finally got it working, one remaining issue:
Is there any way to make optionalProperty backwards compatible with
optionalBlock? When I publish the update to this plugin I don't want
people to have to reconfigure there jobs. If not, is there any way to mark
the plugin as not backwards compatible?
For anyone else struggling with this the answer is that an optionalProperty
needs to have it's own class and config.jelly.
For me that meant:
1. the original optional block became <f:optionalProperty title="Wait Till
Build Completed" field="waitTillBuildCompleted" />
2. a new class:
public class WaitTillCompleted extends
AbstractDescribableImpl<WaitTillCompleted> {
private final boolean printLogOnFailure;
public boolean isPrintLogOnFailure() {
return printLogOnFailure;
}
@DataBoundConstructor
public WaitTillCompleted(boolean printLogOnFailure) {
this.printLogOnFailure = printLogOnFailure;
}
@Extension
public static class DescriptorImpl extends
Descriptor<WaitTillCompleted> {
@Override
public String getDisplayName() {
return "";
}
}
}
3. A new config.jelly for the above class
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"
xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson"
xmlns:f="/lib/form">
<f:entry title="Show BuildMaster Log on Failure"
field="printLogOnFailure" >
<f:checkbox default="false" />
</f:entry>
</j:jelly>
Cheers
Andrew
On Friday, February 17, 2017 at 6:17:25 AM UTC+13, Jesse Glick wrote:
> On Thu, Feb 16, 2017 at 4:30 AM, <[email protected] <javascript:>>
> wrote:
> >The only example I can find this the ui-samples-plugin which has an
> overly complicated example that I cannot follow.
>
> That is the cleanest example I know of. You can use GitHub search to
> look for others but I cannot say whether they will be good examples or
> bad examples, unless I wrote them myself.
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/86581742-e4dd-4e26-943b-62ba8bd4b7dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.