Files
cmake/.devcontainer/install_glab.sh
T
Taylor Braun-Jones 69c15636b6 devcontainer: Add the GitLab CLI and glab-axi
Install `glab`, the GitLab CLI, and `glab-axi`, an agent-ergonomic
wrapper around it, in the development container.

Default `GITLAB_HOST` to `gitlab.kitware.com` so that both address our
GitLab instance without further configuration, persist the `glab`
configuration directory on a volume so that a credential need be created
only once, and pass a `GITLAB_TOKEN` or `GITLAB_CLIENT_ID` from the host
through to the container.

Neither tool can authenticate on its own, so check for a working
credential each time a tool attaches to the container and print what
remains to be set up if there is none.
2026-09-08 16:23:53 +00:00

44 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# Install the GitLab CLI, `glab`, and `glab-axi`, an agent-ergonomic wrapper
# around it. Neither is provided by the distribution.
# See `Help/dev/devcontainer.rst`.
set -e
readonly glab_version="1.114.0"
readonly glab_axi_version="0.6.0"
case "$(uname -m)" in
x86_64)
arch="amd64"
sha256sum="00e892a80d586a1e8b8fdc035321923db99dce0caa3b0c4fd72c5337ffdb1c48"
;;
aarch64)
arch="arm64"
sha256sum="d34d7ddb96ce5e5f3423d7e8053cb14c36bd93984e4b96320f7e20a341b83498"
;;
*)
echo "Unsupported architecture: $(uname -m)" >&2
exit 1
;;
esac
readonly filename="glab_${glab_version}_linux_${arch}.tar.gz"
readonly baseurl="https://gitlab.com/gitlab-org/cli/-/releases/v${glab_version}/downloads"
cd /tmp
curl -L -o "$filename" "$baseurl/$filename"
echo "$sha256sum $filename" > glab.sha256sum
sha256sum --check glab.sha256sum
tar -C /usr/local -xzf "$filename" bin/glab
rm "$filename" glab.sha256sum
# Enable shell completion for interactive use.
mkdir -p /etc/bash_completion.d
/usr/local/bin/glab completion --shell bash > /etc/bash_completion.d/glab
# `glab-axi` is distributed only through npm. Its command surface is
# documented at https://axi.md.
npm install --global --no-audit --no-fund "glab-axi@${glab_axi_version}"