TeamBuild, Code Coverage & testrun config files - tfs

I have team build script for CI and nightly builds, both of which runs unit tests with code coverage. I have specified the testrun config file and this include paths for the assemblies to instrument.
My problem is, the paths for the assemblies is absolute, eg:
<CodeCoverageItem
binaryFile="C:\build\Product\PROJECT\Integration\Binaries\Debug\BlahBlah.Cache.dll"
pdbFile="C:\build\Product\PROJECT\Integration\Binaries\Debug\BlahBlah.Cache.pdb"
instrumentInPlace="true" />
I would rather these used relative paths or I could specify $(OutDir) in there.
Has anyone solved this?
Thanks

Yes, you should be able to use relative paths - paths that are relative to the LocalTestRun.testrunconfig file (which is typically stored in the same folder as the solution file).

Related

How does TFS determine what directory to use for the output from a build?

I'm setting up some TFS build definitions. I see that once I run a build, the work is done within a subfolder of a subdirectory of /Agent/_work. It appears that the subfolder is the same between different executions of the same build definition, but I see no way to know in advance where I should expect TFS to set its working directory, nor do I see any way of specifying the name of the directory manually.
How does TFS determine what directory to use for the output from a build?
Refer to the documentation on build variables. The base folder can be accessed via the $(Agent.BuildDirectory) variable. The source folder is $(Build.SourcesDirectory).
You can't set this. It's determined by the agent's configuration.

How can I tell Which bazel aspect outputs are still relevant

As part of our efforts to create a bazel-maven transition interop tool (that creates maven sized jars from more granular sized bazel jars),
we have written an aspect that runs on bazel build of the entire bazel repo and writes important information to txt files outputs (e.g.: jar file paths, compile deps targets and runtime deps targets, etc.)
We ran across an issue where the repo's code was changed such that some of the txt file were not written anymore. But the old txt file from previous runs (before the code change) remained!
Is there a way to know that these txt files are no longer relevant?
You should be able to run with --build_event_json_file=file.json and try to locate generated artifacts. For example we use it on ci.bazel.io to locate actual test.xml file that were generated: https://github.com/bazelbuild/continuous-integration/blob/09975cbb487a84a62ca1e43aa43e7c6fe078f058/jenkins/lib/src/build/bazel/ci/BazelUtils.groovy#L218
The definition of the protocol can be found in build_event_stream.proto

Excluding contents of a folder anywhere in directory tree from analysis in Sonar

I have a ASP.net project that i need to run SonarQube analysis on and i have configured it with Jenkins to run the analysis. The analysis is running fine but it is including the bower_components and node_modules i have in the project. The way the project is structured there are multiple node_modules and bower_component folders in the projects folder structure. So i need to exclude them all in a pattern. I have added a SonarQubeSetting section to the .csproj file and i have the current values for exclusion.
<Target Name="BeforeBuild">
<ItemGroup>
<SonarQubeSetting Include="sonar.exclusions">
<Value>**\main-built.js,**\template-build.js,**\kendo*.js,**\bower_components\*,**\node_modules\*</Value>
</SonarQubeSetting>
</ItemGroup>
</Target>
Using **\bower_components\* **\node_modules\* did not work and the libraries are still picked up and scanned. How can i exclude folder (in my case node_modules & bower_components) content regardless of its location in the directory structure in sonar?
The last time I setup Sonar, I am pretty sure the sonar.exclusion property worked as expected... Perhaps your naming pattern is a little off. For example, how about a ** at the end rather than *. See this answer for examples and answers when using naming patterns.

How to include config transform files in web application filesystem publish output

I've been pulling my hair out on this for a while now. I'm trying to implement a continuous integration and deployment pipeline using TeamCity and Octopus Deploy. I am 99% there, except for one problem. I am using the standard msbuild runner of teamcity, configured to use the version 12 of msbuild.
I need to include the web.config transforms in the published output so they can be packaged into a nuget package for octopus deploy. I do not want the transforms to be applied by msbuild.
I am not using Octopack to create packages. I'm using the built-in teamcity nuget packager. So I'm publishing the website to a filesystem folder and then creating the package from the files in this folder. However, no matter what I do I cannot get msbuild to include the web.config transform files in the publish (I am using Octopus Deploy to perform the transforms, so I don't want msbuild to perform them).
I have verified that all the transform files (Web.Release.config, etc..) are marked as "Content". I have NOT marked them to copy always, because doing this copies them to the bin folder, not the root folder where they belong.
I have removed the /p:Configuration= property from the msbuild command line as I've read that is required for transforms to be applied. my parameters to msbuild look like this:
/p:DeployOnBuild=true /p:PublishProfile=Deployment
There is nothing in the publish profile that seems to relate to transforms. The publish profile contains the filesystem location to publish to.
Any suggestions here?
Note: I've given up and found a different solution, but I'm leaving this open in case anyone has any input.
You could create a custom .nuspec file and reference the files that you want to include from there.
My suggestion would be to have the .nuspec file in the same directory as the web.config / web.release.config files, and make the paths relative from there.
So if you publish to a directory called /output you could use rules like this
<files>
<file src="*.config" target="\" />
<file src="publish\*.*" target="\" />
</files>
So nuget pack nuspecPath would become the way to pack the project
NuSpec Reference
Hope this helps

Sonar tests and binaries properties, what do they do?

In Sonar documentation there are two properties options, the sonar.tests and sonar.binaries.
# path to test source directories (optional)
sonar.tests=testDir1,testDir2
# path to project binaries (optional), for example directory of Java bytecode
sonar.binaries=binDir
Questions:
If sonar.tests and sonar.binaries are added to my Ant target, how do they show up in Sonar? What would be different in Sonar if I did/did not set these properties?
Should sonar.binaries contain both source binaries and test binaries, or only source?
Can .jar files be given to both properties instead of path to actual .class files and/or .java files?
Answers:
If you do not set those 2 properties, you won't have test results ("sonar.tests") nor violations detected by Findbugs or bytecode-based tools ("sonar.binaries").
"sonar.binaries" should contain only compiled sources, not tests
No. Only "sonar.libraries" can (and actually must) point to JAR files.

Resources