Squirrel / Squirrel.Windows

An installation and update framework for Windows desktop apps
MIT License
7.36k stars 1.03k forks source link

Build problem on 1.7.6 #1081

Open LightCZ opened 7 years ago

LightCZ commented 7 years ago

Since Squirrel migrated to new 7-zip solution we are having problems on build agent (teamcity build agent) It looks like some file could not be "extracted"/ found but there is no log message on what is going on

The error log looks like this:

[Step 5/6] Starting: C:\BuildAgent\work\1015bb07ae0502fb\Solution\packages\squirrel.windows.1.7.6\tools\Squirrel.exe --releasify C:\BuildAgent\work\1015bb07ae0502fb\Solution/Release/FeelCareSID.1.0.201.nupkg --framework-version net462
[11:32:45][Step 5/6] in directory: C:\BuildAgent\work\1015bb07ae0502fb\Solution
[11:32:58][Step 5/6] System.AggregateException: One or more errors occurred. ---> System.Exception: 7-Zip [64] 16.04 : Copyright (c) 1999-2016 Igor Pavlov : 2016-10-04
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] Open archive: C:\BuildAgent\work\1015bb07ae0502fb\Solution\Releases\FeelCareSID-1.0.199-full.nupkg
[11:32:58][Step 5/6] --
[11:32:58][Step 5/6] Path = C:\BuildAgent\work\1015bb07ae0502fb\Solution\Releases\FeelCareSID-1.0.199-full.nupkg
[11:32:58][Step 5/6] Type = zip
[11:32:58][Step 5/6] Physical Size = 22
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] Scanning the drive:
[11:32:58][Step 5/6] 0 files, 0 bytes
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] Updating archive: C:\BuildAgent\work\1015bb07ae0502fb\Solution\Releases\FeelCareSID-1.0.199-full.nupkg
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] Items to compress: 0
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] Files read from disk: 0
[11:32:58][Step 5/6] Archive size: 22 bytes (1 KiB)
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] Scan WARNINGS for files and folders:
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6]  : The system cannot find the path specified.
[11:32:58][Step 5/6] ----------------
[11:32:58][Step 5/6] Scan WARNINGS: 1
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] WARNING: The system cannot find the path specified.
[11:32:58][Step 5/6]    at Squirrel.Utility.<CreateZipFromDirectory>d__23.MoveNext()
[11:32:58][Step 5/6]    --- End of inner exception stack trace ---
[11:32:58][Step 5/6]    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
[11:32:58][Step 5/6]    at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
[11:32:58][Step 5/6]    at System.Threading.Tasks.Task.Wait()
[11:32:58][Step 5/6]    at Squirrel.ReleasePackage.CreateReleasePackage(String outputFile, String packagesRootDir, Func`2 releaseNotesProcessor, Action`1 contentsPostProcessHook)
[11:32:58][Step 5/6]    at Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi, String frameworkVersion, Boolean generateDeltas)
[11:32:58][Step 5/6]    at Squirrel.Update.Program.executeCommandLine(String[] args)
[11:32:58][Step 5/6]    at Squirrel.Update.Program.main(String[] args)
[11:32:58][Step 5/6]    at Squirrel.Update.Program.Main(String[] args)
[11:32:58][Step 5/6] ---> (Inner Exception #0) System.Exception: 7-Zip [64] 16.04 : Copyright (c) 1999-2016 Igor Pavlov : 2016-10-04
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] Open archive: C:\BuildAgent\work\1015bb07ae0502fb\Solution\Releases\FeelCareSID-1.0.199-full.nupkg
[11:32:58][Step 5/6] --
[11:32:58][Step 5/6] Path = C:\BuildAgent\work\1015bb07ae0502fb\Solution\Releases\FeelCareSID-1.0.199-full.nupkg
[11:32:58][Step 5/6] Type = zip
[11:32:58][Step 5/6] Physical Size = 22
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] Scanning the drive:
[11:32:58][Step 5/6] 0 files, 0 bytes
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] Updating archive: C:\BuildAgent\work\1015bb07ae0502fb\Solution\Releases\FeelCareSID-1.0.199-full.nupkg
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] Items to compress: 0
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] Files read from disk: 0
[11:32:58][Step 5/6] Archive size: 22 bytes (1 KiB)
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] Scan WARNINGS for files and folders:
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6]  : The system cannot find the path specified.
[11:32:58][Step 5/6] ----------------
[11:32:58][Step 5/6] Scan WARNINGS: 1
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] WARNING: The system cannot find the path specified.
[11:32:58][Step 5/6]    at Squirrel.Utility.<CreateZipFromDirectory>d__23.MoveNext()<---
[11:32:58][Step 5/6] 
[11:32:58][Step 5/6] Process exited with code -1
[11:32:58][Step 5/6] Process exited with code -1
[11:32:58][Step 5/6] Step Squirell Releasify (Command Line) failed
hs-hub-world commented 7 years ago

