Cruisecontrol.net project settings with dynamic parameters - continuous-integration

I am trying to set up CruiseControl.NET (1.6.7981.1) so that each developer can choose which source-control branch to build from. I have encountered the following problems.
I have not found a way to set <artifactDirectory> and <workingDirectory> project parameters through dynamic parameters.
CruiseControl.NET is not replacing the dynamic parameter tokens, e.g. $[branchName] is not replaced in <artifactDirectory>C:/ci/$[branchName]<artifactDirectory>.
Is there a way to have a single project with multiple artifact and working directories chosen by end users?

No, you can not use dynamic parameters in <artifactDirectory> and <workingDirectory>. The documentation states:
Parameters can be used for tasks/publishers, source control blocks and labellers. [...]
Not all items allow the use of dynamic parameters.
If you are willing to relax on the single-project constraint, you could use the Configuration Preprocessor to define and apply a parameterized project template.

Related

How to add prefix in URI while loading XQuery file using ml-gradle

I am using gradle 6.8 and MarkLogic version is 10.0-5.2,
My XQuery code is in directory \ml-gradle\src\main\common. When I run the command mlLoadModules to load XQuery into the modules database it loads with default URI /common/test.xqy.
I want to add some prefix to the URIs e.g. /rsc/common/test.xqy. How can I achieve that?
Note: I don't want to create an extra folder in my source for prefix "rsc".
It's not supported, though you could write a custom Gradle task to change the URI to whatever you like.
Why do you not want to create an "rsc" folder above "common"? I think other developers would find it much more intuitive that "rsc/common/test.xqy" becomes "/rsc/common/test.xqy" when loaded, rather than "common/test.xqy" becomes "rsc/common/test.xqy", which begs the question - where is "rsc" coming from? And then that developer would need to understand what property / custom code is adding that "rsc".

How to plugin into grpc-java to modify code generation and add setNameOrClear(null) methods?

We are having too many issues around all this extra code for every database field with regard to
if(databaseObj.getName() != null)
builder.setName(databaseObj.getName());
and I read square wired into protobuf adding setOrClear methods in java. How do we do this when we generate as well using gradle?
We are using the gradle code from this page right now..
https://github.com/grpc/grpc-java
thanks,
Dean
You can accomplish that via protoc_insertion_points. When you generate the Java code you will see comments like // ##protoc_insertion_point(...). That is where the insertion will occur.
While appearing useful, this approach has serious drawbacks for .protos used in multiple projects. All projects using the same .proto and in the same language should use the same plugins, otherwise it causes the diamond dependency problem. This is why gRPC did not use this approach and instead generates its classes in separate files from the normal message generation. I strongly discourage against this approach, as it paints you into a corner and you don't know when you will need to "pay the piper."
To insert into a point, your plugin needs to run in the same protoc command-line invocation as the java builtin. Your plugin would then need to set CodeGeneratorResponse.file.insertion_point and content for each file you want to inject code.

Team City 7.1 Configuration Parameters across Build Configurations

I would like to define a variable on a TC configuration and would like to get its value on a different TC configuration that has a trigger dependency on the first one.
Is it possible to do this?
If both configurations are in the same project, you can define a build configuration template that contains the shared parameter (i.e. variable). Both active configurations must then reference that template -- use the 'Associate with Template' action to accomplish this. The value of the shared parameter must be set in the template in order for the same value to be known to both configurations.
If you're trying to share build numbers (or other system-level parameters) between the configurations, there is a special method for that.
I have to use something like this to actually dynamically change the configuration parameters.
Invoke-WebRequest -Uri "http://build/guestAuth/action.html?add2Queue=bt876&name=env&value=test&name=env.number&value=%target.env.number%" -Method "Get" -Verbose

Access to TeamCity build comments

A continuation on the answer to this question:
Is it possible to add a free text note to a team city build?
In TeamCity custom build dialog there is a field for "Build comments".
Is there a way to access this from within the build?
Either as a system property or environment variable?
As far as I know, the Build Comments are not exposed or accessible from your build script, however you can create custom build parameters that are accessible. You can create system properties or environment variables, either of which can be accessed in your build script. See the TeamCity docs on custom parameters for full details.
Maybe this question is outdated, but I'll answer just in case somebody else is interested.
Comments can be retrieved using TeamCity REST API:
http://teamcity.codebetter.com/guestAuth/app/rest/changes?locator=build:id:216886&fields=change(id,version,href,username,date,webUrl,comment)
If you need it from C# project, you may consider using FluentTc library:
IBuild build = new RemoteTc()
.Connect(_ => _.ToHost("teamcity.codebetter.com").AsGuest())
.GetLastBuild(
having => having.Id(216886),
with => with.IncludeChanges(and => and.IncludeComment()));
One way of achieving it is as follows:
http://[host]:[port]/httpAuth/app/rest/builds/id:<internal build id>
This will return xml with build Parameters, comments will be one of child nodes.

Sonar - Can we use for OSB/BPEL code review?

I am new to sonar,just heard about this tool.
Can we use this tool to perform code review for FMW(Fusion Middleware) -OSB(Oracle Service Bus)/BPEL project ?
If so can anyone give some inputs on this?
The official plugin-List : http://docs.codehaus.org/display/SONAR/Sonar+Plugin+Library/ does not mention support for your tools.
But sonar can be extended with custom plugins, so you may be able to write your own plugins to provide metrics for your tools.
What level of review you want to cover? It is really easy to make your own review tool for BPEL. All BPEL resources are XML files. For example if you want to check for naming convetion of BPEL activities, you can define a simple XPath based rule.
Ex:
//sequence/#name ~= "^sequence.*".
A Java program can use the above XPath to pull-out all sequence names from the xxxx.bpel file and compare it against a regular expression. Similar rules can be created for checking WSDL usage, partner links, end-point addresses, usage of Error handling etc.

Resources