Giter VIP home page Giter VIP logo

sb-jenkins-dynamicparameter's Introduction

sb-jenkins-dynamicparameter's People

Contributors

bjkastel avatar chbaranowski avatar javamllama avatar ndeloof avatar rainerw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sb-jenkins-dynamicparameter's Issues

Disabled UI elements for parameters

Hi, I'd like to be able to set certain parameters as disabled in the UI -- that is, when you go to trigger the build, you can see what the Groovy script has inserted into a field, but the form elements are disabled.

(Yes, this could be worked around with a simple Greasemonkey script, but the convenience of not accidentally changing a parameter is good enough for my purposes.)

Unable to use Scriptler script as source when the script result is not stable

com.seitenbau.jenkins.plugins.dynamicparameter.scriptler:ScriptlerChoiceParameterDefinition : checkParameterValue(StringParameterValue parameter)

Does call getChoices() -> this invokes the script again!

In case the script does not return a fixed value, e.g. a next project-version Number, or the current time, this will fail.

SHOULD

checkParameterValue() should verify the parameters against the parameters displayed to the users, and should not call the groovy code again.

Please add the ability to multi-select

The ability to multi-select parameters is critical for most non-trivial applications of a choice list. In my work I use Jenkins to submit statistical R scripts for execution and I need to be able to submit more than one choices to correctly parameterize the R script. THANK YOU this a great plugin and I'm closely following its evolution.

setupLocalClassPaths should expand to *.jar files

great plugin, thank you!

but, the following invocation:

ScriptParameterDefinition.setupLocalClassPaths(....

which is ultimately used by

JenkinsUtils.execute(...
      config.setClasspathList(classPathList);
      GroovyShell groovyShell = new GroovyShell(config);
      Object evaluate = groovyShell.evaluate(script);

currently supplies list of directories, such as

/var/lib/jenkins/dynamic_parameter/classpath/library-one/
/var/lib/jenkins/dynamic_parameter/classpath/library-two/

GroovyShell can not use these folders; they need to be expanded to actual jars, such as:

/var/lib/jenkins/dynamic_parameter/classpath/library-one/file-10.jar
/var/lib/jenkins/dynamic_parameter/classpath/library-one/file-11.jar
/var/lib/jenkins/dynamic_parameter/classpath/library-two/file-20.jar
/var/lib/jenkins/dynamic_parameter/classpath/library-two/file-21.jar

Some files not found

I have a general problem. I am not able to use any dynamic choice parameter with the current build.

"Dynamic Choice Parameter"

Choice script:

import jenkins.model.Jenkins
import hudson.model.AbstractProject
import hudson.model.Result
import hudson.util.RunList

AbstractProject otherJob = Jenkins.getInstance().getItemByFullName("JOBNAME", AbstractProject.class)
RunList<?> builds = otherJob.getBuilds().overThresholdOnly(Result.SUCCESS)

def list = builds.limit(10).collect { it.number }

Stack trace

javax.servlet.ServletException: org.apache.commons.jelly.JellyTagException: jar:file:/D:/Jenkins/plugins/dynamicparameter/WEB-INF/lib/classes.jar!/com/seitenbau/jenkins/plugins/dynamicparameter/ChoiceParameterDefinition/index.jelly:35:64: st:include No page found '../commons/selectContent.jelly' for class com.seitenbau.jenkins.plugins.dynamicparameter.ChoiceParameterDefinition
at org.kohsuke.stapler.jelly.JellyRequestDispatcher.forward(JellyRequestDispatcher.java:60)
at hudson.model.AbstractProject.doBuild(AbstractProject.java:1828)
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.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:297)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:160)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:95)
at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:111)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:685)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:799)
at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:239)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:685)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:799)
at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:239)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:685)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:799)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:587)
at org.kohsuke.stapler.Stapler.service(Stapler.java:218)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:45)
at winstone.ServletConfiguration.execute(ServletConfiguration.java:248)
at winstone.RequestDispatcher.forward(RequestDispatcher.java:333)
at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:376)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:96)
at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:58)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:99)
at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:88)
at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48)
at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:174)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at jenkins.security.ApiTokenFilter.doFilter(ApiTokenFilter.java:64)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:46)
at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
at winstone.RequestDispatcher.forward(RequestDispatcher.java:331)
at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:227)
at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.commons.jelly.JellyTagException: jar:file:/D:/Jenkins/plugins/dynamicparameter/WEB-INF/lib/classes.jar!/com/seitenbau/jenkins/plugins/dynamicparameter/ChoiceParameterDefinition/index.jelly:35:64: st:include No page found '../commons/selectContent.jelly' for class com.seitenbau.jenkins.plugins.dynamicparameter.ChoiceParameterDefinition
at org.kohsuke.stapler.jelly.IncludeTag.doTag(IncludeTag.java:124)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.apache.commons.jelly.tags.core.CoreTagLibrary$1.run(CoreTagLibrary.java:98)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.apache.commons.jelly.tags.core.CoreTagLibrary$1.run(CoreTagLibrary.java:98)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:98)
at org.apache.commons.jelly.tags.define.InvokeBodyTag.doTag(InvokeBodyTag.java:91)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
at org.kohsuke.stapler.jelly.CallTagLibScript.run(CallTagLibScript.java:119)
at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:81)
at org.kohsuke.stapler.jelly.IncludeTag.doTag(IncludeTag.java:146)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
at org.apache.commons.jelly.tags.core.ForEachTag.doTag(ForEachTag.java:150)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:98)
at org.apache.commons.jelly.tags.define.InvokeBodyTag.doTag(InvokeBodyTag.java:91)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
at org.kohsuke.stapler.jelly.CallTagLibScript.run(CallTagLibScript.java:119)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:98)
at org.apache.commons.jelly.tags.define.InvokeBodyTag.doTag(InvokeBodyTag.java:91)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.apache.commons.jelly.tags.core.CoreTagLibrary$1.run(CoreTagLibrary.java:98)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
at org.kohsuke.stapler.jelly.CallTagLibScript.run(CallTagLibScript.java:119)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:98)
at org.apache.commons.jelly.tags.define.InvokeBodyTag.doTag(InvokeBodyTag.java:91)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
at org.kohsuke.stapler.jelly.CallTagLibScript.run(CallTagLibScript.java:119)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:81)
at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:63)
at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:53)
at org.kohsuke.stapler.jelly.JellyRequestDispatcher.forward(JellyRequestDispatcher.java:55)
... 73 more

