chocolatey / boxstarter

Repeatable, reboot resilient windows environment installations made easy using Chocolatey packages
https://boxstarter.org/
Apache License 2.0
1.29k stars 162 forks source link

Install-BoxstarterPackage: Errors Array of result object is empty, even if an error occurs #564

Closed pl31 closed 1 week ago

pl31 commented 4 weeks ago

Checklist

What You Are Seeing?

I am running

Install-BoxstarterPackage -DisableReboots -DisableRestart .\test.ps1

with test.ps1 containing:

throw "Error !"

The Errors field of the result object is empty:

Errors       : {}
ComputerName : localhost
Completed    : True
FinishTime   : 12.06.2024 15:02:20
StartTime    : 12.06.2024 15:02:10

What is Expected?

The Errors Array should contain the errors from the run of the local installation script. There was a version on my PC, where this was the case. But after deleting and reinstalling boxstarter and chocolatey, I am not able to reproduce this behaviour. Edit: It did work with 2.13.0, see comment below.

How Did You Get This To Happen?

  1. Install-BoxstarterPackage -DisableReboots -DisableRestart .\test.ps1
  2. Empty Errors Array in Result Object

System Details

Installed Packages

Boxstarter 3.0.3
Boxstarter.Bootstrapper 3.0.3
Boxstarter.Chocolatey 3.0.3
Boxstarter.Common 3.0.3
Boxstarter.HyperV 3.0.3
Boxstarter.WinConfig 3.0.3
chocolatey 2.3.0

Output Log

PS C:\temp> Install-BoxstarterPackage -DisableReboots -DisableRestart .\test-p2.ps1
Boxstarter: Installing package .\test-p2.ps1
Boxstarter Version 3.0.3.0
(c) 2018 Chocolatey Software, Inc, 2012 - 2018 Matt Wrock. https://boxstarter.org

Boxstarter: Disabling Automatic Updates from Windows Update
Chocolatey v2.3.0
3 validations performed. 2 success(es), 1 warning(s), and 0 error(s).

Validation Warnings:
 - A pending system reboot request has been detected, however, this is
   being ignored due to the current command 'Pack' being used.
   It is recommended that you reboot at your earliest convenience.

Attempting to build package from 'tmp4B87.tmp.nuspec'.
Successfully created package 'C:\ProgramData\Boxstarter\BuildPackages\tmp4B87.tmp.1.0.0.nupkg'
Boxstarter: Created a temporary package tmp4B87.tmp from .\test-p2.ps1 in C:\ProgramData\Boxstarter\BuildPackages
++ Boxstarter starting Calling Chocolatey to install tmp4B87.tmp. This may take several minutes to complete...
Chocolatey v2.3.0
3 validations performed. 2 success(es), 1 warning(s), and 0 error(s).

Validation Warnings:
 - A pending system reboot request has been detected, however, this is
   being ignored due to the current Chocolatey configuration.  If you
   want to halt when this occurs, then either set the global feature
   using:
     choco feature enable --name="exitOnRebootDetected"
   or pass the option --exit-when-reboot-detected.

Installing the following packages:
tmp4B87.tmp
By installing, you accept licenses for the packages.
Downloading package from source 'C:\ProgramData\Boxstarter\BuildPackages'

tmp4B87.tmp v1.0.0 (forced)
tmp4B87.tmp package files install completed. Performing other installation steps.
 *** LOADING BOXSTARTER ***
Boxstarter: *** HELLO WORLD ***
ERROR: Error !
The install of tmp4B87.tmp was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\tmp4B87.tmp\tools\ChocolateyInstall.ps1'.
 See log for details.

Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - tmp4B87.tmp (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\tmp4B87.tmp\tools\ChocolateyInstall.ps1'.
 See log for details.
++ Boxstarter finished Calling Chocolatey to install tmp4B87.tmp. This may take several minutes to complete... 00:00:08.3585828
True
Boxstarter: Restore Automatic Updates from Windows Update

Errors       : {}
ComputerName : localhost
Completed    : True
FinishTime   : 12.06.2024 15:42:59
StartTime    : 12.06.2024 15:42:49

Additional Context

No response

pl31 commented 4 weeks ago

I was able to find the last version, where this was working.

With:

Boxstarter 2.13.0
Boxstarter.Bootstrapper 2.13.0
Boxstarter.Chocolatey 2.13.0
Boxstarter.Common 2.13.0
Boxstarter.HyperV 2.13.0
Boxstarter.WinConfig 2.13.0
chocolatey 2.3.0

the command + script:

Install-BoxstarterPackage -DisableReboots -DisableRestart .\test.ps1

returns:

Errors       : {Chocolatey reported an unsuccessful exit code of 1. See
               C:\Users\pt2d7sys\AppData\Local\Boxstarter\boxstarter.log for details.}
ComputerName : localhost
Completed    : True
FinishTime   : 12.06.2024 16:59:55
StartTime    : 12.06.2024 16:59:51

Either there is a regression or a feature change from 2.13.0 to 3.0.0.

mwallner commented 3 weeks ago

hey @pl31 , thanks for bringing this up. this is an issue we were not aware of up to this point.