Merge branch 'origin/main' into 'next-release/main'

This commit is contained in:
oauth 2024-11-28 14:35:28 +00:00
commit 4fa2fd3cf8
3 changed files with 16 additions and 8 deletions

View file

@ -130,7 +130,7 @@ func PostRepo(c *gin.Context) {
if errors.Is(err, types.RecordNotExist) {
org, err = _forge.Org(c, user, repo.Owner)
if err != nil {
msg := "could not fetch organization from forge."
msg := fmt.Sprintf("Organization %s not found in DB. Attempting to create new one.", repo.Owner)
log.Error().Err(err).Msg(msg)
c.String(http.StatusInternalServerError, msg)
return
@ -139,7 +139,7 @@ func PostRepo(c *gin.Context) {
org.ForgeID = user.ForgeID
err = _store.OrgCreate(org)
if err != nil {
msg := "could not create organization in store."
msg := fmt.Sprintf("Failed to create organization %s.", repo.Owner)
log.Error().Err(err).Msg(msg)
c.String(http.StatusInternalServerError, msg)
return

View file

@ -749,7 +749,7 @@ func (g *GitLab) Org(ctx context.Context, u *model.User, owner string) (*model.O
groups, _, err := client.Groups.ListGroups(&gitlab.ListGroupsOptions{
ListOptions: gitlab.ListOptions{
Page: 1,
PerPage: 1,
PerPage: perPage,
},
Search: gitlab.Ptr(owner),
}, gitlab.WithContext(ctx))
@ -757,13 +757,21 @@ func (g *GitLab) Org(ctx context.Context, u *model.User, owner string) (*model.O
return nil, err
}
if len(groups) != 1 {
var matchedGroup *gitlab.Group
for _, group := range groups {
if group.FullPath == owner {
matchedGroup = group
break
}
}
if matchedGroup == nil {
return nil, fmt.Errorf("could not find org %s", owner)
}
return &model.Org{
Name: groups[0].FullPath,
Private: groups[0].Visibility != gitlab.PublicVisibility,
Name: matchedGroup.FullPath,
Private: matchedGroup.Visibility != gitlab.PublicVisibility,
}, nil
}

View file

@ -388,8 +388,8 @@
},
"general": "Allgemein",
"netrc_only_trusted": {
"desc": "Wenn aktiviert, werden Git-Zugangsdaten nur für vertrauenswürdige Plugins zum Klonen, die in `WOODPECKER_PLUGINS_TRUSTED_CLONE` gesetzt sind, zur Verfügung gestellt. Ansonsten können eigene Plugins zum Klonen die Git-Zugangsdaten verwenden. Diese Option hat keinen Effekt auf Schritte, die nicht zum Klonen da sind.",
"netrc_only_trusted": "Git-Zugangsdaten nur in vertrauenswürdigen Plugins zum Klonen bereitstellen"
"desc": "Hier gelistete Plugins erhalten Zugriff zu Netrc-Zugangsdaten, die genutzt werden können, um Repositorys von der Forge zu klonen oder zu pushen.",
"netrc_only_trusted": "Eigene vertrauenswürdige Plugins zum Klonen"
},
"pipeline_path": {
"default": "Standardmäßig: .woodpecker/*.{'{yaml,yml}'} -> .woodpecker.yaml -> .woodpecker.yml",