Re: Jelly/Plugin pipeline script support for optionalBlock

2017-02-20 Thread Daniel Beck

> On 20.02.2017, at 12:31, Robert Sandell  wrote:
> 
> https://wiki.jenkins-ci.org/display/JENKINS/Marking+a+new+plugin+version+as+incompatible+with+older+versions

… which should be only used when there's really no way to make work.

https://jenkins.io/project/governance/#compatibility-matters

-- 
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 jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/7E3F0329-35F3-4CAC-8183-17B3D5467690%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.


Re: Jelly/Plugin pipeline script support for optionalBlock

2017-02-20 Thread Robert Sandell
https://wiki.jenkins-ci.org/display/JENKINS/Hint+on+retaining+backward+compatibility

https://wiki.jenkins-ci.org/display/JENKINS/Marking+a+new+plugin+version+as+incompatible+with+older+versions

/B

On Sat, Feb 18, 2017 at 5:53 AM,  wrote:

>
> 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 
> 2. a new class:
>
> public class WaitTillCompleted extends 
> AbstractDescribableImpl
> {
>  private final boolean printLogOnFailure;
>  public boolean isPrintLogOnFailure() {
>   return printLogOnFailure;
>  }
>  @DataBoundConstructor
>  public WaitTillCompleted(boolean printLogOnFailure) {
> this.printLogOnFailure = printLogOnFailure;
> }
>
> @Extension
> public static class DescriptorImpl extends
> Descriptor {
> @Override
> public String getDisplayName() {
> return "";
> }
> }
> }
>
> 3. A new config.jelly for the above class
>
> 
>  xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson"
> xmlns:f="/lib/form">
>  field="printLogOnFailure" >
>   
> 
> 
>
> 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,  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 jenkinsci-dev+unsubscr...@googlegroups.com.
> 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.
>



-- 
Robert Sandell
*Software Engineer*
*CloudBees Inc.*

-- 
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 jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CALzHZS3Us-JvRqxm59R%2B8WeKqRNL79K9AugSzDkgBAWRKOEiLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jelly/Plugin pipeline script support for optionalBlock

2017-02-17 Thread andrew . sumner

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 
2. a new class:

public class WaitTillCompleted extends 
AbstractDescribableImpl {
 private final boolean printLogOnFailure;
 public boolean isPrintLogOnFailure() {
  return printLogOnFailure;
 }
 @DataBoundConstructor 
 public WaitTillCompleted(boolean printLogOnFailure) {
this.printLogOnFailure = printLogOnFailure;
}

@Extension
public static class DescriptorImpl extends 
Descriptor {
@Override
public String getDisplayName() {
return "";
}
}
}

3. A new config.jelly for the above class




  

 

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,  
> 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 jenkinsci-dev+unsubscr...@googlegroups.com.
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.


Re: Jelly/Plugin pipeline script support for optionalBlock

2017-02-17 Thread andrew . sumner
Well how about pointing me at some documentation then since it's pretty 
obvious by now that the code doesn't make a hell of a lot of sense to me.

I wouldn't have though that my requirements for the UI where that unusual 
that it would be so hard to get it working with pipeline script.

On Friday, February 17, 2017 at 6:17:25 AM UTC+13, Jesse Glick wrote:

> On Thu, Feb 16, 2017 at 4:30 AM,  
> 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 jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/9360f0f3-7b02-4ba5-a4e4-bf7c4cbd8d76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jelly/Plugin pipeline script support for optionalBlock

2017-02-16 Thread Jesse Glick
On Thu, Feb 16, 2017 at 4:30 AM,  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 jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2%2BQ2nfLDXGXcGrA3fkmp%2B-ZKjt1%3DutNkcSQ5_td%3DH7OQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jelly/Plugin pipeline script support for optionalBlock

2017-02-16 Thread andrew . sumner
 

Maybe I'm not looking in the right places or I just don't understand the 
code but I cannot see how to get an optionalProperty to work.  The only 
example I can find this the ui-samples-plugin which has an overly 
complicated example that I cannot follow.

 
1. Do you have any advice on how to search existing plugin code for 
optionalProperty usage?  Google isn't that helpful...

