well i need to execute a batch file in my Hudson Job, I have a parameter(Jenkis parameter) and i need to pass this value like param to batch file, i tried this:
Deploy.cmd -configuration=${DEPLOYCONFIGURATION} -source=${DeploySource}
My Deploy.cmd is configurated for get this values but Jenkis doesn't assign the values.. For example, i have this:
${DEPLOYCONFIGURATION} = DEV
${DeploySource} = c:\myFolder
Then,the batch file take this values
%DEPLOYCONFIGURATION% = ${DEPLOYCONFIGURATION}
%DeploySource% = ${DeploySource}
Takes the parameter name not its value
The parameter is available as environment parameters. So e.g. a shell ($FOO, %FOO%) or Ant ( ${env. FOO} ) can access these values. This is not exactly a return value, but you can pass any parameter (with its value) to the downstream job with Parameterized Trigger Plugin.
Add the batch command as run. Click on Apply and save the configuration then, you will redirect to the Project Workspace. Click on the Build Now, it will execute the given batch command that executes the run. bat file. You can see the console results on the Console Output.
Use %DEPLOYCONFIGURATION%
instead of ${DEPLOYCONFIGURATION}
in windows batch command
Execute your Batch file as like the below
Deploy.cmd -configuration=%DEPLOYCONFIGURATION% -source=%DeploySource%
In case your Jenkins server run in unix/ Linux machine use "export" command to set environment variable for windows use "set" command like the below
For Windows:
set DEPLOYCONFIGURATION=DEV
set DeploySource=c:\myFolder
For Unix:
export DEPLOYCONFIGURATION = DEV
export DeploySource=c:\myFolder
Hope it might solve your issue.
Thanks, Madhan
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With