add full uri any git repos
All checks were successful
docker-build / Build image (push) Successful in 43s

This commit is contained in:
2025-12-07 20:35:56 +07:00
parent 075bf26346
commit 16639c6cd5
9 changed files with 25 additions and 13 deletions

View File

@@ -310,8 +310,15 @@ func (r *GitlabJobRunnerReconciler) constructPodSpec(runner *batchv1alpha1.Gitla
"sh",
"-c",
fmt.Sprintf(`
git clone -b %s --depth 1 https://oauth2:$GITLAB_TOKEN@$(echo $GITLAB_URL | sed 's|https://||')/%s /workspace
`, branch, runner.Spec.RepositoryURL),
REPO_URL="%s"
if echo "$REPO_URL" | grep -q '^https://'; then
# Full URL provided - use it directly with token injection
git clone -b %s --depth 1 $(echo $REPO_URL | sed "s|https://|https://oauth2:$GITLAB_TOKEN@|") /workspace
else
# Relative path - construct URL from GITLAB_URL
git clone -b %s --depth 1 https://oauth2:$GITLAB_TOKEN@$(echo $GITLAB_URL | sed 's|https://||')/$REPO_URL /workspace
fi
`, runner.Spec.RepositoryURL, branch, branch),
},
Env: []corev1.EnvVar{
{