-
Notifications
You must be signed in to change notification settings - Fork 1
/
gitlab_cli.sh
executable file
·36 lines (29 loc) · 964 Bytes
/
gitlab_cli.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
set -euo pipefail
trap "echo 'error: Script failed: see failed command above'" ERR
DIR=$(cd "$(dirname "$0")" && pwd)
source "$DIR/.lib.sh"
# installs GitLab CLI https://gitlab.com/gitlab-org/cli
# vars
# https://gitlab.com/gitlab-org/cli/-/releases
VERSION='1.36.0'
TOOL_NAME='GitLab CLI'
DOWNLOAD_URL="https://gitlab.com/gitlab-org/cli/-/releases/v${VERSION}/downloads/glab_${VERSION}_Linux_x86_64.deb"
DOWNLOAD_DIR=$(mktemp --directory)
DOWNLOAD_PATH="$DOWNLOAD_DIR/glab.deb"
# prep
start "$TOOL_NAME"
mkdir -p "$DOWNLOAD_DIR"
# download
curl --location "$DOWNLOAD_URL" --output "$DOWNLOAD_PATH"
# install
# sudo dpkg-query -l | grep glab
# sudo dpkg --remove glab
sudo dpkg --install "$DOWNLOAD_PATH"
# cleanup
rm -fr "$DOWNLOAD_DIR"
# info
end 'glab' '--version'
echo 'Use the commands below log in to your GitLab instance:'
echo 'glab auth login -h'
echo 'glab auth login --hostname "gitlab.company.com" --token "MY_ACCESS_TOKEN"'