TFS - VsTest fail when all tests passed - tfs

When i run VsTset via TFS build sometimes is failed with the error:
"
An exception occurred while invoking executor executor://mstestadapter/v2: Could not find a part of the path C:\Agents\CIAgents\Agent1\_work\s\TestResults\Deploy_[user] [date] [time]\In\\[machine_name]
When i run the build few more times it passes without errors

Related

Jenkinsfile clear gradle cache and retry on failure

Current scenario: We have configured CI pipeline and running a jenkinsfile.groovy script for a gradle build. The pipeline is working fine and now we are planning to enable an error handling functionality into the groovy script.
Reason of this functionality: Sometimes, the gradle build is unable to download all the dependencies due to the network glitch or could be any reason. So, as a part of this functionality, we wants to add the following steps in the existing pipeline:
throw an error message of the failure
clear the cache from the gradle home directory
rebuild failed jenkins job
stop the existing failed build
Following code is included in the pipeline to enable the functionality:
catch (err) {
echo "Build failed for ${env.JOB_NAME}, clearing cache from the $GRADLE_HOME and retrying"
sh "rm -rf $GRADLE_HOME"
build "${env.JOB_NAME}"
throw err
}
Testing of new functionality: We are now in testing phase of the above code which is working fine, and three steps of the functionality is achieved, however, throw err (last step) doesn't stop the existing failed build after triggering same build again and keeps waiting for the build to complete.
Success of the new functionality in the existing pipeline:
throw an error message of the failure : ACHIEVED
clear the cache from the gradle home directory : ACHIEVED
rebuild failed jenkins job : ACHIEVED
stop the existing failed build : NOT ACHIEVED this fourth and the last step is not working as expected and doesn't stop the failed build. The failed build keeps waiting for the next job to complete. We have tried adding exit 1 as well but no luck.
Any help would be really appreciable. TIA

TFS 2015 vNext Build - Set build result

How can we set the build result/outcome from lets say a powershell script.
I believe the valid states are Successful, Failed and Partially Successful, but especially for the last, how can we set that one manually. if we return error 1, the script task will have a failed state and the build as well.
We have some scenarios where we want to set the build to Partially Successful.
Im not able to find any documentation about this.
There are a few things to understand:
A task with a non-zero exit code fails.
A build fails if a task fails.
...unless the "Continue on Error" checkbox is selected, in which case it marks the build as "Partially succeeded" and continues running other tasks.

ERROR: Error during SonarQube Scanner execution

I have configured Jenkins Job for Sonar Quality Gate and Code Coverage. Below is the Jenkins job set Up. When I trigger the build I see below error. Most of my Jenkins jobs are failing because of this issue. Please help me out from this.
Jenkins Job setup
Error Logs
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Error at line 2 of coverage report C:\Location.xml
at org.sonar.plugins.coverage.generic.GenericCoverageSensor.loadReport(GenericCoverageSensor.java:130)
at org.sonar.plugins.coverage.generic.GenericCoverageSensor.analyseWithLogger(GenericCoverageSensor.java:95)
at org.sonar.plugins.coverage.generic.GenericCoverageSensor.analyse(GenericCoverageSensor.java:91)
at org.sonar.plugins.coverage.generic.ReportParser.parse(ReportParser.java:82)
at org.sonar.plugins.coverage.generic.GenericCoverageSensor.loadReport(GenericCoverageSensor.java:126)
... 31 more
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
The SonarQube Scanner did not complete successfully
21:44:09.12 Creating a summary markdown file...
21:44:09.122 Post-processing failed. Exit code: 1
The answer is there in the log:
org.sonar.plugins.dotnet.tests.ParseErrorException: Missing root element 'test-results' in C:\UC\ProductEligibility\BTS\results.xml at line 2
So the results.xml is not valid xml and causes a parse error and kills the analysis. So whatever creates that file, is causing the issue in the end.
Try to remove that parameter to verify if the analysis runs correctly now.

"Unable to find build script" error running Ant from Jenkins

I got this error when running Jenkins to build an Ant project. Could someone explain the source of the problem and how to fix it?
ERROR: Unable to find build script at D:\WORK\06_HRMS\90_SourceCode\trunk\jwf
Recording test results
Injecting SonarQube environment variables using the configuration: Sonar
ERROR: Step ‘Publish JUnit test result report’ aborted due to exception:
java.io.IOException: Failed to read /var/lib/jenkins/workspace/MBFS/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
Is this really a JUnit report file? Your configuration must be matching too many files

Jenkins - Build Status

I've created one Jenkins job to execution 5 test cases and it works, but not in terms of build creation.
Build status is coming as SUCCESS even if there is any failure test
cases during execution.
For instance, 2 test cases out of 5 got failed during my recent run, but the build status has become SUCCESS!!!
Please help me in correcting this.....
Note: I'm using Jenkins 1.617 & ANT 1.9.4 for the integration.
If you are executing junits in jenkins, default status is unstable for jenkins job and success for maven/ant build.
If you are using an ant build add the below property to junit task to make the build failed failureproperty="test.failed". If you want to fail the build even if one junit fails, add property haltonfailure="yes"
If you are using maven add the argument -Dmaven.test.failure.ignore=false

Resources