I have 4 teamcity build configuration like this
build, test, static analysis is parallel, sonar wait 3 steps finish and use test results and analysis results for create sonar report.
build ------------|
test -------------|
static analysis --|
|----- Sonar report
I want use test step results (.exec file for coverage) for sonar step, as I understand, i need use artifact dependencies for this, BUT test step create a many files in build directories like this
/{moduleName}/build/jacoco/*.exec
i have >100 modules
how i can setup artifact dependencies for files transfer to next step without change directory like this -
(source dirs) (target dirs)
**/build/jacoco/*/*.exec => **/build/jacoco/*/*.exec
i can't write this paths in manual
UPD: QUESTION RESOLVED
if use pattern in artifact publish like +:**/build/jacoco/*/*.exec (without target), all artifacts save position in directory tree
Related
What is the set up required to move files between builds in TC? I am needing to move both modified source files and build binaries between the build configurations of a build chain.
I have 1 project with 4 builds. The builds are
Update Version Number (This build updates 15 sources files)
Compile (This build compiles a dozen objects)
Test (This build runs a regression test)
Create Package (This build creates a setup.exe file)
Information about the TC setup and chain
I am using perforce as my VCS.
All 4 builds use the same VCS root.
On all 4 builds under version control settings I have "Clean all files before build" set to "On".
"Update Version Number" build is triggered by any check in to the VCS. (This works)
I have been able to successfully chain and trigger the builds. However each build starts with a fresh copy of files from the VCS.
The chaining is set up to use snapshot dependency.
Based off of the TC documentation it looks like I should be using snapshot dependency and not artifact dependency. If I put the build steps of all the builds into the same build everything works. However we are looking to have more flexibly and expand on this build chain in the future.
I tried setting up the configuration so only the first build is attached to the VCS root and the other builds don't have any VCS root. This didn't work.
I have been unable to find the answer googling but I have been able to find someone else who is struggling with this problem. Sadly they didn't receive an answer.
After speaking with TC customer support I learned the correct technique is to use both artifact dependency with "build from the same chain" selected and snapshot dependency.
For example, project A generates two artifacts processor.exe and t.txt. Then in project B, can I add a build step to execute processor.exe t.txt?
I know there are two Runner types(.NET Process Runner and Command Line) that can execute programs. But how to get the paths of these artifacts?
Yes, I think it should be possible to run with Command Line runner *.exe file generated by other build.
You just have to make sure that build agent which runs Project A outputs these artifacts to place where build agent which runs Project B has access (in case if you have single agent it's not a concern obviously). And probably placing these artifacts into agent's working directory is not the best place because it can be cleared by doing clean checkout from VCS. Just choose some generic directory on the server and specify it for artifact output in Project A and then for Command Line runner in Project B.
I have situation where i am running 2 maven commands back to back to run 2 different set of tests.
However i need the final target folder to have results of both maven commands. Problem is that the second maven command cleans the target folder. Is it possible to ask mvn to not clean a specific folder in target.
I have a maven project that contains some Kotlin source files and some web resources (HTML/CSS). During the compile phase, the Kotlin source is compiled to JavaScript and ends up in the build output location, along with some other folders that I am not familiar with.
I would like a build step that occurs after the compile is finished that will copy my resources and compiled output and dependencies (kotlin.js) into a folder with the correct hierarchy that I deploy or debug.
I know how to copy the resources into the build output folder, but the build output folder appears to have some other files in it that are auto-generated by maven which I do not want to deploy.
Ideally, I would also like the clean phase to delete this destination directory.
I have a project Pensky with two build Jobs on my Jenkins Server. The First Build job does maven build and collects JaCoCo Code coverage report on Post Build Action.
My Second Build Job runs Sonar Analysis on my project. I would like to reuse/feed the JaCoCo code coverage report into my Sonar. But, unable to do so. I see the below message in my build job console
"Project coverage is set to 0% as build output directory does not
exist:"
The sonar job is looking for 'classes' folder in the .sonar directory (in the jenkins job directory).
Can anyone guide me how to feed the report into Sonar. Thank you
This is my sonar.properties
sonar.projectKey=Pensky
sonar.projectName=Pensky
sonar.projectVersion=1.1
sonar.projectDescription= GE Pensky
sonar.sources=src/main/java
sonar.tests=src/test/java
sonar.language=java
sonar.my.property=value
sonar.forceAnalysis=true
sonar.jacoco.reportPath=target/jacoco.exec
You haven't set the "sonar.binaries" property to point to the build directory (= "target/classes" if you compile it with Maven).
First of all, you should to copy the folder target of the first job in order to save time. If you do that, you have in the workspace of the job, all the binaries and the jacoco.exec file.
Then, you have to set the folder of the tests result.
sonar.junit.reportsPath=target/surefire-reports(or other)
sonar.jacoco.ReportPath=target/jacoco.exec
And finally, you have to set the binaries folder.
sonar.binaries=target/classes
Hope I have been helpful.