Set environment variable in Cruisecontrol

How to set environment variable in Cruisecontrol?

If I try to do it like this:

<exec command="set PATH=" workingdir="d:\AppLiteNew\Projects\" args = "%PATH%;D:\QtSDK\mingw\bin\"/> 

it does not work, all i have is:

[cc] Dec-13 13:30:28 ExecBuilder - Failed to execute the command: set PATH = with arguments:% PATH%; D: \ QtSDK \ mingw \ bin \

+4
source share
2 answers

Firstly, you are using the wrong exec command

The set command, and its argument must be PATH=%PATH%;D:\QtSDK\mingw\bin\

This should work:

 <exec command="set" workingdir="d:\AppLiteNew\Projects\" args = "PATH=%PATH%;D:\QtSDK\mingw\bin\"/> 

Secondly, it will have no effect

The path you set will only be accessible to the shell / command executed when exec is called. After the call, he will not be available for further teams / performances.
You did not indicate which use case you have or where you need the variable, so I can only guess what you could do. You can do the following:

  • Set the path directly in Windows, for everything (if that's ok)
  • Edit the batch file that launches cruisecontrol and sets the PATH there
  • Create a batch file for the command that needs PATH and set PATH there.
  • Some ant -tasks allow you to specify environment variables for them.
+7
source

In CruiseControl.net you can set them in the task configuration. They enter the environment block:

 <environment> <variable name="MyVar2" value="Var2Value" /> </environment> 

Here is the full sample:

 <msbuild> <executable>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe</executable> <workingDirectory>C:\dev\ccnet</workingDirectory> <projectFile>CCNet.sln</projectFile> <buildArgs>/p:Configuration=Debug /v:diag</buildArgs> <targets>Build;Test</targets> <timeout>900</timeout> <logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger> <environment> <variable name="MyVar2" value="Var2Value" /> </environment> </msbuild> 
+1
source

Source: https://habr.com/ru/post/1386088/


All Articles