Closed JorritSalverda closed 8 years ago
All custom Powershell is run from a chocolatey package and if chocolatey captures an error, it will fail and emit an exit code of 1. Some things to try to troubleshoot:
Write-Error
in your trap
to write-output
at least temporarily to see if choco may be hiding stderr.cmd /c
just run it directly from the current powershell session. Since you just installed git, you may have to add git manually to your path with `$env:path += "C:/Program Files/Git/cmd;C:/Program Files/Git/usr/bin"I'm assuming this is a private repo? Otherwise I'd use https instead of ssh.
That didn't help, neither does wrapping the git clone in a try/catch.
Could it be that is uses too much memory? I use this to set the max memory:
winrm set winrm/config/winrs @{MaxMemoryPerShellMB=\"4096\"}
depends on where in the packer build you are doing this. If you are running it from a packer provisioner it is possible since that runs under winrm. Not at all likely if you are running it from the initial boot.
However if that was the case, I'd expect a OutOfMemoryException which you would see if you captured the error in a try/catch and wrote out the error message.
I've managed to work around it by moving the git clone out of the boxstarter package but still in the packer build. A consecutive git pull gave the same issue, so keeping it outside of the boxstarter package as well. I might give it another try in the future, but it already cost me a week so perhaps there's better stuff to do :)
When running the following boxstarter script it fails with 'Chocolatey reported an unsuccessful exit code of 1.'. When leaving out the git clone it works without errors though, so it's unlikely there's a chocolatey error.
When inspecting $LastExitCode directly after the git clone it returns 0, even without the || exit 0 in the command.
ExecCommand does the following.
I've printed the last 200 lines of the boxstarter.log - the task hangs if I print the full log - but I don't see anything notable in there:
All this runs from a packer job. Is there anything you can think of that can cause this?