Our Jenkins server has been successfully building projects for years using Powershell to run a cake script. Out of the blue today, we started getting the following error on multiple projects:
12:10:46 Running build script...
12:10:46
12:10:46 Error: Unknown command 'Default'.
12:10:46
12:10:46 .\scripts\build.cake -target=Default -configuration=Release
12:10:46 -verbosity=Verbose -environment=dev -certificatePath=C:/Program Files
12:10:46 (x86)/xxxxx/Verisign Certificate -certificateName=xxxxxxxx_cert.pfx
12:10:46 -certificatePassword=xxxxxxxxxxx
12:10:46 ^^^^^^^ No such command
12:10:46
12:10:47 Build step 'Windows PowerShell' marked build as failure
The build.ps1 script has not changed. The build.cake script has not changed. Jenkins was not updated since the last successful builds nor any of the add-ins.
If I remove "-target=Default" from the argument list, I just get the same error on "-configuration=Release" indicating unknown command: "Release".
Has anyone else experienced this?
To answer your next question, I was really confident but now am questioning this. lol So, to start, yes, the Jenkins instance/node (server) is the same server where I installed this module and created the script that is running. But, when I run Get-Module in Shell I get a very small list of Modules and none of which are ones I installed.
ex. Job in Jenkins is called WSUS_Cleanup, so I added the PoshWSUS folder to the C:\Program Files (x86)\Jenkins\workspace\WSUS_Cleanup folder I then changed the Log on as option in the Jenkins service to my _adm domain account.
With Cake Frosting 1.0 CakeHost can be used directly to create the CakeHost object. With Cake Frosting 0.38.x: With Cake Frosting 1.0:
Hence, these types of errors are known as “non-terminating” errors. If you set $ErrorActionPreference to Stop or if you use Stop as the parameter value for -ErrorAction, Windows PowerShell will stop the script execution at the point an error occurs.
The possible root cause of this failure is the cake version update (0.38.x --> 1.0)
You have two ways to fix this issue
Change the Argument Syntex - arguments should always be called with multi-dash syntax (e.g. --target=Foo) instead of (e.g. -target=Foo) Refer: https://cakebuild.net/docs/getting-started/upgrade
Pinning the cake version
Specified the version of Cake in the tools/packages.config file Refer: https://cakebuild.net/docs/writing-builds/reproducible-builds/pinning-cake-version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With