skip nested GitLab repositories during sync (#656)

Implements https://github.com/woodpecker-ci/woodpecker/pull/651#issuecomment-1003794674, partly fixes #648
This commit is contained in:
jdoubleu 2022-01-03 16:35:46 +01:00 committed by GitHub
parent 7e6765ce95
commit 132d3567f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,7 @@ import (
"net/url"
"strings"
"github.com/rs/zerolog/log"
"github.com/xanzy/go-gitlab"
"github.com/woodpecker-ci/woodpecker/server"
@ -249,6 +250,13 @@ func (g *Gitlab) Repos(ctx context.Context, user *model.User) ([]*model.Repo, er
if err != nil {
return nil, err
}
// TODO(648) remove when woodpecker understands nested repos
if strings.Count(repo.FullName, "/") > 1 {
log.Debug().Msgf("Skipping nested repository %s for user %s, because they are not supported, yet (see #648).", repo.FullName, user.Login)
continue
}
repos = append(repos, repo)
}