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

suresh kukalakuntla commented on JENKINS-13230:
-----------------------------------------------

I tested by setting variables using the "Properties Content" textarea. It did 
not work for me. I am using Jenkins 1.456 on a RHEL Linux machine.

You can see from below that MODULE_TEST and DEPLOY_DIRECTORY are injected 
during build time but not replaced during promotion.

Build Log:

Started by user anonymous
[EnvInject] - Preparing an environment for the build.
[EnvInject] - Keep Jenkins system variables.
[EnvInject] - Keep Jenkins build variables.
[EnvInject] - Evaluation the following Groovy script content: 
if (MODULE_NAME==null){ return null; }

if ("ACCT".equals(MODULE_NAME)){ def map = [MODULE_HOME: "SSP-AM"] ; return map 
}
if ("ATTCH".equals(MODULE_NAME)){ def map = [MODULE_HOME: "Attachments"] ; 
return map }
if ("CCM".equals(MODULE_NAME)){ def map = [MODULE_HOME: "SSP-CCM"] ; return map 
}
if ("DNG".equals(MODULE_NAME)){ def map = [MODULE_HOME: "SSP-DNG"] ; return map 
}
if ("DR".equals(MODULE_NAME)){ def map = [MODULE_HOME: "SSP-DR"] ; return map }
if ("FPD".equals(MODULE_NAME)){ def map = [MODULE_HOME: "SSP-FPD"] ; return map 
}
if ("FPD_PRINT".equals(MODULE_NAME)){ def map = [MODULE_HOME: "SSP-FPD"] ; 
return map }
if ("RDM".equals(MODULE_NAME)){ def map = [MODULE_HOME: "SSP-RDM"] ; return map 
}
if ("REPORTS".equals(MODULE_NAME)){ def map = [MODULE_HOME: "SSP-Reports"] ; 
return map }
if ("UMS".equals(MODULE_NAME)){ def map = [MODULE_HOME: "SSP-UMS"] ; return map 
}
if ("WARRANT".equals(MODULE_NAME)){ def map = [MODULE_HOME: "SSP-Warrant"] ; 
return map }

Building in workspace /usr/AutomatedBuilds/SSP-AM
[EnvInject] - Executing scripts and injecting environment variables after the 
SCM step.
[EnvInject] - Injecting as environment variables the properties content 
MODULE_TEST=SSP-AM
DEPLOY_DIRECTORY=/usr/J2EE/CAS/deployment

[EnvInject] - Variables injected successfully.
[SSP-AM] $ /bin/bash /tmp/hudson27958.sh
MODULE_NAME: ACCT
SVN_REVISION: HEAD
BUILD_TYPE: DB_SCRIPTS
DBCHANGELOG_FILES: dbchangelog-0-sspbl-0000.xml

Archiving artifacts
Finished: SUCCESS


Promotion Log:

build 
BapSshPromotionPublisherPlugin[delegate=BapSshPublisherPlugin[consolePrefix=SSH:
 ,delegate=BPInstanceConfig[publishers=[BapSshPublisher[configName=DEV 
BIG-IP,verbose=false,transfers=[BapSshTransfer[sourceFiles=scripts/Environments/SSPDEV/**,excludes=**/*_jdbc.properties,removePrefix=scripts/Environments/,remoteDirectory=,remoteDirectorySDF=false,flatten=false,cleanRemote=false,execCommand=chmod
 755 SSPDEV -R
./bigip_jenkins_predeployment.sh SSPDEV/sspdev_module_pools.meta 10.0.90.36 
$MODULE_NAME,execTimeout=120000,pseudoTty=false]],useWorkspaceInPromotion=false,usePromotionTimestamp=true,retry=<null>,label=<null>,credentials=<null>]],continueOnError=false,failOnError=true,masterNodeName=<null>,alwaysPublishFromMaster=false,paramPublish=<null>]]]
 SUCCESS
SSH: Connecting from host [SSP-DEV-BUILDS.gce2000.com]
SSH: Connecting with configuration [SSP Dev Appserver] ...
SSH: EXEC: STDOUT/STDERR from command [echo "MODULE_TEST:$MODULE_TEST"
echo "DEPLOY_DIRECTORY:$DEPLOY_DIRECTORY"

cd /J2EE/CAS/deploy/ACCT
chmod 775 scripts source Distribution -R
sudo -u appsuser -i /J2EE/CAS/deploy/ACCT/scripts/jenkins_deploy.sh ACCT 
DB_SCRIPTS SSP dbchangelog-0-sspbl-0000.xml] ...
MODULE_TEST:
DEPLOY_DIRECTORY:

SSH: Disconnecting configuration [SSP Dev Appserver] ...
SSH: Transferred 3 file(s)
build 
BapSshPromotionPublisherPlugin[delegate=BapSshPublisherPlugin[consolePrefix=SSH:
 ,delegate=BPInstanceConfig[publishers=[BapSshPublisher[configName=SSP Dev 
Appserver,verbose=false,transfers=[BapSshTransfer[sourceFiles=Distribution/BizServices/applications/*.ear,
 scripts/jenkins_deploy.sh, scripts/Environments/SSPDEV/*, 
source/db/**/*,excludes=,removePrefix=,remoteDirectory=$MODULE_NAME,remoteDirectorySDF=false,flatten=false,cleanRemote=false,execCommand=echo
 "MODULE_TEST:$MODULE_TEST"
echo "DEPLOY_DIRECTORY:$DEPLOY_DIRECTORY"

cd /J2EE/CAS/deploy/$MODULE_NAME
chmod 775 scripts source Distribution -R
sudo -u appsuser -i /J2EE/CAS/deploy/$MODULE_NAME/scripts/jenkins_deploy.sh 
$MODULE_NAME $BUILD_TYPE SSP 
$DBCHANGELOG_FILES,execTimeout=240000,pseudoTty=true]],useWorkspaceInPromotion=false,usePromotionTimestamp=true,retry=<null>,label=<null>,credentials=<null>]],continueOnError=false,failOnError=true,masterNodeName=<null>,alwaysPublishFromMaster=false,paramPublish=<null>]]]
 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