coder / coder/backstage-plugins

Auto-cloning a Gitlab repo fails with "unable to update url base from redirection"

Ouverte
#144 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
bug help wanted
Langage dominant
TypeScript
Étoiles
67
Forks
9
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

### Background

My organisation is exploring Coder with the Backstage plugin and Gitlab.com (Gitlab SaaS, i.e. not self-hosted).

In Backstage, before creating anything, the plugin shows:

> No workspaces found for repo
> https://gitlab.com/myorg/myrepo/-/blob/main/?ref_type=heads

We see #117 and the fact a change was made, and also that a merge was made to the git clone module in PR [210](https://github.com/coder/modules/pull/210#issue-2217313475), but we are yet to be able to make it work.

### Challenge

With a template that auto-clones, for example using the `git_clone` module:

```hcl
data "coder_parameter" "repo_url" {
name = "repo_url"
display_name = "Git repository"
}

module "git_clone" {
source = "registry.coder.com/modules/git-clone/coder"
version = "1.0.18"
agent_id = coder_agent.main.id
url = data.coder_parameter.repo_url.value
}
```

We see the clone fail after redirection:

```
Cloning https://gitlab.com/myorg/myrepo/-/blob/main/ to /home/coder/main...
Cloning into '/home/coder/main'...

fatal: unable to update url base from redirection:
asked for: https://gitlab.com/myorg/myrepo/-/blob/main/info/refs?service=git-upload-pack
redirect: https://gitlab.com/groups/myorg/-/saml/sso?redirect=%2Fmyorg%2Fmyrepo%2F-%2Fblob%2Fmain%2Finfo%2Frefs%3Fservice%3Dgit-upload-pack&token=
```

We enforce single sign-on, which may explain the saml/sso redirection.

### Alternatives

If we do not "auto-clone", and instead try and clone from the Workspace template directly (providing "Git repository" in the GUI), providing "https://gitlab.com/myorg/myrepo", then it works.

The downside is that the Backstage plugin won't "match" the Workspace as being related to the Backstage entity (presumably because we omitted the `-/blob/main/?ref_type=heads` suffix).

Has anyone been able to make this work with Gitlab yet please?

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez par le plugin Backstage et le module git_clone référencé dans le modèle ; examinez d’abord l’issue #117 et la PR 210. Reproduisez le problème avec l’URL GitLab se terminant par /-/blob/main/?ref_type=heads et comparez-la à l’URL fonctionnelle de la racine du dépôt. C’est terminé lorsque le clonage automatique réussit avec GitLab SAML SSO et que le workspace correspond toujours à l’entité Backstage.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
git, typescript
Domaine
developer-experience
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.