Hi Even though my ant build fails, TFS shows that step as successful and proceeds further. I have tried using failonerror but it seems there are very few tasks for which failonerror works.Is there a workaround so that TFS actually fails when ANT build fails.
You could be able to return warnings and errors from your powershell script using logging commands. Catch the ant build log first and determine whether the ant build failed. Then with using task.logissue type=error in powershell build task,you could fail the build task and then fail the build.
More details you could take a look at this similar question: Is it possible to raise and display build warnings from build steps using TFS 2015
Related
I have a single Agent pool having 4 agent machines. I am building my code and it is getting successfully using a single agent out of 4.
Achieve: I want to achieve compilation and testing using Unified Agent Pool.The same pool I want to use for Testing.
I create a Release definition and create an agent phase: Selected the option Execute on Multiple Agents using same pool I used in Build Agent. (Concept is achieving the exact functionality of Unified Agent).
Create the Visual Studio test V2 task and in the Search folder as used $(BuildOutput) . Test Assemblies as : test.dll !\obj* and selected RUN TESTS in Parallel on multicore machines.
Output:
Build run successfully and when it automatically trigger the release definition it shows these errors:
First error: No artifacts are available in the build 47777.
2018-07-16T13:19:38.0507114Z ##[error]Error: Preparing the test sources file failed. Error : Error: No test sources found matching the given filter '*test*.dll,!\obj**'
2018-07-16T13:19:38.0507114Z ##[error]Error: Preparing the test sources file failed. Error : Error: No test sources found matching the given filter '*test*.dll,!\obj**'
Question: am I going in right direction for an implementation of Unified Agent using VSTest v.2.
What should i do for resolving these errors and going into right direction.
Thanks!
This is the key problem:
No artifacts are available in the build 47777.
Your build is not publishing any artifacts. Your build has to use the Publish Artifacts task to publish the build outputs in order to make them available in a release definition.
When artifacts are successfully published to a build, there is an "Artifacts" tab that appears on the build summary that will allow you to browse and validate the build outputs.
In TFS 2018, I have a build step which calls on a batch script which sets various environment variables and involves msbuild on a solution file. Currently, if a project has warnings, there's no way to view them in TFS unless you look at the log files and see what the warnings are. If you run a native Visual Studio Build task, warnings are shown to you after a build.
How can I return warnings to TFS after my msbuild command completes?
You can try to return warnings and errors from your script using logging commands.
e.g.:
For PowerShell script you can use below logging commands:
Write-Host "##vso[task.logissue type=warning;]Test warning"
Write-Host "##vso[task.logissue type=error;]Test error"
For Batch script:
#echo ##vso[task.logissue type=warning;]Test warning
#echo ##vso[task.logissue type=error;]Test error
Reference this thread : Is it possible to raise and display build warnings from build steps using TFS 2015?
i'm using TFS2015 and vnext builds to build projects and sln files with build controller
in projects or slns we use robocopy command to copy dlls from builded solution to other folders but sometimes this job done and vnext build passed successfully and sometimes robocopy command can't copy dlls and failed with error
is there anyone solved this problem, can help me ?
1-my build agents run with Network/Service User
2-robocopy command error exited with code 8.
Error 8 from Robocopy means that some files or directories could not be copied at that moment. Since you are saying that the command sometimes succeeds, more likely is either a specific time related issue, or probably the files are being used by some other process at the time when the command is executed. In both cases you could try to execute the same robocopy command manually several minutes later, and see if it will fail again. You could add a /v option in your robocopy command (and possibly /LOG), and verify if there is more descriptive error in the log file afterwards. Also, when it fails, is the environment same as the one, on which it succeeds?
I habe a TFS-Server-Build (TFS 2017) on a Build-Agent with VS 2017. The first Buildstep (Prepare the Sonarqube analysis) and the build of the solution works fine. But i have a error at "Complete the SonarQube analysis":
2017-05-29T03:06:09.1933915Z ##[error]The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
2017-05-29T03:06:09.1933915Z ##[error]Possible causes:
2017-05-29T03:06:09.1933915Z ##[error]1. The project has not been built - the project must be built in between the begin and end steps
2017-05-29T03:06:09.1933915Z ##[error]2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 12.0 upwards are supported
2017-05-29T03:06:09.1933915Z ##[error]3. The begin, build or end steps have not all been launched from the same folder
2017-05-29T03:06:09.1933915Z Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
2017-05-29T03:06:09.1933915Z ##[error]05:06:09.115 Post-processing failed. Exit code: 1
Can anyone help?
Kind regards
Sebastian
I am not familiar with TFS-Server-Build,, but the possible causes are mentioned.
Check the following link for more details on how to set it up properly
Just like the error mentioned this stands for SonarQube was unable to collect the required information about your projects
Even though you have installed MSBUILD 12 or above, you should make sure the Build agent is calling the right version.
And double check if the MSBuild.SonarQube.Runner and MSBuild is running from the same working directory. At .sonarqube/out folder the sonar-project.properties is getting created or not.
I am looking at using Jenkins on Windows.
I currently have an ant script. It works pretty well. Except for instance, when the build breaks because of a syntax error, I can not see the error in the Jenkins console log.
So I am thinking may be ant is not the best tool for use on Windows.
What do most of you use for Jenkins on Windows?
If it is ant, how do you send the build output, VStudio, to the Jenkins console?
Thanks
Primarily I use Jenkins with maven projects, although you should see the ANT output in the online logs regardless.
What are you building? Are you building Java projects? Ant is what you use. If you are bulding a C project, you should use Make. If you're building a VisualStudio project, you should use msbuild. You use the build tool for your project. Jenkins will execute them without a problem.
Take a look at the build in question. On the left side of the screen, there's a Console output item. Click on that. Is there any output. No matter what tool you use, Jenkins captures the STDOUT and STDERR in that console output. If nothing else, you should see the exact commands Jenkins is executing to checkout and to build your project. Try executing those commands.
Still, you didn't give us much to go on. No idea what you're building or what you're doing with Ant. You didn't state any error, the console output, or even what the Jenkins error log is stating.
Jenkins does two things:
It watches your repository for changes.
Once it detects the changes, it executes the very commands you'd execute to build the project.
Jenkins doesn't care whether you use Ant, Maven, Make, or simply do a del /s/q. Jenkins will simply execute the commands you tell it to execute.
Addendum
It is c, c++, Java and InstallShield. I use ant to do file copy and move, call msdev.exe project. Some Javac calls, InstallShield command line builds..
Jenkins can execute multiple step builds in a single job. After you specify the build step, you can press the Add button to add another build step. There's no reason that all the build steps even have to be of the same type. Just select a "Freestyle" build, and use the right build tools for the job.
There's an optional MSBUILD plugin in Jenkins that should do your MS Build. This should give you the complete output from MSBuild, so you can see any errors.
After you do your MSBuild step, you can create a second build step to run an Ant task to build your InstallShield. After that, you could run another build step to do the copying you need either on the command line or through something like Ant (or Nant.
Whatever the output of the various tools is the output you'll get in the build console.
dev.cmd shows the output and I continue to use ant.