[ 
https://issues.jenkins-ci.org/browse/JENKINS-13230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=160793#comment-160793
 ] 

bap commented on JENKINS-13230:
-------------------------------

The following is the output (on a windows master, Jenkins 1.456) from a job 
that injects variables from "Prepare an environment for the run", "Build 
Environment" and from an "Inject environment variables" build step.
All of the variables are set using the "Properties Content" textarea.
The variables are all replaced when the "Exec command" is run after the 
variable has been injected.
When the command is run before the variable has been injected, the variable is 
not replaced, and can be seen in the command with the dollar sign in front.
This all looks exactly as expected. I can test in a linux environment in a week 
or so, but I have no reason to expect a different result.
Can you please test using the "Properties Content" textarea and check that the 
variables are replaced?

Started by user anonymous
[EnvInject] - Preparing an environment for the build.
[EnvInject] - Keep Jenkins system variables.
[EnvInject] - Keep Jenkins build variables.
[EnvInject] - Injecting as environment variables the properties content 
injectedFromPrepare=Injected from Prepare

[EnvInject] - Variables injected successfully.
[EnvInject] - Unset unresolved 'PROMPT' variable.
Building in workspace C:\Users\bap\jenkins\1.456\JENKINS_HOME\jobs\test inject 
ssh\workspace
SSH: Connecting from host [essien]
SSH: Connecting with configuration [localhost] ...
SSH: EXEC: STDOUT/STDERR from command [echo Before build Injected from Prepare 
&& echo Before build $injectedFromBuildEnv && echo Before build 
$injectedFromBuilder] ...
Before build Injected from Prepare 
Before build $injectedFromBuildEnv 
Before build $injectedFromBuilder
SSH: EXEC: completed after 200 ms
SSH: Disconnecting configuration [localhost] ...
SSH: Transferred 0 file(s)
[EnvInject] - Executing scripts and injecting environment variables after the 
SCM step.
[EnvInject] - Injecting as environment variables the properties content 
injectedFromBuildEnv=Injected from Build Environment

[EnvInject] - Variables injected successfully.
[EnvInject] - Unset unresolved 'PROMPT' variable.
SSH: Connecting from host [essien]
SSH: Connecting with configuration [localhost] ...
SSH: EXEC: STDOUT/STDERR from command [echo A build step before inject build 
step Injected from Prepare && echo A build step before inject build step 
Injected from Build Environment && echo A build step before inject build step 
$injectedFromBuilder] ...
A build step before inject build step Injected from Prepare 
A build step before inject build step Injected from Build Environment 
A build step before inject build step $injectedFromBuilder
SSH: EXEC: completed after 401 ms
SSH: Disconnecting configuration [localhost] ...
SSH: Transferred 0 file(s)
[EnvInject] - Injecting environment variables from a build step.
[EnvInject] - Injecting as environment variables the properties content 
injectedFromBuilder=Injected from Builder

[EnvInject] - Variables injected successfully.
[EnvInject] - Unset unresolved 'PROMPT' variable.
SSH: Connecting from host [essien]
SSH: Connecting with configuration [localhost] ...
SSH: EXEC: STDOUT/STDERR from command [echo A build step after inject build 
step Injected from Prepare && echo A build step after inject build step 
Injected from Build Environment && echo A build step after inject build step 
Injected from Builder] ...
A build step after inject build step Injected from Prepare 
A build step after inject build step Injected from Build Environment 
A build step after inject build step Injected from Builder
SSH: EXEC: completed after 201 ms
SSH: Disconnecting configuration [localhost] ...
SSH: Transferred 0 file(s)
SSH: Connecting from host [essien]
SSH: Connecting with configuration [localhost] ...
SSH: EXEC: STDOUT/STDERR from command [echo After build Injected from Prepare 
&& echo After build Injected from Build Environment && echo After build 
Injected from Builder] ...
After build Injected from Prepare 
After build Injected from Build Environment 
After build Injected from Builder
SSH: EXEC: completed after 200 ms
SSH: Disconnecting configuration [localhost] ...
SSH: Transferred 0 file(s)
SSH: Connecting from host [essien]
SSH: Connecting with configuration [localhost] ...
SSH: EXEC: STDOUT/STDERR from command [echo Publisher Injected from Prepare && 
echo Publisher Injected from Build Environment && echo Publisher Injected from 
Builder] ...
Publisher Injected from Prepare 
Publisher Injected from Build Environment 
Publisher Injected from Builder
SSH: EXEC: completed after 400 ms
SSH: Disconnecting configuration [localhost] ...
SSH: Transferred 0 file(s)
Finished: SUCCESS
                
> Not able to use Jenkins Environment Variables and variables injected through 
> Env Inject plugin when executing commands over ssh in Publish over SSH plugin
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JENKINS-13230
>                 URL: https://issues.jenkins-ci.org/browse/JENKINS-13230
>             Project: Jenkins
>          Issue Type: Bug
>          Components: publish-over-ssh
>    Affects Versions: current
>         Environment: RHEL 5.5
>            Reporter: suresh kukalakuntla
>            Assignee: bap
>
> I am trying to use Jenkins environment variables and variables injected 
> through Env Inject plugin in Execute section of 'Send build artifacts over 
> SSH'. It does not recognize them. It does recognize the build parameters and 
> replaces them with the values. When I look at the 'Injected environment 
> variables' I see all the variables I want to use. Not sure if I have to do 
> anything different to be able to use those variables.
> In Job configuration I checked 'Prepare an environment for the run' and 'Keep 
> Jenkins Environment Variables', 'Keep Jenkins Build Variables'.
> I have an 'Evaluated Groovy script' that sets 'MODULE_HOME' based on build 
> time parameter MODULE_NAME. 
> Please let me know how to proceed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to