Re: Parameter definition with cascading selection

2020-01-04 Thread Andrew Sumner
I've tried using  to add 
jQuery support and trialled it out using jQuery('div[name="parameter"]') 
but getting error jQuery is not a function.


   1. How should I add jquery?
   2. How to I use it do call back to parameter definition class get 
   updated list for second dropdown?


On Thursday, January 2, 2020 at 12:20:31 AM UTC+13, Andrew Sumner wrote:
>
> A parameter that I am developing for my plugin requires two select fields, 
> the second one being populated using the value selected from the dropdown 
> list of the first field. My problem is that I don't know how to repopulate 
> the list for the second field.
>
> I've got as far as detecting the change in the first field but I don't 
> know how to force a refresh of the second field;
>
> *ParameterDefinition - index.jelly*
>
> 
>  "jelly:define"
>xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"
>xmlns:i="jelly:fmt" xmlns:p="/lib/hudson/project">
>
>
>
> "${it.formattedDescription}">
>
>   
>
>
>>
>  
> ${item.name}
>  
>   
>
>
>   
>  
> ${item.name}
>  
>   
>
>
> 
>
>
> I'm also wondering if this is the best approach. I could potentially split 
> this out into two seperate fields, however I then need to replicate the 
> behaviour of the active choices plugin and that sounds a bit daunting...
>
>
> Any suggestions?
>
>

-- 
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/2105b7ad-a832-42f2-a124-9f64c0a5d60c%40googlegroups.com.


Parameter definition with cascading selection

2020-01-01 Thread Andrew Sumner
A parameter that I am developing for my plugin requires two select fields, 
the second one being populated using the value selected from the dropdown 
list of the first field. My problem is that I don't know how to repopulate 
the list for the second field.

I've got as far as detecting the change in the first field but I don't know 
how to force a refresh of the second field;

*ParameterDefinition - index.jelly*





   
   
   
  


  
 
${item.name}
 
  


  
 
${item.name}
 
  
   
   



I'm also wondering if this is the best approach. I could potentially split this 
out into two seperate fields, however I then need to replicate the behaviour of 
the active choices plugin and that sounds a bit daunting...


Any suggestions?

-- 
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/2bc2a6c2-f8e9-40e2-b230-180b34ee43ca%40googlegroups.com.


Editable jelly select tag / combobox

2019-12-30 Thread Andrew Sumner
I need to allow users to enter a custom value into a field that is 
currently using a jelly select tag, but I still want to present the list of 
values as well.

I've tried the combobox tag, but that:

   1. doesn't allow a default value to be set (show stopper)
   2. filters the list so users cannot see anything in the dropdown list 
   unless they first clear the current value (ugly but could live with it).

What are my options here?

-- 
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/53bb9fcb-9a4f-41a9-85c4-f5b1ecb2cde7%40googlegroups.com.


Re: Is it possible to log to console for a parameter plugin?

2019-12-15 Thread Andrew Sumner
What do you mean by "create a path to the Jenkins core..."?

On Sunday, 15 December 2019 18:24:02 UTC+13, Oleg Nenashev wrote:
>
> Hi Andrew,
>
> Some APIs have been created before the logging framework, and they might 
> be lacking logger references. ParameterValue is unfortunately one of the 
> examples of such old APIs, AFAICT there is no clean API to reference the 
> listener. 
> My recommendation would be to just create a path to the Jenkins core and 
> to route parameters correctly.
>
> I believe the listener can be still retrieved using reflection, but I do 
> not have example for it
>
> On Saturday, December 14, 2019 at 1:41:17 PM UTC+1, Andrew Sumner wrote:
>>
>> I am writing a custom parameter using the 
>> SimpleParameterDefinition/ParameterValue 
>> classes
>>
>> Is it possible to log to the console in buildEnvironment method?
>>
>> @Override
>> public void buildEnvironment(Run build, EnvVars env) {
>>  env.put("VAR1", var1Value);
>>  env.put("VAR2", var2Value);
>> }
>>
>> For example, in a SimpleBuildStep I would use the TaskListener
>>
>> @Override
>> public void perform(Run run, FilePath workspace, Launcher launcher, 
>> TaskListener listener) {
>>  listener.getLogger().println("About to do some stuff");
>> }
>>
>> but I cannot find a similar option in for parameters.
>>
>>