(Some ideas)

(Probably it does not matter but you have forward slash after \Solution) --releasify C:\BuildAgent\work\1015bb07ae0502fb\Solution/Release/FeelCareSID.1.0.201.nupkg

See if you have a valid nuget package. Are you able to open FeelCareSID.1.0.201.nupkg file using nuget package explorer -? Is there content in the Nuget package under lib\framework-?

Have you tried to run the squirrel.com --releasify yourself manually from the build agent -?

Try using 7z.exe command line from the build agent, do you get any errors -?

and lastly, try to delete this folder it could be locked/read only mode for some reason from the build agent server: C:\Users\\AppData\Local\SquirrelTemp

LightCZ commented 7 years ago

Thats the thing. When you run it directly from build agent it works flawlessly. Running from teamcity as a process, this error appears.

lukeskinner commented 7 years ago

This might be related to #1060.

You can try changing the TeamCity build agent service to use a windows user. This may affect other things your building with TeamCity - you should also use a restricted user if your going to do it.

LightCZ commented 7 years ago

Wow, this deffinitely looks related. I ll try to change this on our agent. Would be nice to determine why is this happening under system account tho.

DanSantimore commented 7 years ago

I had a similar problem using LocalSystem and Octopus Deploy. 7Zip just broke. Switching to a windowsuser fixed it. See https://octopus.com/docs/installation/installing-tentacles/running-tentacle-under-a-specific-user-account-for-use-in-powershell

kenbailey commented 6 years ago

We were able to resolve this by adding a SQUIRREL_TEMP environment variable in TeamCity to point to a temp directory in the teamcity build path (i.e., add env.SQUIRREL_TEMP with a value of %teamcity.build.workingDir%\SquirrelTemp). You can add an environment variable to the build process under the TeamCity Build Configurations > Parameters section.

It appears to have something to do with limitations on the %LocalAppData% location for the system user when you are running the agent as a System user. Changing the agent to a local account did resolve the problem, but we didn't want to make this change across all build agents. Simply setting the SQUIRREL_TEMP environment variable as described above allowed it to build and leave the build agent running on the System account.

Here are some indicators we found to assess the problem:

  1. The build fails with the following error:
    [Exec] C:\BuildAgent\work\689c651b5369f733\src\SquirrelApp.csproj(166, 5): error MSB3073: The command ""C:\BuildAgent\work\689c651b5369f733\packages\squirrel.windows.1.7.8\tools\Squirrel.exe" --releasify C:\BuildAgent\work\689c651b5369f733\src\bin\Package\SquirrelApp.0.1.0.nupkg" exited with code -1.
  2. Inspecting the SquirrelSetup.log on the actual build machine under C:\BuildAgent\work\689c651b5369f733\packages\squirrel.windows.1.7.8\tools with the following message.
    
    2017-10-31 20:08:30> Utility: Failed to extract file C:\BuildAgent\work\689c651b5369f733\src\Releases\SquirrelApp-0.1.0-full.nupkg to C:\Windows\system32\config\systemprofile\AppData\Local\SquirrelTemp\tempa
    7-Zip [64] 16.04 : Copyright (c) 1999-2016 Igor Pavlov : 2016-10-04

Scanning the drive: 0 files, 0 bytes

Creating archive: C:\BuildAgent\work\689c651b5369f733\src\Releases\SquirrelApp-0.1.0-full.nupkg

Items to compress: 0

Files read from disk: 0 Archive size: 22 bytes (1 KiB)



I'm working on a PR to add this information to the documentation as well.