cc.net dynamic parameters in publisher block - cruisecontrol.net

I am Using CC.Net to run an .exe file after project build is complete and need to pass the project name, publish date/time and user on the command line as parameters to the .exe. However I can't get cc.net to recognise these a dynamic properties and replace them with the correct values.
<publishers><exec executable="C:\MyApp.exe"></exec><buildArgs>"$[$CCNetProject]" "$[$CCNetBuildDate]" "$[$CCNetBuildTime]" "$[$CCNetUser]"</buildArgs><buildTimeoutSeconds>30</buildTimeoutSeconds></publishers>

The correct syntax for properties in ccnet config is $[CCNetProject]

I believe the correct syntax for properties in ccnet config is:
$[CCNetProject]
Rather than:
$[$CCNetProject]

Related

updatesystem does not consider config json

I am trying to perform system update from command line with a json config but it seems that, no matter what I do,
the command does the exact same thing, which I suppose is running the update with the default platform settings.
For example, when I tried to perform my update without essential data("essential": "false" in json config), essential impexes are also being run.
I tried with an invalid json(that does not have json format) and the build was successfull.
I also tried giving as a paramter a json that does not exist and yet, the build was successfull and essential impexes were also run.
So, it seems to me that, no matter what I do, the json is not taken into account and the update works with the default platform settings.
This is the command I am using:
ant updatesystem -Dtenant=master -DconfigFile=Path/updatesystem.json
Am I doing something wrong or how can I pass my configuration during system update from command line ?
PS:
Hybris version: 6.7.0.25
I Think your JSON path is wrong and please try to do it like this.
ant updatesystem -DconfigFile=../custom/testcore/resources/updatesystem-configuration.json
The problem was caused by the fact that the "updatesystem" macro was overriden in a project specific file and the configFile property was not passed to the UpdatePlatformAntPerformableImpl during creation. That is why, regardless of my input for configFile property , nothing changed.
I fixed the problem by also passing the configFile in the constructor:
new de.hybris.ant.taskdefs.UpdatePlatformAntPerformableImpl("${tenant}", "${configFile}")

How to create an example extension for Hybris 2011 version

I just download the latest 2011.1, and try to use "ant extgen" command to create a default extennsion, but meet following error:
Would anyone know how to deal with it?
extgen.xml:293: The following error occurred while executing this line:
extgen.xml:35: Source directory '${ext.develop.path}' for template 'training' does not exist.
Just run it again and it should work the second time.
There does seem to be a bug in the build scripts that has probably been there a while. I assume that ant extgen was the first thing you ran after unpacking. There is no config folder so the build script did this:
[input] No config folder was found at /path/to/hybris/config.
[input] Please choose the configuration template.
[input] Press [Enter] to use the default value ([develop], production)
and you chose develop
Unfortunately it stores your choice in a variable input.template which is the same name as used when later on the script asks you what extension template you want to base yours on. So the script sees that the variable already has a value and doesn't ask you:
[input] Please choose a template for generation.
[input] Press [Enter] to use the default value (commercewebservices, commercewebservicestests, yacceleratorfulfilmentprocess, yacceleratormarketplaceintegration, yacceleratorordermanagement, yacceleratorstorefront, yaddon, ybackoffice, ycommercewebservices, ycommercewebservicestest, ydocumentcart, [yempty], yhacext, yocc, yoccaddon, yocctests, ysapproductconfigaddon, ysmarteditmodule, yvoid, ywebservices)
It then tries to find a template extension develop and fails.
Running it the second time means your config folder is already generated and it correctly asks you which extension you want to base your extension on.

Append content from file using Email Ext Jenkins plugin