-- 
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/5178aa8a-cacb-4899-8d5d-0fac0bd1c2f9%40googlegroups.com.


Is it possible to log to console for a parameter plugin?

2019-12-14 Thread Andrew Sumner
I am writing a custom parameter using the 
SimpleParameterDefinition/ParameterValue 
classes

Is it possible to log to the console in buildEnvironment method?

@Override
public void buildEnvironment(Run build, EnvVars env) {
 env.put("VAR1", var1Value);
 env.put("VAR2", var2Value);
}

For example, in a SimpleBuildStep I would use the TaskListener

@Override
public void perform(Run run, FilePath workspace, Launcher launcher, 
TaskListener listener) {
 listener.getLogger().println("About to do some stuff");
}

but I cannot find a similar option in for parameters.

-- 
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/efa05ec6-df83-41b1-ac36-83bbc806db4a%40googlegroups.com.


Setting envrioment variables from plugin running in pipeline script

2017-03-05 Thread andrew . sumner
I have a plugin I've been updating to support pipeline script (with some 
help from this forum - thanks guys!).  During testing I discovered that the 
plugin is not setting environment variables when run from a pipeline 
script, but works fine in a freestyle job.

Can anyone suggest anything I might have overlooked?

Thanks in advance
  Andrew


*Pipeline Script*

This outputs an empty value for %BUILDMASTER_APPLICATION_ID%.

node {
buildMasterSelectApplication applicationId: '1', deployableId: '1'
bat 'echo BUILDMASTER_APPLICATION_ID = %BUILDMASTER_APPLICATION_ID%'
}


*Code*

This is how I'm setting the environment variable

public class SelectApplicationBuilder extends Builder implements 
SimpleBuildStep {

@Override
public void perform(Run run, FilePath workspace, Launcher 
launcher, TaskListener listener) throws InterruptedException, IOException {
run.addAction(new 
VariableInjectionAction("BUILDMASTER_APPLICATION_ID", applicationId));
} 
}



-- 
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/3a0afe81-6adf-4cd5-ae54-e8b44999a79e%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

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 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.


Jelly/Plugin pipeline script support for optionalBlock

2017-01-17 Thread andrew . sumner


When updating a plugin to support pipeline script, how do I handle an 
optionalBlock section?


I've been using 
*https://github.com/jenkinsci/pipeline-plugin/blob/master/DEVGUIDE.md#user-content-build-wrappers-1*
 

 
as a guide to updating my plugins to support pipeline script and that went 
well until I tried up update a plugin that uses an optionalBlock.


Using the pipeline syntax generator I get an exception that it is expecting 
a boolean for the optional block parameter and if I make it a boolean it 
complains about needing to pass a JSonObject!!!





  




public DeployToStageBuilder(String toStage, JSONObject waitTillBuildCompleted) {
this.toStage = toStage;

if (waitTillBuildCompleted != null) { 
this.waitTillBuildCompleted = true; 
this.printLogOnFailure = 
"true".equalsIgnoreCase(waitTillBuildCompleted.getString("printLogOnFailure"));
} else { 
this.waitTillBuildCompleted = false; 
this.printLogOnFailure = false;
}
}

-- 
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/a5490565-e22e-4ae5-92da-2a95ff37d43d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Plugin execution on a slave

2016-10-25 Thread andrew . sumner


A user has asked me to support running my plugin on a slave but whatever I 
try I keep getting an “Unable to serialize” exception.  My code is now 
about as basic as it gets and still failing.  Any ideas?

 

I’m running Jenkins 2.19.1 and my plugin has a Jenkins version dependency 
of '1.642.3'.

 

 

@Override

