woodpecker-ci / woodpecker

Woodpecker is a simple, yet powerful CI/CD engine with great extensibility.
https://woodpecker-ci.org
Apache License 2.0
4.28k stars 369 forks source link

Cannot get repos in GitLab #2758

Closed haxung closed 11 months ago

haxung commented 1 year ago

Component

cli, web-ui

Describe the bug

GitLab server version: 14.3.4 woodpecker server version: 1.0.4 woodpecker-cli version: 1.0.4

I cannot see any repos in /repos. So I download woodpecker-cli, here is the result:

$ woodpecker repo sync
AA_Bcc/ifly_search_intent (id: 0, forgeRemoteID: 48439)
who/milvus-benchmark (id: 0, forgeRemoteID: 48392)
......

Here is the repos (But I cannot see repos like a/b/c, just a/b, this is just first bug).

$ woodpecker repo list
# there is nothing to show

I don't know why I cannot see any repos.

$ woodpecker repo info
4:02PM FTL error running cli error="strconv.ParseInt: parsing \"\": invalid syntax"

Looks like error happened at strconv.ParseInt() function.

System Info

{
    "source": "https://github.com/woodpecker-ci/woodpecker",
    "version": "1.0.4"
}

Additional context

No response

Validations

haxung commented 1 year ago

How I can add repo via woodpecker-cli by repo id, just like this:

woodpecker repo add 48444

But this is so terrible and ugly. Have any effective ways to sync repos?

qwerty287 commented 11 months ago

Most of these aren't bugs, but incorrect usage (or enhancement requests). Please read the docs before opening issues.

  1. woodpecker repo list is not a valid command. Use woodpecker repo ls.
  2. woodpecker repo info must be used together with a repo name/id

I cannot see any repos in /repos.

There has been some bugfixes for this recently. Can you retry with the latest version?

But this is so terrible and ugly. Have any effective ways to sync repos?

When listing all repos, this ID is displayed (forgeRemoteID).

haxung commented 11 months ago

You are right that I should use woodpecker repo ls. However, when run woodpecker repo sync | wc -l, I can see 133 repos(In fact, there are many repos like groupA/subgroupB/projectC not in list). image

If I add those repos in web UI, I must run woodpecker repo add <forgeRemoteID> 133 times or run a shell script, that is unreasonable. Would add a button sync repo in web UI or run woodpecker repo sync, then repos will show on web UI?

Here is woodpecker version: image And when I upgrade image version: image I run woodpecker repo sync | wc -l again, here is the result: image I lost more repos info. Looks like only show those repos that I have owner or maintainer permission.

qwerty287 commented 11 months ago

Let me explain these commands:

  1. repo sync: this fetches all repos from forge and shows them. This includes enabled and non-enabled repos.
  2. repo ls: this only shows enabled repos.
  3. repo add: this enables a repository.

Looks like only show those repos that I have owner or maintainer permission.

That's expected. repo sync should be used if you want to enable a new repo and you can only enable repos if you can create webhooks for it in forge which requires admin permissions. Actually, repo sync is just the same what you can see when clicking the "Add repository" button in web ui. Clicking the "enable" button in this list is the same as repo add.

haxung commented 11 months ago

It's strange that when I click "Add repository" before, there are nothing show on web UI. Now it's ok, and I can see enable button in each repo box(maybe 133 repos are too many to show them). Thank u for your help. The latest question: Have any plans to support repo like groupA/subgroupB/projectC?

qwerty287 commented 11 months ago

The latest question: Have any plans to support repo like groupA/subgroupB/projectC?

We did a lot of preparation work in this direction, but I actually thought these should work now. @anbraten I think the corresponding issue was closed when the repo-id PR was merged. Was this verified to work?