Cake: Build server (previously working) now broken, can't install addin.

Created on 30 Aug 2018  路  9Comments  路  Source: cake-build/cake

What You Are Seeing?

build   30-Aug-2018 17:17:24      powershell.exe -NonInteractive -executionpolicy Unrestricted -command "&{"..\.\build.ps1 -Script ..\build.cake -Configuration Release -buildver=1 -gitcommit=33ad38d78943e07cc5d0af32cc2d977cdf0dd96f -product=4Klarity "}
build   30-Aug-2018 17:17:37      Preparing to run build script...
build   30-Aug-2018 17:17:47      Running build script...
build   30-Aug-2018 17:17:48      Analyzing build script...
build   30-Aug-2018 17:17:48      Processing build script...
build   30-Aug-2018 17:17:48      Installing addins...
build   30-Aug-2018 17:17:58    EXEC : error : Failed to install addin 'Cake.FileHelpers'. [C:\bamboo-agent-home\xml-data\build-dir\X2-BAR21-JOB1\Src\Build.proj]
build   30-Aug-2018 17:17:58    C:\bamboo-agent-home\xml-data\build-dir\X2-BAR21-JOB1\Src\Build.proj(23,5): error MSB3073: The command "powershell.exe -NonInteractive -executionpolicy Unrestricted -command "&{"..\.\build.ps1 -Script

What is Expected?

A valid build/run of Cake.

What version of Cake are you using?

0.23.0

Are you running on a 32 or 64 bit system?

64bit.

What environment are you running on? Windows? Linux? Mac?

Windows.

How Did You Get This To Happen? (Steps to Reproduce)

A build.cake with #addin "Cake.FileHelpers"

build.ps1: http://termbin.com/5cvn
packages.config: http://termbin.com/m1ed

Most helpful comment

Thanks so much @mholo65 , It's all good now

All 9 comments

Here is the diagnostic output.

Build started 8/30/2018 7:10:12 PM.
     1>Project "C:\Users\james\Repos\Barracuda\barracuda\Src\Build.proj" on node 1 (default targets).
     1>Build:
         powershell.exe -NonInteractive -executionpolicy Unrestricted -command "&{"..\.\build.ps1 -Script ..\build.cake
          -Configuration Debug -buildver= -gitcommit= -product=4Klarity "}
         Preparing to run build script...
         Running build script...
         Module directory does not exist.
         Analyzing build script...
         Analyzing C:/Users/james/Repos/Barracuda/barracuda/build.cake...
         Processing build script...
         Installing addins...
         Creating package directory C:/Users/james/Repos/Barracuda/barracuda/tools/Addins/cake.filehelpers...
         Installing NuGet package Cake.FileHelpers...
         Executing: "C:/Users/james/Repos/Barracuda/barracuda/tools/nuget.exe" install "Cake.FileHelpers" -OutputDirect
         ory "C:/Users/james/Repos/Barracuda/barracuda/tools/Addins/cake.filehelpers" -ExcludeVersion -NonInteractive
         Unable to load the service index for source https://medxdev.pkgs.visualstudio.com/_packaging/packages/nuget/v3
         /index.json.
           Response status code does not indicate success: 401 (Unauthorized).
         NuGet exited with 1
         Feeds used:
           https://api.nuget.org/v3/index.json
           https://medxdev.pkgs.visualstudio.com/_packaging/packages/nuget/v3/index.json
           C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

         Installing package 'Cake.FileHelpers' to 'C:/Users/james/Repos/Barracuda/barracuda/tools/Addins/cake.filehelpe
         rs'.
           GET https://api.nuget.org/v3/registration3-gz-semver2/cake.filehelpers/index.json
           OK https://api.nuget.org/v3/registration3-gz-semver2/cake.filehelpers/index.json 274ms
         Output:
         Feeds used:
           https://api.nuget.org/v3/index.json
           https://medxdev.pkgs.visualstudio.com/_packaging/packages/nuget/v3/index.json
           C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

         Installing package 'Cake.FileHelpers' to 'C:/Users/james/Repos/Barracuda/barracuda/tools/Addins/cake.filehelpe
         rs'.
           GET https://api.nuget.org/v3/registration3-gz-semver2/cake.filehelpers/index.json
           OK https://api.nuget.org/v3/registration3-gz-semver2/cake.filehelpers/index.json 274ms
         An error occured while installing package Cake.FileHelpers.
         Deleting package directory C:/Users/james/Repos/Barracuda/barracuda/tools/Addins/cake.filehelpers...
     1>EXEC : error : Cake.Core.CakeException: Failed to install addin 'Cake.FileHelpers'. [C:\Users\james\Repos\Barrac
       uda\barracuda\Src\Build.proj]
            at Cake.Core.Scripting.ScriptProcessor.InstallAddins(IReadOnlyCollection`1 addins, DirectoryPath installPat
         h)
            at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
            at Cake.Commands.BuildCommand.Execute(CakeOptions options)
            at Cake.CakeApplication.Run(CakeOptions options)
            at Cake.Program.Main()
     1>C:\Users\james\Repos\Barracuda\barracuda\Src\Build.proj(23,5): error MSB3073: The command "powershell.exe -NonIn
       teractive -executionpolicy Unrestricted -command "&{"..\.\build.ps1 -Script ..\build.cake -Configuration Debug -
       buildver= -gitcommit= -product=4Klarity "}" exited with code -1.
     1>Done Building Project "C:\Users\james\Repos\Barracuda\barracuda\Src\Build.proj" (default targets) -- FAILED.

Build FAILED.

       "C:\Users\james\Repos\Barracuda\barracuda\Src\Build.proj" (default target) (1) ->
       (Build target) ->
         EXEC : error : Cake.Core.CakeException: Failed to install addin 'Cake.FileHelpers'. [C:\Users\james\Repos\Barr
       acuda\barracuda\Src\Build.proj]
         C:\Users\james\Repos\Barracuda\barracuda\Src\Build.proj(23,5): error MSB3073: The command "powershell.exe -Non
       Interactive -executionpolicy Unrestricted -command "&{"..\.\build.ps1 -Script ..\build.cake -Configuration Debug
        -buildver= -gitcommit= -product=4Klarity "}" exited with code -1.

    0 Warning(s)
    2 Error(s)

Pin to a previous version of the addin, when not specifying a version latest will be picked, which could have been compiled for a newer version of Cake. Specifying a version ensures same version used each build.

Read more at
https://cakebuild.net/docs/tutorials/pinning-cake-version

Thanks,
IMO, referencing a NuGet package without a version shouldn't be allowed.

@pauldotknopf we actually have an open issue about helping people fall into the "pit of success" in this area:

https://github.com/cake-build/cake/issues/2255

We will add an warning in next version of cake, our recommendation have always been to pin version. There's some legitimate uses cases, like addin and integration tests, where you want to run latest/prerelease.

But we hope with new warning in place, our guidance and recommendations will be clearer.

I attempted to pin versions of the add-ins via nuget (Cake.FileHelpers and Cake.XdtTransforms) that were used on a good build, but the output was the same. It does attempt to install the pinned versions, but it fails.

Here is the syntax I used to pin:

addin nuget:?package=Cake.FileHelpers&version=1.0.3.2

addin nuget:?package=Cake.XdtTransform&version=0.9.11

Here is the diagnostic output:

`
Build started 8/30/2018 7:29:41 PM.
1>Project "C:\Users\james\Repos\Barracuda\barracuda\Src\Build.proj" on node 1 (default targets).
1>Build:
powershell.exe -NonInteractive -executionpolicy Unrestricted -command "&{"...\build.ps1 -Script ..\build.cake
-Configuration Debug -buildver= -gitcommit= -product=4Klarity "}
Preparing to run build script...
Running build script...
Module directory does not exist.
Analyzing build script...
Analyzing C:/Users/james/Repos/Barracuda/barracuda/build.cake...
Processing build script...
Installing addins...
Creating package directory C:/Users/james/Repos/Barracuda/barracuda/tools/Addins/cake.filehelpers.1.0.3.2...
Installing NuGet package Cake.FileHelpers...
Executing: "C:/Users/james/Repos/Barracuda/barracuda/tools/nuget.exe" install "Cake.FileHelpers" -OutputDirect
ory "C:/Users/james/Repos/Barracuda/barracuda/tools/Addins/cake.filehelpers.1.0.3.2" -Version "1.0.3.2" -Exclu
deVersion -NonInteractive
Unable to load the service index for source https://medxdev.pkgs.visualstudio.com/_packaging/packages/nuget/v3
/index.json.
Response status code does not indicate success: 401 (Unauthorized).
NuGet exited with 1
Feeds used:
C:\Users\james.nuget\packages\
https://api.nuget.org/v3/index.json
https://medxdev.pkgs.visualstudio.com/_packaging/packages/nuget/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

     Attempting to gather dependency information for package 'Cake.FileHelpers.1.0.3.2' with respect to project 'C:
     /Users/james/Repos/Barracuda/barracuda/tools/Addins/cake.filehelpers.1.0.3.2', targeting 'Any,Version=v0.0'
     Output:
     Feeds used:
       C:\Users\james\.nuget\packages\
       https://api.nuget.org/v3/index.json
       https://medxdev.pkgs.visualstudio.com/_packaging/packages/nuget/v3/index.json
       C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\



     Attempting to gather dependency information for package 'Cake.FileHelpers.1.0.3.2' with respect to project 'C:
     /Users/james/Repos/Barracuda/barracuda/tools/Addins/cake.filehelpers.1.0.3.2', targeting 'Any,Version=v0.0'
     An error occured while installing package Cake.FileHelpers.
     Deleting package directory C:/Users/james/Repos/Barracuda/barracuda/tools/Addins/cake.filehelpers.1.0.3.2...
 1>EXEC : error : Cake.Core.CakeException: Failed to install addin 'Cake.FileHelpers'. [C:\Users\james\Repos\Barrac
   uda\barracuda\Src\Build.proj]
        at Cake.Core.Scripting.ScriptProcessor.InstallAddins(IReadOnlyCollection`1 addins, DirectoryPath installPat
     h)
        at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
        at Cake.Commands.BuildCommand.Execute(CakeOptions options)
        at Cake.CakeApplication.Run(CakeOptions options)
        at Cake.Program.Main()
 1>C:\Users\james\Repos\Barracuda\barracuda\Src\Build.proj(23,5): error MSB3073: The command "powershell.exe -NonIn
   teractive -executionpolicy Unrestricted -command "&{"..\.\build.ps1 -Script ..\build.cake -Configuration Debug -
   buildver= -gitcommit= -product=4Klarity "}" exited with code -1.
 1>Done Building Project "C:\Users\james\Repos\Barracuda\barracuda\Src\Build.proj" (default targets) -- FAILED.

Build FAILED.

   "C:\Users\james\Repos\Barracuda\barracuda\Src\Build.proj" (default target) (1) ->
   (Build target) ->
     EXEC : error : Cake.Core.CakeException: Failed to install addin 'Cake.FileHelpers'. [C:\Users\james\Repos\Barr
   acuda\barracuda\Src\Build.proj]
     C:\Users\james\Repos\Barracuda\barracuda\Src\Build.proj(23,5): error MSB3073: The command "powershell.exe -Non
   Interactive -executionpolicy Unrestricted -command "&{"..\.\build.ps1 -Script ..\build.cake -Configuration Debug
    -buildver= -gitcommit= -product=4Klarity "}" exited with code -1.

0 Warning(s)
2 Error(s)

Time Elapsed 00:00:06.04
`

According to the logs, nuget.exe tries to access a private feed, but it isn鈥檛 authorized (401).

Specify the feed explicitly int the directive:
#addin nuget:https://api.nuget.org/v3/index.json?package=Cake.FileHelpers&version=1.0.3.2

Thanks so much @mholo65 , It's all good now

Excellent you got it sorted馃憤then I'm going to go ahead and close this issue.

Was this page helpful?
0 / 5 - 0 ratings