public boolean perform(final AbstractBuild build, final Launcher 
launcher, final BuildListener listener) throws IOException, 
InterruptedException {

return launcher.getChannel().call(new MasterToSlaveCallable() {

   private static final long serialVersionUID = 
-8921104780200640023L;

 

@Override

public Boolean call() throws IOException {

return true;

}

   });

}

 

 

FATAL: Unable to serialize 
com.inedo.proget.jenkins.DownloadPackageBuilder$1@10c1200

java.io.IOException: Unable to serialize 
com.inedo.proget.jenkins.DownloadPackageBuilder$1@10c1200

at 
hudson.remoting.UserRequest.serialize(UserRequest.java:201)

at hudson.remoting.UserRequest.(UserRequest.java:64)

at hudson.remoting.Channel.call(Channel.java:795)

at 
com.inedo.proget.jenkins.DownloadPackageBuilder.perform(DownloadPackageBuilder.java:84)

at 
hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)

at 
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)

at hudson.model.Build$BuildExecution.build(Build.java:205)

at hudson.model.Build$BuildExecution.doRun(Build.java:162)

at 
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)

at hudson.model.Run.execute(Run.java:1720)

at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)

at 
hudson.model.ResourceController.execute(ResourceController.java:98)

at hudson.model.Executor.run(Executor.java:404)

Caused by: java.io.NotSerializableException: 
com.inedo.proget.jenkins.DownloadPackageBuilder

at java.io.ObjectOutputStream.writeObject0(Unknown Source)

at java.io.ObjectOutputStream.defaultWriteFields(Unknown 
Source)

at java.io.ObjectOutputStream.writeSerialData(Unknown 
Source)

at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown 
Source)

at java.io.ObjectOutputStream.writeObject0(Unknown Source)

at java.io.ObjectOutputStream.writeObject(Unknown Source)

at 
hudson.remoting.UserRequest._serialize(UserRequest.java:190)

at 
hudson.remoting.UserRequest.serialize(UserRequest.java:199)

... 12 more

-- 
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/6bcb1974-23ca-4c49-8955-efd58cef74fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Can a plugin access the workspace from the job configuration page?

2016-09-03 Thread Andrew Sumner
I’d like to place a validation button on the job configuration page to verify 
that an ant fileset is valid AND finds something in the workspace. 

Is anyone aware of any plugins that do this? Its always easier to copy someone 
else’s code when dealing with this stuff 

Regards
  Andrew




-- 
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/BAY402-EAS247BEE683215985DE2B0700BCE40%40phx.gbl.
For more options, visit https://groups.google.com/d/optout.


How do I get the test harness to include the plugin under development?

2016-04-05 Thread andrew . sumner
I'm trying to write a unit test that will exercise the UI for my plugin and 
to do that I need to configure it's global properties.

I can get to the global configuration page but when I look in the config 
form for my plugin settings it's not there.  The wiki only touches this 
area very lightly so it's not been much help.

The offending bit of code is in: 
https://github.com/andrew-sumner/inedo-proget-plugin/blob/master/src/test/java/com/inedo/proget/jenkins/DownloadPluginTests.java

@Rule
public JenkinsRule j = new JenkinsRule()

