chanti vlad edited a comment on Bug JENKINS-13230

I guess this relates to my request https://issues.jenkins-ci.org/browse/JENKINS-14340.
I see the need to resolve "natural" environment variables and parameters as more natural though since "Free style job" does it in a shell build step, and Publish Over SSH does not do it in "Send files or execute commands over SSH after the build runs".

Here is a easy job config.xml for reproducing the issue on 1.486 with publish over SSH 1.9:

<?xml version='1.0' encoding='UTF-8'?>
<project>
  <actions/>
  <description></description>
  <keepDependencies>false</keepDependencies>
  <properties>
    <hudson.model.ParametersDefinitionProperty>
      <parameterDefinitions>
        <hudson.model.StringParameterDefinition>
          <name>foo</name>
          <description></description>
          <defaultValue>i_am_foo</defaultValue>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>bar</name>
          <description></description>
          <defaultValue>i_am_bar</defaultValue>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>foobar</name>
          <description></description>
          <defaultValue>${foo}_${bar}</defaultValue>
        </hudson.model.StringParameterDefinition>
      </parameterDefinitions>
    </hudson.model.ParametersDefinitionProperty>
  </properties>
  <scm class="hudson.scm.NullSCM"/>
  <canRoam>true</canRoam>
  <disabled>false</disabled>
  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
  <triggers class="vector"/>
  <concurrentBuild>false</concurrentBuild>
  <builders>
    <hudson.tasks.Shell>
      <command>#!/bin/bash

echo
echo &quot;Build Step&quot;
echo &quot;we have foo=${foo}&quot;
echo &quot;we have bar=${bar}&quot;
echo &quot;we have foobar=${foobar}&quot;</command>
    </hudson.tasks.Shell>
  </builders>
  <publishers/>
  <buildWrappers>
    <jenkins.plugins.publish__over__ssh.BapSshPostBuildWrapper plugin="[email protected]">
      <postBuild>
        <consolePrefix>SSH: </consolePrefix>
        <delegate>
          <publishers>
            <jenkins.plugins.publish__over__ssh.BapSshPublisher>
              <configName>TempArtifacts_deployer</configName>
              <verbose>false</verbose>
              <transfers>
                <jenkins.plugins.publish__over__ssh.BapSshTransfer>
                  <remoteDirectory></remoteDirectory>
                  <sourceFiles></sourceFiles>
                  <excludes></excludes>
                  <removePrefix></removePrefix>
                  <remoteDirectorySDF>false</remoteDirectorySDF>
                  <flatten>false</flatten>
                  <cleanRemote>false</cleanRemote>
                  <noDefaultExcludes>false</noDefaultExcludes>
                  <makeEmptyDirs>false</makeEmptyDirs>
                  <execCommand>#!/bin/bash

echo
echo &quot;SSH deployer after the build runs&quot;
echo &quot;we have foo=${foo}&quot;
echo &quot;we have bar=${bar}&quot;
echo &quot;we have foobar=${foobar}&quot;</execCommand>
                  <execTimeout>120000</execTimeout>
                  <usePty>false</usePty>
                </jenkins.plugins.publish__over__ssh.BapSshTransfer>
              </transfers>
              <useWorkspaceInPromotion>false</useWorkspaceInPromotion>
              <usePromotionTimestamp>false</usePromotionTimestamp>
            </jenkins.plugins.publish__over__ssh.BapSshPublisher>
          </publishers>
          <continueOnError>false</continueOnError>
          <failOnError>false</failOnError>
          <alwaysPublishFromMaster>false</alwaysPublishFromMaster>
          <hostConfigurationAccess class="jenkins.plugins.publish_over_ssh.BapSshAlwaysRunPublisherPlugin" reference="../.."/>
        </delegate>
      </postBuild>
    </jenkins.plugins.publish__over__ssh.BapSshPostBuildWrapper>
  </buildWrappers>
</project>

The output of that job is

Building remotely on ******** in workspace /****************/PublishOverSSHTest
[PublishOverSSHTest] $ /bin/bash /tmp/hudson8155249335332678275.sh

Build Step
we have foo=i_am_foo
we have bar=i_am_bar
we have foobar=i_am_foo_i_am_bar
SSH: Connecting from host [********]
SSH: Connecting with configuration [********] ...
SSH: EXEC: STDOUT/STDERR from command [#!/bin/bash

echo
echo "SSH deployer after the build runs"
echo "we have foo=i_am_foo"
echo "we have bar=i_am_bar"
echo "we have foobar=${foo}_${bar}"] ...

SSH deployer after the build runs
we have foo=i_am_foo
we have bar=i_am_bar
we have foobar=_
SSH: EXEC: completed after 601 ms
SSH: Disconnecting configuration [********] ...
SSH: Transferred 0 file(s)
Notifying upstream projects of job completion
Finished: SUCCESS
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to