buildEnvVars not being called in plugin

42 views
Skip to first unread message

Joel Collins

unread,
Mar 6, 2015, 5:41:14 PM3/6/15
to jenkin...@googlegroups.com
Let me start off by saying i'm way way over my head here, and apologies if this is the wrong audience for this.


We're using jenkins with a custom built plugin, and that plugin recently broke after an upgrade to 1.591 / 1.601 (could have been before that, I hadn't upgraded beforehand in a few months)

THe plugin runs a script to get 1 value for a parameter, and based on the result of that script, a second drop down is populated.  The plugin in on github, and everything seems to work perfectly, the drop downs work fine and the first environment variable (read by the second script) is set correctly.  HOWEVER, when the build is run, only the first environment variable is visible to the build scripts, not the second.

I narrowed it down to this method not being executed

Keeping in mind that I can barely spell java, if anyone has recommendations on where to go from here i'd really appreciate it.

Oleg Nenashev

unread,
Mar 9, 2015, 12:15:20 PM3/9/15
to jenkin...@googlegroups.com
Hello Joel,

I would start from creating an issue in the bugtracker.
Since you report an issue for the build parameter, it really makes sense to provide a configuration of your job.
Variables injection may behave differently depending on job types and build steps.

Best regards,
Oleg Nenashev

суббота, 7 марта 2015 г., 1:41:14 UTC+3 пользователь Joel Collins написал:

Joel Collins

unread,
Mar 9, 2015, 1:12:21 PM3/9/15
to jenkin...@googlegroups.com
Thanks Oleg.  I can create an issue on the github repo for this, but I'm 99% sure i'm the only one in the world using this plugin.  (This was created by a contractor for our company)

I can post a sample config (I think?) but since it depends on external scripts its hard to encapsulate just in a job config xml.  

The logic of the plugin is thus:

Config:
Parameter 1 Name (Available to Param 2 external script as an environment variable)
Parameter 1 External Script (script to execute to generate values for parameter)
Parameter 2 Name
Parameter 2 External Script (updates using AJAX, script executes with the value of parameter 1 as a env variable)

So say script1.sh returns "foo" and "bar", that will be in the drop down for parameter 1.  When you select a value, it executes script2.sh with Value1="foo".  So say this script2.sh returns "bar" and "baz", this is what shows up in the dropdown for Value2.  This all works perfectly still.  The problem, is once you select "baz" in script 2, Value2=baz does not show up in the environment anymore for the build.  However, Value1=bar still works.


This is my job config file if it helps.  not really much to see though.

<?xml version='1.0' encoding='UTF-8'?>
<project>
  <actions/>
  <description></description>
  <keepDependencies>false</keepDependencies>
  <properties>
    <hudson.model.ParametersDefinitionProperty>
      <parameterDefinitions>
        <com.phase2technology.jenkins.RestrictedStringDynamicParameterDefinition plugin="restricted-parameter-list@1.0">
          <name>VALUE1</name>
          <description>TEST</description>
          <command>/var/lib/jenkins/test/printfoobar.sh</command>
          <dynamicName>VALUE2</dynamicName>
          <dynamicCommand>/var/lib/jenkins/test/printbarbaz.sh</dynamicCommand>
        </com.phase2technology.jenkins.RestrictedStringDynamicParameterDefinition>
      </parameterDefinitions>
    </hudson.model.ParametersDefinitionProperty>
  </properties>
  <scm class="hudson.scm.NullSCM"/>
  <canRoam>true</canRoam>
  <disabled>false</disabled>
  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
  <triggers/>
  <concurrentBuild>false</concurrentBuild>
  <builders>
    <hudson.tasks.Shell>
      <command>env</command>
    </hudson.tasks.Shell>
  </builders>
  <publishers/>
  <buildWrappers/>


--
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/K2FPULoM5EQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/084e4645-1b05-462a-bdd7-72ed5e343225%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Joel Collins

unread,
Mar 9, 2015, 5:42:07 PM3/9/15
to jenkin...@googlegroups.com
I think I figured it out, buildEnvVars is deprecated and no longer being called evidently.  buildEnvironment worked.  Thanks!

Jesse Glick

unread,
Mar 10, 2015, 6:49:20 PM3/10/15
to Jenkins Dev
On Mon, Mar 9, 2015 at 9:42 PM, Joel Collins <jcon...@gmail.com> wrote:
> buildEnvVars is deprecated and no longer being called evidently. buildEnvironment worked.

buildEnvVars may be deprecated, but it ought to still be called for
compatibility reasons, so if you see otherwise investigate and file a
bug/PR as needed.
Reply all
Reply to author
Forward
0 new messages