@Test
public void perform() {
HtmlPage globalConfigPage = 
j.createWebClient().webClient.goTo("configure");

HtmlForm form = globalConfigPage.getFormByName("config");

// My plugins global properties are not found
HtmlInput password = form.getInputByName("_.password");


I've tried:

   - @WithPlugin("DownloadPackageBuilder.hpi") 

This issue: https://issues.jenkins-ci.org/browse/JENKINS-29181 suggests 
that I should be able to do this with 
@WithPlugin("DownloadPackageBuilder.hpi") if I can get the plugin into the 
plugins folder but doesn't have any ideas on how this might be achieved.


   - j.recipeLoadCurrentPlugin();

This looked promising but didn't work - possibly because I am using the 
Gradle JPI plugin: 
https://wiki.jenkins-ci.org/display/JENKINS/Gradle+JPI+Plugin


Any idea on what I might be missing?


-- 
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/2bcda835-d4ba-493e-8cf8-c114f18270da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How do I get the test harness to include the plugin I'm developing?

2016-04-05 Thread andrew . sumner


I'm trying to write a unit test that will exercise the UI for my plugin and 
to do that I need to configure it's global properties.

 

I can get to the global configuration page but when I look in the config 
form for my plugin settings it's not there.  The wiki only touches this 
area very lightly so it's not been much help.

 

My code is in: 
https://github.com/andrew-sumner/inedo-proget-plugin/blob/master/src/test/java/com/inedo/proget/jenkins/DownloadPluginTests.java

 

@Rule
public JenkinsRule j = new JenkinsRule()

@Test
public void perform() {
HtmlPage globalConfigPage = 
j.createWebClient().webClient.goTo("configure");

HtmlForm form = globalConfigPage.getFormByName("config");

 

// My plugins global properties are not found
HtmlInput password = form.getInputByName("_.password");

 



}


I've tried:


   -  @WithPlugin("DownloadPackageBuilder.hpi") 
   
This issue: https://issues.jenkins-ci.org/browse/JENKINS-29181 suggests 
that I should be able to do this with 
@WithPlugin("DownloadPackageBuilder.hpi") if I can get the plugin into the 
plugins folder but doesn't have any ideas on how this might be achieved.


   -   j.recipeLoadCurrentPlugin();
   
This looked promising but didn't work - possibly because I am using the 
Gradle JPI plugin: 
https://wiki.jenkins-ci.org/display/JENKINS/Gradle+JPI+Plugin

 

Any idea on what I might be missing?

-- 
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/8cf71a3a-71b6-44b3-bf08-fe9a30cc5ea6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How do I get the test harness to include the plugin I'm developing?

2016-04-05 Thread andrew . sumner
I'm trying to write a unit test that will exercise the UI for my plugin and 
to do that I need to configure it's global properties.

I can get to the global configuration page but when I look in the config 
form for my plugin settings it's not there.  The wiki only touches this 
area very lightly so it's not been much help.

My code is in: 
https://github.com/andrew-sumner/inedo-proget-plugin/blob/master/src/test/java/com/inedo/proget/jenkins/DownloadPluginTests.java

@Rule
public JenkinsRule j = new JenkinsRule()

@Test
public void perform() {
HtmlPage globalConfigPage = 
j.createWebClient().webClient.goTo("configure");

HtmlForm form = globalConfigPage.getFormByName("config");

// My plugins global properties are not found
HtmlInput password = form.getInputByName("_.password");


I've tried:


   - @WithPlugin("DownloadPackageBuilder.hpi") 
   
This issue: https://issues.jenkins-ci.org/browse/JENKINS-29181 suggests 
that I should be able to do this with 
@WithPlugin("DownloadPackageBuilder.hpi") if I can get the plugin into the 
plugins folder but doesn't have any ideas on how this might be achieved. 


   - j.recipeLoadCurrentPlugin();
   
This looked promising but didn't work - possibly because I am using the 
Gradle JPI plugin: 
https://wiki.jenkins-ci.org/display/JENKINS/Gradle+JPI+Plugin


Any idea on what I might be missing?

-- 
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/f7557bd8-2789-415e-9278-e606a9e146d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How does a Jenkins test harness include the plugin it's meant to be testing?

2016-04-05 Thread andrew . sumner
I'm trying to write a unit test that will exercise the UI for my plugin and 
to do that I need to configure the plugins global properties.

I can get to the global configuration page but when I look in the config 
form for my plugin settings it's not there.  The wiki only touches this 
area very lightly so it's not been much help.

@Rule
public JenkinsRule j = new JenkinsRule()

@Test
public void perform() {
HtmlPage globalConfigPage = 
j.createWebClient().webClient.goTo("configure");

HtmlForm form = globalConfigPage.getFormByName("config");

// My plugins global properties are not found
HtmlInput password = form.getInputByName("_.password");


https://issues.jenkins-ci.org/browse/JENKINS-29181 suggests I should be 
able to use @WithPlugin("DownloadPackageBuilder.hpi") once I've added the 
hpi file to the plugins folder but there is no explanation on how to do 
that...

The offending bit of code is in: 
https://github.com/andrew-sumner/inedo-proget-plugin/blob/master/src/test/java/com/inedo/proget/jenkins/DownloadPluginTests.java

Any idea on what I might be missing?

-- 
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/1c6c7084-30dc-4550-b0b5-4536474e0182%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How do I get the test harness to include the plugin I'm developing?

2016-04-05 Thread andrew . sumner
I'm trying to write a unit test that will exercise the UI for my plugin and 
to do that I need to configure it's global properties.

I can get to the global configuration page but when I look in the config 
form for my plugin settings it's not there.  The wiki only touches this 
area very lightly so it's not been much help.

My code is in: 
https://github.com/andrew-sumner/inedo-proget-plugin/blob/master/src/test/java/com/inedo/proget/jenkins/DownloadPluginTests.java

@Rule
public JenkinsRule j = new JenkinsRule()

@Test
public void perform() {
HtmlPage globalConfigPage = 
j.createWebClient().webClient.goTo("configure");

HtmlForm form = globalConfigPage.getFormByName("config");

// My plugins global properties are not found
HtmlInput password = form.getInputByName("_.password");


I've tried:


   - @WithPlugin("DownloadPackageBuilder.hpi") 

This issue: https://issues.jenkins-ci.org/browse/JENKINS-29181 suggests 
that I should be able to do this with 
@WithPlugin("DownloadPackageBuilder.hpi") if I can get the plugin into the 
plugins folder but doesn't have any ideas on how this might be achieved. 


   - j.recipeLoadCurrentPlugin();

This looked promising but didn't work - possibly because I am using the 
Gradle JPI plugin: 
https://wiki.jenkins-ci.org/display/JENKINS/Gradle+JPI+Plugin


Any idea on what I might be missing?


-- 
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/03e8e010-01d6-471e-87a0-b1d1eaf354f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How do I get the test harness to include the plugin I'm developing?

2016-04-04 Thread Andrew Sumner


I'm trying to write a unit test that
will exercise the UI for my plugin and to do that I need to configure it's
global properties.

 

I can get to the global configuration
page but when I look in the config form for my plugin settings it's not
there.  The wiki only touches this area very lightly so it's not been much
help.

 

My code is in: 

https://github.com/andrew-sumner/inedo-proget-plugin/blob/master/src/test/java/com/inedo/proget/jenkins/DownloadPluginTests.java

 

@Rule

public JenkinsRule j = new JenkinsRule()



@Test

public void perform() {

HtmlPage globalConfigPage =
j.createWebClient().webClient.goTo("configure");



HtmlForm form =
globalConfigPage.getFormByName("config");

 

   
// My plugins global properties are not found

HtmlInput password =
form.getInputByName("_.password");

 



}



I've tried:
@WithPlugin("DownloadPackageBuilder.hpi") 



This issue:
https://issues.jenkins-ci.org/browse/JENKINS-29181 suggests that I should be
able to do this with @WithPlugin("DownloadPackageBuilder.hpi") if I
can get the plugin into the plugins folder but doesn't have any ideas on how
this might be achieved.
j.recipeLoadCurrentPlugin();



This looked promising but didn't work -
possibly because I am using the Gradle JPI plugin:
https://wiki.jenkins-ci.org/display/JENKINS/Gradle+JPI+Plugin




Any idea on what I might be missing?

  

-- 
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/BAY169-W63D188A014A9F0AD10BC9D0%40phx.gbl.
For more options, visit https://groups.google.com/d/optout.


Re: How queue a single action across multiple Jenkins jobs and not queue the entire job?

2015-05-14 Thread andrew . sumner
Am I being overly ambitious and just need to resign myself to the fact that 
I need to block the entire Jenkins job when a resource is locked by another 
job, and not just block the individual build step?

I've discovered that ResourceActivity is close to what I require, the 
problem is that once the build is underway I cannot update the resouce that 
I am trying to lock.

Ideally in the perform(AbstractBuild?, ? build, Launcher launcher, 
BuildListener listener) method I would:

   1. Set the resource that I want to lock to reserve its place in the queue
   2. Notify Jenkins that it needs to update the resource locks for this 
   build - ie Jenkins would call getResourceList() again
   3. Check if any other jobs already have the resource locked and sit 
   waiting wait unit the locked resource is available again before proceeding
   


public class SelectApplicationBuilder extends Builder implements 
ResourceActivity {
 ...

 @Override
 public boolean perform(AbstractBuild?, ? build, Launcher launcher, 
BuildListener listener) throws IOException {
...
 }

 @Override
 public ResourceList getResourceList() {
 System.out.println(==BuildMaster Application 
Resource  + this.applicationId);
 
 ResourceList list = new ResourceList();
 Resource r = new Resource(BuildMaster Application  + 
this.applicationId 
);
 list.w(r);
 
 return list;
 }

 // ResourceActivity
 @Override
 public String getDisplayName() {
 return BuildMaster Application Resource;
 }
}


-- 
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/51d87e72-75ea-453c-a573-571abc43711c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


'stapler-class' is deprecated

2015-05-03 Thread andrew . sumner
I'm getting this warning when saving job configuration. Is it something I 
should worry about or can I safely ignore it?

May 04, 2015 12:02:21 PM org.kohsuke.stapler.RequestImpl$TypePair 
convertJSON
WARNING: 'stapler-class' is deprecated: 
com.inedo.buildmaster.TriggerBuildBuilder

It seems this is affecting most plugins based on what I'm abserving in the 
Jenkins log.

Source Code: 
https://github.com/jenkinsci/inedo-buildmaster-plugin/blob/master/src/main/java/com/inedo/buildmaster/TriggerBuildBuilder.java

-- 
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/8b72dcd1-9171-4fbe-8f60-e9366fa92379%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: inedo-buildmaster-plugin job config

2015-05-02 Thread andrew . sumner
I'd rather keep inedo-buildmaster-plugin 
https://github.com/jenkinsci/inedo-buildmaster-plugin as I've committed 
some additional changes to this and created a wiki page for it.  Sorry 
about that - my bad.  When I got an email that I had access to the Jenkins 
GitHub I assumed that meant I had to create the repository as I didn't see 
a buildmaster one.  Someone else had also posted that it could do with a 
rename - hence the different name.

On Saturday, May 2, 2015 at 5:58:13 AM UTC+12, Ullrich Hafner wrote:

 Seems we have two forks now:

 https://github.com/jenkinsci/inedo-buildmaster-plugin
 https://github.com/jenkinsci/buildmaster-plugin

 Can I delete the first one?

 Am 01.05.2015 um 05:45 schrieb andrew...@xtra.co.nz javascript::

 The job for the inedo-buildmaster-plugin is a Maven job, but should be a 
 Gradle job: 
 https://jenkins.ci.cloudbees.com/job/plugins/job/gradle-jpi-plugin/

 How can I get the changed over?

 Thanks
   Andrew

 -- 
 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-de...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/jenkinsci-dev/2757a8d1-85ab-4b11-b3ae-bc15d44b29dc%40googlegroups.com
  
 https://groups.google.com/d/msgid/jenkinsci-dev/2757a8d1-85ab-4b11-b3ae-bc15d44b29dc%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 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/ed7ebac1-dc47-481c-82d7-1f675c7f024c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


inedo-buildmaster-plugin job config

2015-04-30 Thread andrew . sumner
The job for the inedo-buildmaster-plugin is a Maven job, but should be a 
Gradle job: 
https://jenkins.ci.cloudbees.com/job/plugins/job/gradle-jpi-plugin/

How can I get the changed over?

Thanks
  Andrew

-- 
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/2757a8d1-85ab-4b11-b3ae-bc15d44b29dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Hosting Request for BuildMaster Plugin

2015-04-27 Thread andrew . sumner
Hi, 

I’d like to host a new Jenkins plugin at Jenkins-ci. The plugin will enable 
BuildMaster users (http://inedo.com/buildmaster) to to request version 
information and trigger builds on a BuildMaster application as part of a 
Jenkins build process.

GitHub plugin name: buildmaster-plugin
Personal GitHub ID: andrew-sumner
Existing GitHub repository: 
https://github.com/andrew-sumner/buildmaster-plugin

Regards
  Andrew

Note: this is a duplicate as my last request never got any traction and I 
thought I'd try again...

-- 
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/26c595ca-3d86-4c65-acfa-baf04082181d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Unit testing a plugin with global configuration properties

2015-04-21 Thread andrew . sumner

As far as I can tell the following is how I need to set the global 
configuration properties before I attempt to do anything with my plugin, 
however I get an exception thrown (stack trace below) on the first line: 
HtmlPage p = j.createWebClient().goTo(configure);

I'm using 'org.jenkins-ci.main:jenkins-test-harness:1.596.1'

Any idea why this is not working?  Is this the best way to configure global 
plugin properties as defined in global.jelly?


public class PluginTest {
... 

@Rule
public JenkinsRule j = new JenkinsRule();

@Test
public void configure() throws Exception {
// Set global configuration for the plugin
HtmlPage p = j.createWebClient().goTo(configure);
HtmlForm form = p.getFormByName(configure);

HtmlInput url = form.getInputByName(_.url);
url.setValueAttribute(http://localhost:1234/;);

HtmlInput apiKey = form.getInputByName(_.apiKey);
apiKey.setValueAttribute(mykey);

form.submit();

// Set job configuration
FreeStyleProject project = j.createFreeStyleProject();

SelectApplicationBuilder before = new 
SelectApplicationBuilder(36, LATEST, NONE);
project.getBuildersList().add(before);


j.submit(j.createWebClient().getPage(project,configure).getFormByName(config));

SelectApplicationBuilder after = 
project.getBuildersList().get(SelectApplicationBuilder.class);

j.assertEqualBeans(before, after, applicationId, releaseNumber, 
buildNumberSource);
}
}




=== EXCEPTION START 
EcmaError: lineNumber=[3] column=[0] lineSource=[  Event.extend(event, 
element);] name=[ReferenceError] 
sourceName=[http://localhost:54546/jenkins/adjuncts/da4d8661/lib/form/breadcrumb-config-outline/init.js]
 
message=[ReferenceError: section is not defined. 
(http://localhost:54546/jenkins/adjuncts/da4d8661/lib/form/breadcrumb-config-outline/init.js#3)]
com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: section is 
not defined. 
(http://localhost:54546/jenkins/adjuncts/da4d8661/lib/form/breadcrumb-config-outline/init.js#3)
at 
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)
at 
net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:529)
at 
net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:536)
at 
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:458)
at 
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:918)
at 
com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventListeners(EventListenersContainer.java:155)
at 
com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:207)
at 
com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:619)
at 
com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:886)
at 
net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:529)
at 
net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:536)
at 
com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:891)
at 
com.gargoylesoftware.htmlunit.html.HtmlPage.executeEventHandlersIfNeeded(HtmlPage.java:1133)
at 
com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:177)
at 
com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:456)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:332)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:389)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:374)
at 
org.jvnet.hudson.test.JenkinsRule$WebClient.goTo(JenkinsRule.java:2024)
at 
org.jvnet.hudson.test.JenkinsRule$WebClient.goTo(JenkinsRule.java:2004)
at 
com.inedo.buildmaster.TriggerBuildBuilderTest.selectApplicationBuilder_configure(TriggerBuildBuilderTest.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.jvnet.hudson.test.JenkinsRule$2.evaluate(JenkinsRule.java:489)
at org.junit.rules.RunRules.evaluate(RunRules.java:18)
at 

Hosting Request for BuildMaster plugin

2015-04-21 Thread andrew . sumner

Could I get this added?


   - your GitHub plugin name: buildmaster-plugin
   - your personal GitHub ID : andrew-sumner
   - The existing GitHub repository: 
   https://github.com/andrew-sumner/buildmaster-plugin/



-- 
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/558a2382-baeb-45eb-afe3-50e1b86c0cda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.