I have been modifying the default groovy template that the Email Ext plugin supplies.
Firstly, I had to modify the JUnitTestResult and need to format it accordingly to my need. I found in the it.JUnitTestResult, it is a reference to the ScriptContentBuildWrapper class. And then I was able to format the JUnitTestResult according to my need.
Now I am facing a second difficulty:
Along with those contents, I need to append more content from a file that resides in the job workspace. How to access the files that reside in the workspace directory.
I would be interested to know how I can access the build context object. Whats the java class name and things like that.
Just use build which returns an AbstractBuild
Try -
build.workspace
Which returns the FilePath of the directory where the build is being built.
See AbstractBuild.getWorkspace.
Tip: in Groovy, you can avoid the "get" and use field-like access notation.
Depending on which version of email-ext you are using, you can use the tokens provided to get access to things, so if you look at the token help, you'll see lots of tokens. These can be used in the groovy templates to do the same thing. For instance, the FILE token can be used in the Groovy by doing FILE(path: 'path/to/file') and it will replace with the contents of the file (only works on files that are below the workspace).
The build object is not available directly in all groovy scripts (e.g. groovy build script, groovy system build script, groovy post-build script, groovy script as evaluated in email-ext). The most portable way of obtaining build object in groovy script for a running build is:
import hudson.model.*
def build = Thread.currentThread().executable
Then you can get workspace and access files inside like this:
workspace = build.getEnvVars()["WORKSPACE"]
afilename = workspace + "/myfile"
afile = new File(afilename);
// afile.write "write new file"
// afile << "append to file"
// def lines = afile.readLines()

Building vcxproj by MSBuild including logging to default log file specified in project or inherited from props file

When Visual C++ builds (vcxproj) file form Visual Studio or you build it by means devenv (building sln), then you get log form the build of the vcxproj in file specified by item BuildLog.Path.
Default value of this item is $(IntDir)\$(MSBuildProjectName).log
I’ve actually find this feature really useful for post build analysis per project.
I’d like to simulate this behavior by building just from msbuild.exe.
There are serious build automation reasons why I cannot use devenv now(as far as I’m aware I cannot build vcxproj by devenv without sln).
I've tried to resolve this problem by:
creating custom target that determines value of BuildLog.Path and returns it back
and then execute task Exec with msbuild commandline including argument that use filelogger to create log file
Problem is that it does not work!
There is an interesting thing that the default is specified by:
<ItemDefinitionGroup>
<BuildLog>
<Path>$(IntDir)\$(MSBuildProjectName).log</Path>
</BuildLog>
</ItemDefinitionGroup>
If I understood correctly this specifies metadata path for each BuildLog item.
By default there is no BuildLog Item (because there is no Include in vcxproj –for BuildLog Item).
Does anybody has solution for this problem or can explain how to solve it?
determine BuildLog.Path metadata or
build vcxproj file just by msbuild with logging file to log file specified in vcxproj or inherited from props file

How do I use a start commit hook in TortoiseSVN to setup a custom log entry?

I'd like to automate TortoiseSVN as part of a commit process.
Specifically I'd like to dynamically create a log entry for the commit dialog.
I know that I can launch the commit dialog either from the commandline or by right clicking on a folder and selecting svncommit.
I'd like to use the start commit hook to setup a log entry.
I thought this worked by passing an entry file name in the MESSAGEFILE variable but when I add a hook script it cannot see this variable (hook launched successfully after right clicking and choosing svncommit).
When I try using the commandline I use the /logmsgfile parameter but it seems to have no effect.
I'm using tortoisesvn 1.5.3.
Looks like it was my own misunderstanding of the the API that caused by a problem.
Solution:
1) I've added a start commit hook script to TortoiseSVN using the hooks gui in the settings area of the right click menu.
2) The script receive 3 pieces of information: PATH MESSAGEFILE CWD
For details see: Manual
These are passed as command line arguements to the script - for some reason I had thought they were set as temporary environmental variables.
My script then simply opens the file specified by the second arguement and adds in the custom text.
When the commit dialog comes up the custom text is there.
3) Best of all if tortoisesvn is launched from a script directly into the commit dialog:
e.g. [ tortoiseproc /command:commit /path:. /closeonend:1 ]
The hooks are still called.
If you just need a static template, set the tsvn:logtemplate property.
For dynamic generation, the /logmsgfile parameter does work, but it seems to need the full path. A batch file that looks like the following might work for you.
GenerateLogMsg.exe > tmp.msg
"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /path:. /logmsgfile:"C:\Documents and Settings\User\My Documents\Visual Studio Projects\Project\tmp.msg"

Resources