From 7e045d967818242481b6693377982277839275cc Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Tue, 17 Dec 2024 11:15:56 +0100 Subject: [PATCH] Add support for using a HTTPS catalog URL for arbitrary catalogs --- gitlab/commodore-compile.jsonnet | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gitlab/commodore-compile.jsonnet b/gitlab/commodore-compile.jsonnet index 5ce2bb2..5fc68e0 100644 --- a/gitlab/commodore-compile.jsonnet +++ b/gitlab/commodore-compile.jsonnet @@ -27,8 +27,18 @@ local gitInsteadOf(cluster) = // prefix ssh://git@ 0 == ssh, 1 == '', 2 == std.join('/', std.split(cluster_repo, '/')[3:]); + local https_catalog = if std.startsWith(cluster_repo, 'https://') then + std.substr(cluster_repo, std.length('https://'), std.length(cluster_repo)); + local catalogInsteadOf = - if catalog_path != null then + if https_catalog != null then + [ + 'git config --global url."https://%(catalog_user)s:%(access_token)s@%(https_catalog)s".insteadOf https://%(https_catalog)s' % { + access_token: cluster_access_token, + https_catalog: https_catalog, + }, + ] + else if catalog_path != null then [ 'git config --global url."https://gitlab-ci-token:%(access_token)s@%(gitlab_fqdn)s/%(catalog_path)s".insteadOf ssh://git@${CI_SERVER_SHELL_SSH_HOST}/%(catalog_path)s' % { access_token: cluster_access_token,