Skip to content

Commit 86eccd9

Browse files
committed
fix(lib): stabilize glab package download
1 parent ba06522 commit 86eccd9

5 files changed

Lines changed: 12 additions & 4 deletions

File tree

packages/app/src/lib/core/templates/glab.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const glabVersion = "1.93.0"
2+
const glabPackageBaseUrl = `https://gitlab.com/api/v4/projects/gitlab-org%2Fcli/packages/generic/glab/${glabVersion}`
23

34
export const renderDockerfileGlab = (): string =>
45
`# Tooling: GitLab CLI (glab)
@@ -13,7 +14,7 @@ RUN set -eu; \
1314
s390x) GLAB_ARCH="s390x" ;; \
1415
*) echo "Unsupported glab architecture: $ARCH" >&2; exit 1 ;; \
1516
esac; \
16-
curl -fsSL "https://gitlab.com/gitlab-org/cli/-/releases/v${glabVersion}/downloads/glab_${glabVersion}_linux_\\$GLAB_ARCH.deb" -o /tmp/glab.deb; \
17+
curl -fsSL --retry 5 --retry-all-errors --retry-delay 2 "${glabPackageBaseUrl}/glab_${glabVersion}_linux_$GLAB_ARCH.deb" -o /tmp/glab.deb; \
1718
apt-get update; \
1819
apt-get install -y --no-install-recommends /tmp/glab.deb; \
1920
rm -f /tmp/glab.deb; \

packages/app/src/lib/usecases/gitlab-auth-image.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const gitlabImageName = "docker-git-auth-gitlab:latest"
1313
export const gitlabImageDir = ".docker-git/.orch/auth/gitlab/.image"
1414

1515
const glabVersion = "1.93.0"
16+
const glabPackageBaseUrl = `https://gitlab.com/api/v4/projects/gitlab-org%2Fcli/packages/generic/glab/${glabVersion}`
1617

1718
export const renderGlabDockerfile = (): string =>
1819
String.raw`FROM ubuntu:24.04
@@ -29,7 +30,7 @@ RUN apt-get update \
2930
s390x) GLAB_ARCH="s390x" ;; \
3031
*) echo "Unsupported glab architecture: $ARCH" >&2; exit 1 ;; \
3132
esac \
32-
&& curl -fsSL "https://gitlab.com/gitlab-org/cli/-/releases/v${glabVersion}/downloads/glab_${glabVersion}_linux_\${GLAB_ARCH}.deb" -o /tmp/glab.deb \
33+
&& curl -fsSL --retry 5 --retry-all-errors --retry-delay 2 "${glabPackageBaseUrl}/glab_${glabVersion}_linux_$GLAB_ARCH.deb" -o /tmp/glab.deb \
3334
&& apt-get install -y --no-install-recommends /tmp/glab.deb \
3435
&& rm -f /tmp/glab.deb \
3536
&& rm -rf /var/lib/apt/lists/*

packages/lib/src/core/templates/glab.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const glabVersion = "1.93.0"
2+
const glabPackageBaseUrl = `https://gitlab.com/api/v4/projects/gitlab-org%2Fcli/packages/generic/glab/${glabVersion}`
23

34
export const renderDockerfileGlab = (): string =>
45
`# Tooling: GitLab CLI (glab)
@@ -13,7 +14,7 @@ RUN set -eu; \
1314
s390x) GLAB_ARCH="s390x" ;; \
1415
*) echo "Unsupported glab architecture: $ARCH" >&2; exit 1 ;; \
1516
esac; \
16-
curl -fsSL "https://gitlab.com/gitlab-org/cli/-/releases/v${glabVersion}/downloads/glab_${glabVersion}_linux_\\$GLAB_ARCH.deb" -o /tmp/glab.deb; \
17+
curl -fsSL --retry 5 --retry-all-errors --retry-delay 2 "${glabPackageBaseUrl}/glab_${glabVersion}_linux_$GLAB_ARCH.deb" -o /tmp/glab.deb; \
1718
apt-get update; \
1819
apt-get install -y --no-install-recommends /tmp/glab.deb; \
1920
rm -f /tmp/glab.deb; \

packages/lib/src/usecases/gitlab-auth-image.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const gitlabImageName = "docker-git-auth-gitlab:latest"
1313
export const gitlabImageDir = ".docker-git/.orch/auth/gitlab/.image"
1414

1515
const glabVersion = "1.93.0"
16+
const glabPackageBaseUrl = `https://gitlab.com/api/v4/projects/gitlab-org%2Fcli/packages/generic/glab/${glabVersion}`
1617

1718
export const renderGlabDockerfile = (): string =>
1819
String.raw`FROM ubuntu:24.04
@@ -29,7 +30,7 @@ RUN apt-get update \
2930
s390x) GLAB_ARCH="s390x" ;; \
3031
*) echo "Unsupported glab architecture: $ARCH" >&2; exit 1 ;; \
3132
esac \
32-
&& curl -fsSL "https://gitlab.com/gitlab-org/cli/-/releases/v${glabVersion}/downloads/glab_${glabVersion}_linux_\${GLAB_ARCH}.deb" -o /tmp/glab.deb \
33+
&& curl -fsSL --retry 5 --retry-all-errors --retry-delay 2 "${glabPackageBaseUrl}/glab_${glabVersion}_linux_$GLAB_ARCH.deb" -o /tmp/glab.deb \
3334
&& apt-get install -y --no-install-recommends /tmp/glab.deb \
3435
&& rm -f /tmp/glab.deb \
3536
&& rm -rf /var/lib/apt/lists/*

packages/lib/tests/core/templates.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ describe("renderDockerfile", () => {
5959

6060
expectContainsAll(dockerfile, [
6161
"# Tooling: GitLab CLI (glab)",
62+
"https://gitlab.com/api/v4/projects/gitlab-org%2Fcli/packages/generic/glab/",
63+
"glab_1.93.0_linux_$GLAB_ARCH.deb",
64+
"curl -fsSL --retry 5 --retry-all-errors --retry-delay 2",
6265
"glab --version",
6366
'ARG DOCKER_GIT_SESSION_SYNC_PACKAGE="@prover-coder-ai/docker-git-session-sync@latest"',
6467
'COPY .docker-git-tools/docker-git-session-sync /opt/docker-git/tools/docker-git-session-sync',
@@ -67,6 +70,7 @@ describe("renderDockerfile", () => {
6770
"using local session sync fallback",
6871
"install -m 0755 /opt/docker-git/tools/docker-git-session-sync /usr/local/bin/docker-git-session-sync"
6972
])
73+
expect(dockerfile).not.toContain("glab_1.93.0_linux_\\$GLAB_ARCH.deb")
7074
})
7175
})
7276

0 commit comments

Comments
 (0)