File tree Expand file tree Collapse file tree 2 files changed +36
-8
lines changed Expand file tree Collapse file tree 2 files changed +36
-8
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"id" : " gitlab-cli" ,
3
- "version" : " 1.0 .0" ,
3
+ "version" : " 1.1 .0" ,
4
4
"name" : " GitLab CLI" ,
5
5
"documentationURL" : " https://github.com/skriptfabrik/devcontainer-features/tree/main/src/gitlab-cli" ,
6
6
"description" : " Installs GitLab CLI (glab)." ,
7
+ "options" : {
8
+ "version" : {
9
+ "type" : " string" ,
10
+ "proposals" : [
11
+ " latest"
12
+ ],
13
+ "default" : " latest" ,
14
+ "description" : " Select or enter a gitlab-cli version."
15
+ }
16
+ },
7
17
"installsAfter" : [
8
18
" ghcr.io/devcontainers/features/common-utils"
9
19
]
Original file line number Diff line number Diff line change 2
2
3
3
set -e
4
4
5
+ CLI_VERSION=" ${VERSION:- " latest" } "
6
+
5
7
if [ " $( id -u) " -ne 0 ]; then
6
8
echo -e ' Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
7
9
exit 1
18
20
19
21
# Install prerequisites
20
22
apt-get -y update
21
- apt-get -y install --no-install-recommends curl ca-certificates
22
-
23
- # Add WakeMeOps repository
24
- curl -sSL " https://raw.githubusercontent.com/upciti/wakemeops/main/assets/install_repository" | bash
25
-
26
- # Install glab
27
- apt-get -y install --no-install-recommends glab
23
+ apt-get -y install --no-install-recommends curl ca-certificates jq git
28
24
29
25
# Clean up
30
26
apt-get -y clean
31
27
rm -rf /var/lib/apt/lists/*
28
+
29
+ # Fetch latest version if needed
30
+ if [ " ${CLI_VERSION} " = " latest" ]; then
31
+ CLI_VERSION=$( curl -s curl -s https://gitlab.com/api/v4/projects/34675721/releases | jq -r ' .[0].tag_name' | awk ' {print substr($1, 2)}' )
32
+ fi
33
+
34
+ # Detect current machine architecture
35
+ if [ " $( uname -m) " = " aarch64" ]; then
36
+ ARCH=" arm64"
37
+ else
38
+ ARCH=" amd64"
39
+ fi
40
+
41
+ # DEB package and download URL
42
+ DEB_PACKAGE=" glab_${CLI_VERSION} _linux_${ARCH} .deb"
43
+ DOWNLOAD_URL=" https://gitlab.com/gitlab-org/cli/-/releases/v${CLI_VERSION} /downloads/${DEB_PACKAGE} "
44
+
45
+ # Download and install gitlab-cli
46
+ echo " Downloading gitlab-cli from ${DOWNLOAD_URL} "
47
+ curl -sSLO " ${DOWNLOAD_URL} "
48
+ dpkg -i " ${DEB_PACKAGE} "
49
+ rm -f " ${DEB_PACKAGE} "
You can’t perform that action at this time.
0 commit comments