evilmartians / lefthook

Fast and powerful Git hooks manager for any type of projects.
MIT License
4.86k stars 212 forks source link

Rename release executables to allow for scripting on Unix #559

Open sanmai-NL opened 1 year ago

sanmai-NL commented 1 year ago

:zap: Summary

The hardware platform suffix for Linux builds is now amd64 or arm64. Change this for more reliable automation in provisioning.

Value

Make container builds work with automated fetching of the released Lefthook executable, even under virtualized Linux such as Docker Desktop, Rancher Desktop, Podman Desktop on MacOS.

Behavior and configuration changes

The problem:

/ # uname -m
aarch64
/ # uname -h
BusyBox v1.36.1 (2023-07-27 17:12:24 UTC) multi-call binary.

Usage: uname [-amnrspvio]

Print system information

        -a      Print all
        -m      Machine (hardware) type
        -n      Hostname
        -r      Kernel release
        -s      Kernel name (default)
        -p      Processor type
        -v      Kernel version
        -i      Hardware platform
        -o      OS name
/ # uname -p
unknown
/ # uname -i
unknown

Follow uname -m as hardware platform suffix. So that this script works:

#!/bin/sh
set -eux
curl \
  --fail \
  --location \
  --output /usr/local/bin/lefthook \
  --proto '=https' \
  --show-error \
  --silent \
  --tlsv1.3 \
  -- \
  "https://github.com/evilmartians/lefthook/releases/download/v1.4.9/lefthook_1.4.9_Linux_$(uname -m)"
chmod \
  a+x \
  -- \
  /usr/local/bin/lefthook
mrexox commented 1 year ago

We decided to keep arm64 for ARM 64 architectures, so please, use uname -m | sed 's/aarch64/arm64/. This is because on macOS uname -m returns arm64, and on Linux it is aarch64. The decision was made a long time ago, and I don't want to change this to not break the things.

But I can probably add an artifact with aarch64 name in new releases. Do you feel OK about it?

sanmai-NL commented 1 year ago

The suffix can be Linux-only, no?

sanmai-NL commented 11 months ago

@mrexox adding a duplicate artifact is fine. What about migrating to the new suffix scheme for new releases only? How would that break things?

mrexox commented 11 months ago

It probably won't break things if other people don't rely on this of course. So, you suggest to change the artifact lefthook_1.5.2_Linux_arm64 to lefthook_1.5.2_Linux_aarch64, right?

sanmai-NL commented 11 months ago

Well that but only for future releases, if needed.