add full uri any git repos
All checks were successful
docker-build / Build image (push) Successful in 43s
All checks were successful
docker-build / Build image (push) Successful in 43s
This commit is contained in:
@@ -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{
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user