[JIRA] (JENKINS-39638) Not possible to use environment variable as project key

1 view
Skip to first unread message

mjgarridos@jccm.es (JIRA)

unread,
Nov 10, 2016, 4:03:05 AM11/10/16
to jenkinsc...@googlegroups.com
Manuel J. Garrido created an issue
 
Jenkins / Improvement JENKINS-39638
Not possible to use environment variable as project key
Issue Type: Improvement Improvement
Assignee: Ivana Sh
Components: quality-gates-plugin
Created: 2016/Nov/10 9:02 AM
Environment: Jenkins 2.19.2
Quality Gates Plugin 2.5
Priority: Minor Minor
Reporter: Manuel J. Garrido

It's not possible to use an environment variable as the project key. If you try to do it I, the following exception is shown when saving the project configuration:

javax.servlet.ServletException: quality.gates.jenkins.plugin.QGException: Environment variable with name 'ROJECT_KE' does not exist.
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:796)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:206)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
..........

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

konstantin.welke@citrix.com (JIRA)

unread,
Nov 28, 2016, 8:59:06 AM11/28/16
to jenkinsc...@googlegroups.com
Konstantin Welke commented on Improvement JENKINS-39638
 
Re: Not possible to use environment variable as project key

This is very easy to fix - just delete the code related to checking whether that variable exists at job configuration saving time (as opposed to "at job exeuction time").

https://github.com/jenkinsci/quality-gates-plugin/blob/master/QualityGatesPlugin/src/main/java/quality/gates/jenkins/plugin/JobConfigurationService.java#L25

Note that you can generate jobs using job-dsl that have a variable as PROJECT_KEY and the jobs will work as expected - it's just that the project configuration can no longer be saved due to this exception.

Also note that the source code doesn't deal with variables correct in most of the cases - only the most simple case is considered (where PROJECT_KEY is exactly one variable). This does not strictly relate to this bug should be fixed nevertheless

https://github.com/jenkinsci/quality-gates-plugin/blob/master/QualityGatesPlugin/src/main/java/quality/gates/jenkins/plugin/JobConfigurationService.java#L70

Reply all
Reply to author
Forward
0 new messages