mxschmitt / action-tmate

Debug your GitHub Actions via SSH by using tmate to get access to the runner system itself.
https://mxschmitt.github.io/action-tmate/
MIT License
2.91k stars 289 forks source link

Fix action-tmate on Windows #151

Closed dscho closed 1 year ago

dscho commented 1 year ago

Due to dependency issues, it is currently a bit tricky to install the latest version of the tmate package on in MSYS2 on GitHub's hosted build agents.

The symptom of the current (incorrect) method is that we're running into "Error 127" which means that either an executable or a DLL was not found.

To install the latest version of the tmate package correctly, we would have to do a full upgrade of all installed MSYS2 packages, which would require us to parse the output of the pacman -Syu run to figure out whether system packages were upgraded, in which case a second pacman -Su invocation would be required.

Instead, let's go the simpler route and avoid updating the package index. And then only install the tmate package and its not-yet-installed dependencies. That way, we might not get the latest and greatest tmate version, but we always get one that actually works.

This fixes https://github.com/mxschmitt/action-tmate/issues/147

silverqx commented 1 year ago

--noconfirm PR is nice 😮, but why did you remove -y param., to be sure it doesn't mean yes:

-y, --refresh
           Download a fresh copy of the master package database from the server(s) defined in pacman.conf(5).
m4rc1e commented 1 year ago

Thanks for fixing this!

dscho commented 1 year ago

why did you remove -y param

@silverqx As explained in the PR description, the -y parameter does update the package index, which may result in packages needing to be updated that are considered "system" packages by MSYS2 and that would require a second pass.

To see how complex that can get, have a quick look at https://github.com/git-for-windows/git-sdk-64/blob/HEAD/update-via-pacman.bat. And then weep.

So, as explained in the PR description:

let's go the simpler route and avoid updating the package index.

That means: remove the -y parameter.

What dropping the -y parameter does is: it leaves the package as-is (i.e. as it was when the runner image was created). And then uses that current package index (which might be behind by a couple of days, but really, who cares) to figure out which tmate to install.

As tmate does not really change a lot (https://github.com/tmate-io/tmate/releases shows that the latest release was published before the pandemic, i.e. about a lifetime ago), I would consider this a defensible position.

silverqx commented 1 year ago

You are right, thx for the clarification.