2. Can you either:

   - point me at a plugin that has a simple implementation that I could use 
   to adapt the following code 

or


   - suggest what changes I need to make to convert the following 
   optionalBlock to an optionalProperty? 

  



 

*Jelly
 
Snippet*






 
  


 

*Class Snippet*

@DataBoundSetter 
public final void setSetBuildVariables(SetBuildVariables setBuildVariables) 
{
if (setBuildVariables != null) {
this.setBuildVariables = true;
this.preserveVariables = setBuildVariables.preserveVariables;
this.variables = setBuildVariables.variables;
} else {
this.setBuildVariables = false;
this.preserveVariables = false;
this.variables = null;
}
}
 
public static final class SetBuildVariables {
private final boolean preserveVariables;
private final String variables;

@DataBoundConstructor 
public SetBuildVariables(boolean preserveVariables, String variables) {
this.preserveVariables = preserveVariables;
this.variables = variables;
}
}

 

Thanks in advance

  Andrew


On Thursday, January 19, 2017 at 5:13:37 AM UTC+13, Jesse Glick wrote:
>
> On Tue, Jan 17, 2017 at 7:55 PM,   
> wrote: 
> > When updating a plugin to support pipeline script, how do I handle an 
> > optionalBlock section? 
>
> Do not use `f:optionalBlock`. This is a low-level control. Do not 
> refer to `JSONObject` either. All this is old-style deprecated form 
> binding. 
>
> Use a high-level control like `f:optionalProperty` for nullable 
> structs (`ui-samples-plugin` has an example), or simple independent 
> `f:checkbox`es for `boolean` properties (`doCheck*` form validation 
> can reject invalid combinations). 
>
> Also use `@DataBoundSetter` for any property with a plausible default. 
>

-- 
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 jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/e7fe9147-aeab-4b9e-9e34-1b63b1f87d2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jelly/Plugin pipeline script support for optionalBlock

2017-02-06 Thread Andrew Sumner
Is there any other options for creating foldable sectionsthat will also work 
with the pipeline syntax generator? optionalBlock: will not add the fields 
inside the foldableblock to the generated syntaxoptionalProperty: couldn’t get 
that to work and I’m notsure that it will indent the child fields like 
optionalBlockSimple independent fields: lose visual queue that field 
isdependant on another field being set 

On Thursday, 19 January 2017 5:13 AM, Jesse Glick  
wrote:
 

 On Tue, Jan 17, 2017 at 7:55 PM,   wrote:
> When updating a plugin to support pipeline script, how do I handle an
> optionalBlock section?

Do not use `f:optionalBlock`. This is a low-level control. Do not
refer to `JSONObject` either. All this is old-style deprecated form
binding.

Use a high-level control like `f:optionalProperty` for nullable
structs (`ui-samples-plugin` has an example), or simple independent
`f:checkbox`es for `boolean` properties (`doCheck*` form validation
can reject invalid combinations).

Also use `@DataBoundSetter` for any property with a plausible default.

-- 
You received this message because you are subscribed to a topic in the Google 
Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/jenkinsci-dev/uGVIkV7u78Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0KKVKGvJzvgBBAEGdDNshQ%3DY8wgtrzyXsuPst4y60fag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


   

-- 
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 jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/673807624.2364733.1486370659547%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jelly/Plugin pipeline script support for optionalBlock

2017-01-18 Thread Jesse Glick
On Tue, Jan 17, 2017 at 7:55 PM,   wrote:
> When updating a plugin to support pipeline script, how do I handle an
> optionalBlock section?

Do not use `f:optionalBlock`. This is a low-level control. Do not
refer to `JSONObject` either. All this is old-style deprecated form
binding.

Use a high-level control like `f:optionalProperty` for nullable
structs (`ui-samples-plugin` has an example), or simple independent
`f:checkbox`es for `boolean` properties (`doCheck*` form validation
can reject invalid combinations).

Also use `@DataBoundSetter` for any property with a plausible default.

-- 
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 jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0KKVKGvJzvgBBAEGdDNshQ%3DY8wgtrzyXsuPst4y60fag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.