-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Visual Studio Online - Cake Task failure not failing build #39
Comments
@Volak I just created a new VSTS project&repo, then created a minimal cake script like this Information("Hello world"); the log looked like this
and as expected the build succeeded then added a throw to the script like this Information("Hello world");
throw new Exception("Fail the build!"); the log then looked like this 2017-05-29T11:02:37.9647038Z ##[section]Starting: Cake
2017-05-29T11:02:37.9803290Z ==============================================================================
2017-05-29T11:02:37.9803290Z Task : Cake
2017-05-29T11:02:37.9803290Z Description : Build with Cake
2017-05-29T11:02:37.9803290Z Version : 0.3.0
2017-05-29T11:02:37.9803290Z Author : Patrik Svensson
2017-05-29T11:02:37.9803290Z Help : [More Information about Cake](http://cakebuild.net)
2017-05-29T11:02:37.9803290Z ==============================================================================
2017-05-29T11:02:38.0115793Z Preparing task execution handler.
2017-05-29T11:02:40.9311042Z Executing the powershell script: d:\a\_tasks\Cake_b88ea9a0-7d6e-11e5-b5de-d57d652482f7\0.3.0\Cake.ps1
2017-05-29T11:02:41.7593469Z Installing Cake...
2017-05-29T11:02:41.7749687Z
2017-05-29T11:02:41.7749687Z
2017-05-29T11:02:42.5255224Z Feeds used:
2017-05-29T11:02:42.5255224Z https://api.nuget.org/v3/index.json
2017-05-29T11:02:42.5255224Z
2017-05-29T11:02:42.9630230Z GET https://api.nuget.org/v3/registration1-gz/cake/index.json
2017-05-29T11:02:43.0567722Z OK https://api.nuget.org/v3/registration1-gz/cake/index.json 100ms
2017-05-29T11:02:43.1351093Z
2017-05-29T11:02:43.1973976Z
2017-05-29T11:02:43.1973976Z Attempting to gather dependency information for package 'Cake.0.19.5' with respect to project 'd:\a\1\s\tools', targeting 'Any,Version=v0.0'
2017-05-29T11:02:43.1973976Z Gathering dependency information took 48.59 ms
2017-05-29T11:02:43.2288051Z Attempting to resolve dependencies for package 'Cake.0.19.5' with DependencyBehavior 'Lowest'
2017-05-29T11:02:43.3224086Z Resolving dependency information took 0 ms
2017-05-29T11:02:43.3224086Z Resolving actions to install package 'Cake.0.19.5'
2017-05-29T11:02:43.3224086Z Resolved actions to install package 'Cake.0.19.5'
2017-05-29T11:02:43.3380224Z Retrieving package 'Cake 0.19.5' from 'nuget.org'.
2017-05-29T11:02:43.3692725Z GET https://api.nuget.org/packages/cake.0.19.5.nupkg
2017-05-29T11:02:43.4005220Z OK https://api.nuget.org/packages/cake.0.19.5.nupkg 21ms
2017-05-29T11:02:43.4005220Z Installing Cake 0.19.5.
2017-05-29T11:02:43.6348971Z Adding package 'Cake.0.19.5' to folder 'd:\a\1\s\tools'
2017-05-29T11:02:43.6505230Z Added package 'Cake.0.19.5' to folder 'd:\a\1\s\tools'
2017-05-29T11:02:43.6661480Z Successfully installed 'Cake 0.19.5' to d:\a\1\s\tools
2017-05-29T11:02:43.6661480Z Executing nuget actions took 324.12 ms
2017-05-29T11:02:43.6661480Z Executing build script...
2017-05-29T11:02:43.6661480Z
2017-05-29T11:02:43.6661480Z
2017-05-29T11:02:43.6973972Z d:\a\1\s\tools\Cake\Cake.exe "d:\a\1\s\build.cake" -target="Default" -verbosity="Verbose" --paths_tools="d:\a\1\s\tools"
2017-05-29T11:02:44.0255220Z Analyzing build script...
2017-05-29T11:02:44.0411804Z Processing build script...
2017-05-29T11:02:44.0411804Z Downloading and installing Roslyn...
2017-05-29T11:02:44.0880246Z Installing packages (using https://packages.nuget.org/api/v2)...
2017-05-29T11:02:45.9613888Z Copying files...
2017-05-29T11:02:45.9613888Z Copying Roslyn.Compilers.CSharp.dll...
2017-05-29T11:02:45.9770142Z Copying Roslyn.Compilers.dll...
2017-05-29T11:02:45.9770142Z Deleting installation directory...
2017-05-29T11:02:46.2113881Z Compiling build script...
2017-05-29T11:02:48.7702797Z Hello world
-2017-05-29T11:02:48.7702797Z ##[error]Error: Fail the build!
-2017-05-29T11:02:48.8015294Z ##[error]System.Exception: Unexpected exit code 1 returned from tool Cake.exe
-2017-05-29T11:02:48.8015294Z at Microsoft.TeamFoundation.DistributedTask.Task.Internal.InvokeToolCmdlet.ProcessRecord()
-2017-05-29T11:02:48.8015294Z at System.Management.Automation.CommandProcessor.ProcessRecord()
-2017-05-29T11:02:48.8171549Z ##[error]PowerShell script completed with 1 errors.
2017-05-29T11:02:48.8171549Z ##[section]Finishing: Cake So not able to repro, and without more logs or an example Cake file makes it hard to debug. Also could you provide info about agent version, if it's an hosted agent or not, and which version of the cake VSTS extension you're using. |
Thanks for taking a look Without the VSTS specific command stuff the build fails. But once I added the extra logging in teardown the build succeeds. |
Should there be a failed scenario here? |
Also perhaps what you're trying to achieve might already be avail in @agc93 Cake BuildSystems Module |
That's interesting! I guess you might be right sending success there overrides the thrown exception in VSTS. Edit: Seems like he has the same problem https://github.com/agc93/Cake.BuildSystems.Module/blob/develop/src/Cake.TFBuild.Module/TFBuildEngine.cs#L63 |
Haven't tried so unsure. Could be that you have to complete any non completed tasks here |
You shouldn't need to check in the tools directory, but you will need to check in the packages.config files, so that the required components can be restored during initialization. |
Ha ha, totally understand! Due to the fact that Modules are altering the internals of Cake (by overriding/extending built in functionality) they need to be loaded very early in the execution of Cake. Using the packages.config file in Modules folder will mean that the assemblies are fetched prior to cake actually executing, therefore they are there early enough to be loaded into the cake execution. |
@gep13 probably not a big deal - but Edit Edit 2 |
@Volak if you could raise an issue in the respective repository, that would be appreciated. |
Both issues are created - feel free to close this one btw you solved it |
Perfect, thank you. |
For reference.... |
@Volak commented on Mon May 29 2017
What You Are Seeing?
I'm using cake and in the process of moving to VSTS for builds - and it seems the cake task from the market place: https://marketplace.visualstudio.com/items?itemName=cake-build.cake
Is not passing errors to the build? Even when cake throws a build exception the build succeeds - as noted in the following shots
What is Expected?
When cake throws an exception the build should fail
@devlead commented on Mon May 29 2017
Looks like you're missing MS build web targets Sdk on build agent.
Either it needs to be installed or use something like this nuget package
https://www.nuget.org/packages/MSBuild.Microsoft.VisualStudio.Web.targets/14.0.0.3
@Volak commented on Mon May 29 2017
Thank you for the tip - you are right about the error I'm getting during the build.
But that's just for example - the problem is VSTS thinks the build succeeded even though cake failed 😞
The text was updated successfully, but these errors were encountered: