Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make it easier to use garm-cli pool create #292

Open
rgl opened this issue Sep 22, 2024 · 4 comments
Open

make it easier to use garm-cli pool create #292

rgl opened this issue Sep 22, 2024 · 4 comments

Comments

@rgl
Copy link

rgl commented Sep 22, 2024

trying to create a new pool for a given repo we currently have to use the repo id, which is somewhat cumbersome, because there is no apparent way to get the repo id from a name. we have to use garm-cli repo list and manually parse the id from the output, which is quite cumbersome and error prone.

for example, trying this:

./garm-cli pool create \
  --enabled true \
  --min-idle-runners 0 \
  --max-runners 2 \
  --tags azure,ubuntu \
  --repo terraform-azure-garm-example-repository \
  --provider-name azure \
  --os-arch amd64 \
  --os-type linux \
  --flavor Standard_F8s \
  --image Canonical:0001-com-ubuntu-server-jammy:22_04-lts-gen2:22.04.202206040

resulted in cryptic garm-cli error:

Error: [POST /repositories/{repoID}/pools][500] CreateRepoPool default {"error":"Server error","details":""}

and looking at the garm logs we have another cryptic error:

time=2024-09-22T06:50:42.131Z level=ERROR msg="error creating repository pool" error="failed to create pool: parsing id: invalid request"

can these errors be somehow improved?

can there be an easier way for creating pools? or maybe, to list repos as json (and to find repos by their properties (e.g. name))?

@gabriel-samfira
Copy link
Member

Yes to most of the questions, "maybe" to referencing repo by name.

The reason for that is that garm supports ghes and github. There is the slim (but still possible) chance that you may have the same owner and repo combination in both and both are configured in garm.

There is a way to do this with an extra query. Given that it's a pain in the behind to keep copying that ID, it may be worth adding.

Will create a pr next week as time permits.

@gabriel-samfira
Copy link
Member

Added a --format option to the CLI:

@gabriel-samfira
Copy link
Member

as for referencing by name, I will try to create a PR for that as well. Repos actually have 2 components. The owner and the name of the repo. You and I can both have a repo with the same name. So to identify a repo, we'd need to specify something like gabriel-samfira/garm. Orgs and enterprises are made up of just the name.

@gabriel-samfira
Copy link
Member

In the case of the cryptic error, that's indeed a problem. It shouldn't be a 500 error. I need to go through the code and make sure that errors.Wrap() is used instead of fmt.Errorf(). At least until we have a chance to migrate to the standard package.

This was started here:

Will go through the rest of the files in the following days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants