Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build-and-deploy: use update-via-pacman.ps1, if available #29

Closed
dscho opened this issue Feb 8, 2023 · 1 comment · Fixed by #61
Closed

build-and-deploy: use update-via-pacman.ps1, if available #29

dscho opened this issue Feb 8, 2023 · 1 comment · Fixed by #61

Comments

@dscho
Copy link
Member

dscho commented Feb 8, 2023

Currently the build-and-deploy workflow fails when one of the "system packages" (like bash, msys2-runtime, pacman or filesystem) need to be updated: pacman -Syyu --noconfirm "helpfully" terminates every Bash instance, including the current process, after the system packages have been updated.

To help with this issue in their sync workflows, the git-sdk-* repositories are now equipped with a PowerShell script that runs pacman and fixes things up as necessary.

Let's use the same script in build-and-deploy.

The only complication would be if we used any Git for Windows SDK flavor other than full because that script would not be there in that case.

But: currently we use this full flavor in all instances except when building mingw-w64-git (which is however not the plan to do anyway, we're developing the git-artifacts workflow for that purpose).

Besides, we could easily teach please.sh create-sdk-artifact build-installers to include that script. Or extend the makepkg-git sparse-checkout definitions in all three git-sdk-* repositories to include that script. It's not like it's large 😁

@dscho
Copy link
Member Author

dscho commented Nov 23, 2023

This is actually quite important to have, as I found out today. The reason is that we currently run pacman -Syyu in a Bash step. And as I found out the hard way (but not immediately, it took a failed re-run for me to realize what was going on, which was particularly annoying because the aarch64 builds have a 7-minute time tax to spin up a self-hosted runner):

[...]
:: Processing package changes...
upgrading msys2-runtime...
upgrading msys2-runtime-devel...
:: To complete this update all MSYS2 processes including this terminal will be closed. Confirm to proceed [Y/n] SUCCESS: The process with PID 7016 has been terminated.
Error: Process completed with exit code 1.

The reason is that pacman -Syyu, when it upgrades the msys2-runtime package, is designed to stop any processes using the MSYS2 runtime. And that includes... drum roll... Bash! Including the Bash step running pacman -Syyu!

The same would happen, of course, if bash had been upgraded since the last sync run that would synchronize the git-sdk-* repositories.

So yeah, we need this.

This should work:

- name: pacman -Syyu
  shell: powershell
  run: |
    # figure out where the Git for Windows SDK is installed; It adds /usr/bin to the PATH
    $git_sdk = ($env:PATH.split(';') | where { $_.EndsWith('\usr\bin') } | select-object -first 1).TrimEnd('\usr\bin')
    & ($git_sdk + "\update-via-pacman.ps1")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant