Description
One thing is to make module installation parallel.
current:
https://github.com/actions/virtual-environments/blob/4de7f89a42529d48d04cc7a7eb85b570b709448c/images/linux/scripts/installers/azpowershell.sh#L15-L18
new:
parallel --jobs 0 --halt soon,fail=1 'pwsh -Command "Save-Module -Name Az -LiteralPath /usr/share/az_{} -RequiredVersion {} -Force -Verbose"' ::: "${versions[@]}"
I'm pretty sure there could be more actions that can be parallelised in this repo, unfortunately it's quite hard to read all the scripts where everything is mixed together with multiple different downloading tools (since that takes most of the time).
Another option would be (if you care about anywhere from seconds to minutes, I have not measured performance gain) to not run PowerShell, since, lets be honest here, its start-up and performance is just not great in comparison to bash.
Either commit to it completely or don't use it at all.
I've never used packer
so I don't know it's full capabilities/quirks but it's been quite an effort to port one image to Docker and it took lots of time debugging whole thing. It would have been easier if it was done in pure bash or pure PowerShell.
Originally posted by @catthehacker in https://github.com/actions/runner-images/discussions/2320#discussioncomment-229787