chocolatey / Chocolatey.Cake.Recipe

A set of convention based Cake scripts for building Chocolatey projects
Apache License 2.0
5 stars 9 forks source link

Zip Archive creation is attempted when no files are signed #157

Open AdmiringWorm opened 1 month ago

AdmiringWorm commented 1 month ago

Checklist

What You Are Seeing?

When we are running signing of the PowerShell scripts, and there are no files that needs to be resigned, a zip archive is still being attempted to be created.

This causes an error to occur, and any build is marked as a failure.

What is Expected?

When there are no files that have been resigned/signed, we should not attempt to create a new zip archive artifact.

How Did You Get This To Happen?

  1. Run resigning on our internal build provider for a project all up to date.

System Details

Installed Packages

N/A

Output Log

An error occurred when executing task 'Sign-PowerShellScripts'.
12:14:30   An error occurred when executing task 'Sign-PowerShellScripts'.
12:14:30   ----------------------------------------
12:14:30   Teardown
12:14:30   ----------------------------------------
12:14:30   Starting Teardown...
12:14:30   Finished running tasks.
12:14:30   Error: System.AggregateException: One or more errors occurred. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\buildAgent\work\ca903c6cab03670c\code_drop\SignedFiles\SignedFiles.zip'.
12:14:30      at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
12:14:30      at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
12:14:30      at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
12:14:30      at System.IO.FileInfo.Open(FileMode mode, FileAccess access, FileShare share)
12:14:30      at Cake.Common.IO.Zipper.Zip(DirectoryPath rootPath, FilePath outputPath, IEnumerable`1 filePaths)
12:14:30      at Submission#0.Zip(DirectoryPath rootPath, FilePath outputPath, IEnumerable`1 filePaths) in :line 2435
12:14:30      at Submission#0.<<Initialize>>b__0_107() in C:\buildAgent\work\ca903c6cab03670c\tools\Chocolatey.Cake.Recipe.0.28.4\Content\sign.cake:line 102
12:14:30      at Cake.Core.CakeTaskBuilderExtensions.<>c__DisplayClass32_0.<Does>b__0(ICakeContext x)
12:14:30      at Cake.Core.CakeTask.<Execute>d__43.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Cake.Core.DefaultExecutionStrategy.<ExecuteAsync>d__4.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Cake.Core.CakeEngine.<ExecuteTaskAsync>d__31.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at Cake.Core.CakeEngine.<ExecuteTaskAsync>d__31.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at Cake.Core.CakeEngine.<ExecuteTaskAsync>d__31.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Cake.Core.CakeEngine.<RunTask>d__28.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Cake.Core.CakeEngine.<RunTargetAsync>d__27.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Cake.Scripting.BuildScriptHost.<RunTargetAsync>d__3.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Cake.Core.Scripting.ScriptHost.RunTarget(String target)
12:14:30      at Submission#0.<get_Build>b__836_0(String target) in C:\buildAgent\work\ca903c6cab03670c\tools\Chocolatey.Cake.Recipe.0.28.4\Content\build.cake:line 531
12:14:30      at Submission#0.Builder.RunDotNet() in C:\buildAgent\work\ca903c6cab03670c\tools\Chocolatey.Cake.Recipe.0.28.4\Content\build.cake:line 559
12:14:30      at Submission#0.<<Initialize>>d__0.MoveNext() in C:\buildAgent\work\ca903c6cab03670c\recipe.cake:line 394
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.<RunSubmissionsAsync>d__9`1.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Microsoft.CodeAnalysis.Scripting.Script`1.<RunSubmissionsAsync>d__21.MoveNext()
12:14:30      --- End of inner exception stack trace ---
12:14:30      at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
12:14:30      at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
12:14:30      at Cake.Scripting.Roslyn.RoslynScriptSession.Execute(Script script)
12:14:30      at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
12:14:30      at Cake.Commands.BuildCommand.Execute(CakeOptions options)
12:14:30      at Cake.CakeApplication.Run(CakeOptions options)
12:14:30      at Cake.Program.Main()
12:14:30   ---> (Inner Exception #0) System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\buildAgent\work\ca903c6cab03670c\code_drop\SignedFiles\SignedFiles.zip'.
12:14:30      at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
12:14:30      at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
12:14:30      at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
12:14:30      at System.IO.FileInfo.Open(FileMode mode, FileAccess access, FileShare share)
12:14:30      at Cake.Common.IO.Zipper.Zip(DirectoryPath rootPath, FilePath outputPath, IEnumerable`1 filePaths)
12:14:30      at Submission#0.Zip(DirectoryPath rootPath, FilePath outputPath, IEnumerable`1 filePaths) in :line 2435
12:14:30      at Submission#0.<<Initialize>>b__0_107() in C:\buildAgent\work\ca903c6cab03670c\tools\Chocolatey.Cake.Recipe.0.28.4\Content\sign.cake:line 102
12:14:30      at Cake.Core.CakeTaskBuilderExtensions.<>c__DisplayClass32_0.<Does>b__0(ICakeContext x)
12:14:30      at Cake.Core.CakeTask.<Execute>d__43.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Cake.Core.DefaultExecutionStrategy.<ExecuteAsync>d__4.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Cake.Core.CakeEngine.<ExecuteTaskAsync>d__31.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at Cake.Core.CakeEngine.<ExecuteTaskAsync>d__31.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at Cake.Core.CakeEngine.<ExecuteTaskAsync>d__31.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Cake.Core.CakeEngine.<RunTask>d__28.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Cake.Core.CakeEngine.<RunTargetAsync>d__27.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Cake.Scripting.BuildScriptHost.<RunTargetAsync>d__3.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Cake.Core.Scripting.ScriptHost.RunTarget(String target)
12:14:30      at Submission#0.<get_Build>b__836_0(String target) in C:\buildAgent\work\ca903c6cab03670c\tools\Chocolatey.Cake.Recipe.0.28.4\Content\build.cake:line 531
12:14:30      at Submission#0.Builder.RunDotNet() in C:\buildAgent\work\ca903c6cab03670c\tools\Chocolatey.Cake.Recipe.0.28.4\Content\build.cake:line 559
12:14:30      at Submission#0.<<Initialize>>d__0.MoveNext() in C:\buildAgent\work\ca903c6cab03670c\recipe.cake:line 394
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.<RunSubmissionsAsync>d__9`1.MoveNext()
12:14:30   --- End of stack trace from previous location where exception was thrown ---
12:14:30      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
12:14:30      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
12:14:30      at Microsoft.CodeAnalysis.Scripting.Script`1.<RunSubmissionsAsync>d__21.MoveNext()<---
12:14:30   
12:14:30   ==================================================
12:14:30   Process exited with code 0
12:14:30   Step Call Cake (Command Line) failed

Additional Context

Only a small section of the log file is included, as other items contain internal values.