Use the 'Environment Injector' plugin. It allows you to load variable
definition from a (Java .properties) file into the job environment.
Example:
--
First build step: Windows batch command:
echo foo=bar env.properties
Second build step: Inject environment variables:
Properties File Path: env.properties
--
So just have your PS script write the properties file.
On 11.03.2014, at 10:10, Kake nes...@gmail.com wrote:
Help...
kl. 08:56:38 UTC+1 fredag 28. februar 2014 skrev Kake følgende:
Hi
Using Jenkins to execute some scripts in a continuous integration task.
I have a job who copies some files to a folder, the name of the folder is
dynamically created. I wish to get the name of the folder.. back from my
script.
The script is executed using windows batch command, i.e.
set scriptpath=%SCRIPT_HOME%\stage.ps1
powershell.exe {%scriptpath% -SOURCEFOLDERNAME %SourceFolderName%
-SOURCEPATH %SourcePath% -TARGETHOST1 %TargetHost1% -TARGETHOST2
%TargetHost2%; exit $lastexitcode}
the ps script terminates using return $stagingFolderName
Have tried to set the dynamic FolderName as a Env variable but it's not
accessible after the ps1 is done..
#[Environment]::SetEnvironmentVariable(stagingFolderName,
$stagingFolderName, User)
#[Environment]::SetEnvironmentVariable(stagingFolderName,
$stagingFolderName, Process)
#[Environment]::SetEnvironmentVariable(stagingFolderName,
$stagingFolderName, Machine)
#$env:stagingFolderName = $stagingFolderName
Im unable to find a correct syntax or way to get the folderName..
feks. Pseudo: set myVar = powershell.exe {%scriptpath% -SOURCEFOLDERNAME
%SourceFolderName% -SOURCEPATH %SourcePath% -TARGETHOST1 %TargetHost1%
-TARGETHOST2 %TargetHost2%; exit $lastexitcode} -- Won't execute..
(Not using the powershell plugin for the missing error return)
--
You received this message because you are subscribed to the Google Groups
Jenkins Users group.
To unsubscribe from this group and stop receiving emails from it, send an
email to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
Jenkins Users group.
To unsubscribe from this group and stop receiving emails from it, send an email
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.