Move the scriptler to another sub plugin

It would be interesting to separate the scriptler dependency to another plugin so that if we don't need to use scriptler that it doesn't bring all of it along with it...

Child parameter not updated if parent is a Run Parameter

I have tried to cascade from a a parent Run Parameter list but the child is not updated correctly. It appears that the parent run parameter passed into the script is null and so the script responsible for updating the children choice list fails.

Issues adding custom ClassPath

Hi there,

I'm trying to build a dynamic parameter that fetches an AMI ID based on tags from our AWS account but I'm having some trouble adding a custom classpath. The classpath I'm trying to add is:

/opt/aws-sdk/*

The directory above contains a numer of jar files, most of which are dependencies for the AWS SDK. This is being executed on the Jenkins master.

My test dynamic parameter script looks like this:

import com.amazonaws.auth.EnvironmentVariableCredentialsProvider
import com.amazonaws.services.ec2.model.*
import com.amazonaws.services.ec2.

sleep(30000)
return "hello world."

By commenting out the import statements, the sleep statement is executed and "hello world" appears in the build parameter text box. With the imports left uncommented, the sleep statement is not executed and the build parameter text box appears empty. This is how I'm able to tell the imports are failing. I'm not seeing any logs from the plugin appearing in Jenkins.

The script that I need executed by the plugin is:

import com.amazonaws.auth.EnvironmentVariableCredentialsProvider
import com.amazonaws.services.ec2.model.*
import com.amazonaws.services.ec2.*

// Create EC2 Client Object.
def ec2 = new AmazonEC2Client(new EnvironmentVariableCredentialsProvider())

// Fetch AMI ID.
try {
  ami = ec2.describeImages(new DescribeImagesRequest().withFilters(new Filter("tag:TAGNAME",["TAGVALUE"]))).getImages()
  println ami[0].imageId
} catch (e) {
  println "Something went wrong."
  println e
}

I'm able to successfully execute this script locally by running:

groovy -cp $CLASSPATH:/opt/jars/* -d ami_lookup.groovy

What am I doing wrong?
What is the exact format I should be using for the classpath input?
Where exactly should the logs from this plugin appear?

Is there anywhere I can find/see the output of the groovyShell call?
https://github.com/Seitenbau/sb-jenkins-dynamicparameter/blob/master/src/main/java/com/seitenbau/jenkins/plugins/dynamicparameter/util/JenkinsUtils.java#L124

Any insight or help would be greatly appreciated. Thanks!

Support for Jenkins CLI parameters submission

Currently on Jenkins 1.471 / plugin 0.1.1 ,when trying to run build ( which is using Dynamic Choice Parameter ) from Jenkins CLI, build finishes with error :

"CLI parameter submission is not supported for the class com.seitenbau.jenkins.plugins.dynamicparameter.ChoiceParameterDefinition type. Please file a bug report for this"

It would be great to have such possibility.
Thanks.

Can't use slow bash commands

I want to use a bash script to generate parameter list. Commands that work fast, such as "ls /tmp" work just fine. However, if it takes some time (in my case it's ec2-api tools, about 2 seconds), then I get no parameters at all. I tried "proc.waitFor()", but it doesn't seem to have any effect.

Two level cascading parameters do not work

It appears that if the parent of a cascading parameter is another cascading parameter the two level cascade fails. It seems that the parent value is not propagated and is null.

Update Plugin 0.1.1 to 0.2.0 Remote Option is not set in Model

After a update from version 0.1.1 to version 0.2.0 the evaluation of the groovy script to get the parameter values is invoked on the master and not on the build salve.

Workaround:
The problem can be fixed when the jenkins project is saved. Then the default value for the option "Remote Script" is stored in the project configuration.

Solution:
Option "Remote Script" should be replaced with a option namend run on master which is by default false and not true.

cascadingchoice.js assumes Jenkins is the root URL

I run Jenkins in tomcat under the /jenkins URL space. When trying to use cascading choice parameters in a job, I get a 404 error when I click the "Build Now" link for that job.

The 404 error message shows that the path being accessed is "/plugin/dynamicparameter/getParameterValues".

I can see that value is hard-coded into cascadingchoice.js. Perhaps it needs to find the root URL dynamically?

Dynamic select between multiple 'Cascading Dynamic Choice Parameter'

Is it possible for one Cascading Dynamic Choice Parameter to output values based on values in another Cascading Dynamic Choice Parameter ?

For example:
Cascading Dynamic Choice Parameter #1 values: a,b,c,d
Cascading Dynamic Choice Parameter #2 values: Get values from #1, if a=>g,if b=>g, c=>x, etc

In other words:
Is Cascading Dynamic Choice Parameter able to extract values from another Cascading Dynamic Choice Parameter ? or only from simple 'Choice' parameter. ?

This might be a Groovy question. How can write a Groovy script in one Cascading Dynamic Choice Parameter that will get the values from another Cascading Dynamic Choice Parameter (that also has Groovy script and outputs a list).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.