Skip to content

Fix build-and-deploy on self-hosted ARM64 agents #10

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

Merged
merged 1 commit into from
Jan 3, 2023

Conversation

dscho
Copy link
Member

@dscho dscho commented Jan 2, 2023

The underlying problem why earlier attempts to deploy mingw-w64-aarch64-git-extra failed (e.g. this one) has nothing to do with ARM64 at all. The problem is that GNU Privacy Guard wants to put a socket into ~/.gnupg/ whose complete path (including NUL byte) has to fit within a mere 108 bytes.

With this proposed work-around, the build succeeded (I specifically only ran the build, not the deploy part just yet, so that we can verify that the build actually worked).

The path `${{ github.workspace }}/home` was apparently almost too long
already, with the repository name `git-for-windows-automation` repeated
_twice_ in it, and when we started using self-hosted runners whose agent
directory is called `C:\actions-runner` (as opposed to GitHub hosted
runners that have it in `D:\a`), it tipped the balance.

This matters because we want to use GNU Privacy Guard, which insists on
the full path of the `gpg-agent` socket to fit inside
`sockaddr_un.sun_path` (which only 108 bytes long). The symptom we see
is that importing GPG keys fails with a lapidary "gpg: can't connect to
the agent: IPC connect call failed".

The secret is lifted only when debugging a big further, e.g. by adding
a `gpg-agent.conf` in `$HOME/.gnupg/` with contents like this one:

	debug-level guru
	debug-all
	log-file /tmp/gpg-agent.debug.log

Then, that log file will contain some hints like this one:

	2023-01-02 20:46:25 gpg-agent[1018] listening on socket '/c/actions-runner/_work/git-for-windows-automation/git-for-windows-automation/home//.gnupg/S.gpg-agent'
	2023-01-02 20:46:25 gpg-agent[1018] socket name '/c/actions-runner/_work/git-for-windows-automation/git-for-windows-automation/home//.gnupg/S.gpg-agent.extra' is too long

A similar issue was reported at
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=847206, but sadly the
suggested command `gpgconf --create-socketdir` fails, not only because
`/run/user/<uid>` does not exist, but even when that directory is
created, the command falls prey to the vast differences between Windows'
and Unix' permission model, and it thinks that the directory's
permissions are too lax and refuses to do its job.

So let's do the next best thing and use a home directory that is not
inside a deep path, but instead directly inside the runner's temporary
path.

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho dscho requested review from rimrul and dennisameling January 2, 2023 21:40
@dscho
Copy link
Member Author

dscho commented Jan 2, 2023

Here are the artifacts for verifying purposes.

Copy link
Contributor

@dennisameling dennisameling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement, thank you! This basically changes the $HOME path from:

D:\a\_work\git-for-windows-automation\git-for-windows-automation\home

to

D:\a\_work\_temp\home

From 69 to 21 characters. Love it 🚀

@dscho dscho merged commit 6b1fdd9 into git-for-windows:main Jan 3, 2023
@dscho dscho deleted the fix-build-and-deploy-on-arm64 branch January 3, 2023 08:54
@dscho dscho self-assigned this Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants