Skip to content

Commit f1fed3c

Browse files
Merge pull request #466 from gabriel-samfira/update-docs-and-defaults
Update docs and deprecate the --all flag
2 parents bb45324 + 80735ac commit f1fed3c

6 files changed

Lines changed: 40 additions & 28 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ Here is a brief architectural diagram of how pools work and how GARM reacts to w
4848

4949
**Scale sets** work differently. While pools (as they are defined in GARM) rely on webhooks to know when a job was started and GARM needs to internally make the right decission in terms of which pool should handle that runner, scale sets have a lot of the scheduling and decission making logic done in GitHub itself.
5050

51-
:warning: **Important note**: The README and documentation in the `main` branch are relevant to the not yet released code that is present in `main`. Following the documentation from the `main` branch for a stable release of GARM, may lead to errors. To view the documentation for the latest stable release, please switch to the appropriate tag. For information about setting up `v0.1.5`, please refer to the [v0.1.5 tag](https://github.com/cloudbase/garm/tree/v0.1.5).
51+
> [!IMPORTANT]
52+
> The README and documentation in the `main` branch are relevant to the not yet released code that is present in `main`. Following the documentation from the `main` branch for a stable release of GARM, may lead to errors. To view the documentation for the latest stable release, please switch to the appropriate tag. For information about setting up `v0.1.6`, please refer to the [v0.1.6 tag](https://github.com/cloudbase/garm/tree/v0.1.6).
5253
53-
:warning: **Important note**: The `main` branch holds the latest code and is not guaranteed to be stable. If you are looking for a stable release, please check the releases page. If you plan to use the `main` branch, please do so on a new instance. Do not upgrade from a stable release to `main`.
54+
> [!CAUTION]
55+
> The `main` branch holds the latest code and is not guaranteed to be stable. If you are looking for a stable release, please check the releases page. If you plan to use the `main` branch, please do so on a new instance. Do not upgrade from a stable release to `main`.
5456
5557
## Join us on slack
5658

cmd/garm-cli/cmd/pool.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,9 @@ Example:
128128
listEnterprisePoolsReq := apiClientEnterprises.NewListEnterprisePoolsParams()
129129
listEnterprisePoolsReq.EnterpriseID = poolEnterprise
130130
response, err = apiCli.Enterprises.ListEnterprisePools(listEnterprisePoolsReq, authToken)
131-
} else if cmd.Flags().Changed("all") {
131+
} else {
132132
listPoolsReq := apiClientPools.NewListPoolsParams()
133133
response, err = apiCli.Pools.ListPools(listPoolsReq, authToken)
134-
} else {
135-
cmd.Help() //nolint
136-
os.Exit(0)
137134
}
138135
default:
139136
cmd.Help() //nolint
@@ -409,11 +406,12 @@ func init() {
409406
poolListCmd.Flags().StringVarP(&poolRepository, "repo", "r", "", "List all pools within this repository.")
410407
poolListCmd.Flags().StringVarP(&poolOrganization, "org", "o", "", "List all pools within this organization.")
411408
poolListCmd.Flags().StringVarP(&poolEnterprise, "enterprise", "e", "", "List all pools within this enterprise.")
412-
poolListCmd.Flags().BoolVarP(&poolAll, "all", "a", false, "List all pools, regardless of org or repo.")
409+
poolListCmd.Flags().BoolVarP(&poolAll, "all", "a", true, "List all pools, regardless of org or repo.")
413410
poolListCmd.Flags().BoolVarP(&long, "long", "l", false, "Include additional info.")
414411
poolListCmd.Flags().StringVar(&endpointName, "endpoint", "", "When using the name of an entity, the endpoint must be specified when multiple entities with the same name exist.")
415412

416-
poolListCmd.MarkFlagsMutuallyExclusive("repo", "org", "all", "enterprise")
413+
poolListCmd.Flags().MarkDeprecated("all", "all pools are listed by default in the absence of --repo, --org or --enterprise.")
414+
poolListCmd.MarkFlagsMutuallyExclusive("repo", "org", "enterprise", "all")
417415

418416
poolUpdateCmd.Flags().StringVar(&poolImage, "image", "", "The provider-specific image name to use for runners in this pool.")
419417
poolUpdateCmd.Flags().UintVar(&priority, "priority", 0, "When multiple pools match the same labels, priority dictates the order by which they are returned, in descending order.")

cmd/garm-cli/cmd/runner.go

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,32 @@ Example:
104104
response, err = apiCli.Instances.ListPoolInstances(listPoolInstancesReq, authToken)
105105
case 0:
106106
if cmd.Flags().Changed("repo") {
107+
runnerRepo, resErr := resolveRepository(runnerRepository, endpointName)
108+
if resErr != nil {
109+
return resErr
110+
}
107111
listRepoInstancesReq := apiClientRepos.NewListRepoInstancesParams()
108-
listRepoInstancesReq.RepoID = runnerRepository
112+
listRepoInstancesReq.RepoID = runnerRepo
109113
response, err = apiCli.Repositories.ListRepoInstances(listRepoInstancesReq, authToken)
110114
} else if cmd.Flags().Changed("org") {
115+
runnerOrg, resErr := resolveOrganization(runnerOrganization, endpointName)
116+
if resErr != nil {
117+
return resErr
118+
}
111119
listOrgInstancesReq := apiClientOrgs.NewListOrgInstancesParams()
112-
listOrgInstancesReq.OrgID = runnerOrganization
120+
listOrgInstancesReq.OrgID = runnerOrg
113121
response, err = apiCli.Organizations.ListOrgInstances(listOrgInstancesReq, authToken)
114122
} else if cmd.Flags().Changed("enterprise") {
123+
runnerEnt, resErr := resolveEnterprise(runnerEnterprise, endpointName)
124+
if resErr != nil {
125+
return resErr
126+
}
115127
listEnterpriseInstancesReq := apiClientEnterprises.NewListEnterpriseInstancesParams()
116-
listEnterpriseInstancesReq.EnterpriseID = runnerEnterprise
128+
listEnterpriseInstancesReq.EnterpriseID = runnerEnt
117129
response, err = apiCli.Enterprises.ListEnterpriseInstances(listEnterpriseInstancesReq, authToken)
118-
} else if cmd.Flags().Changed("all") {
130+
} else {
119131
listInstancesReq := apiClientInstances.NewListInstancesParams()
120132
response, err = apiCli.Instances.ListInstances(listInstancesReq, authToken)
121-
} else {
122-
cmd.Help() //nolint
123-
os.Exit(0)
124133
}
125134
default:
126135
cmd.Help() //nolint
@@ -205,9 +214,12 @@ func init() {
205214
runnerListCmd.Flags().StringVarP(&runnerRepository, "repo", "r", "", "List all runners from all pools within this repository.")
206215
runnerListCmd.Flags().StringVarP(&runnerOrganization, "org", "o", "", "List all runners from all pools within this organization.")
207216
runnerListCmd.Flags().StringVarP(&runnerEnterprise, "enterprise", "e", "", "List all runners from all pools within this enterprise.")
208-
runnerListCmd.Flags().BoolVarP(&runnerAll, "all", "a", false, "List all runners, regardless of org or repo.")
217+
runnerListCmd.Flags().BoolVarP(&runnerAll, "all", "a", true, "List all runners, regardless of org or repo. (deprecated)")
209218
runnerListCmd.Flags().BoolVarP(&long, "long", "l", false, "Include additional info.")
210219
runnerListCmd.MarkFlagsMutuallyExclusive("repo", "org", "enterprise", "all")
220+
runnerListCmd.Flags().StringVar(&endpointName, "endpoint", "", "When using the name of an entity, the endpoint must be specified when multiple entities with the same name exist.")
221+
222+
runnerListCmd.Flags().MarkDeprecated("all", "all runners are listed by default in the absence of --repo, --org or --enterprise.")
211223

212224
runnerDeleteCmd.Flags().BoolVarP(&forceRemove, "force-remove-runner", "f", false, "Forcefully remove a runner. If set to true, GARM will ignore provider errors when removing the runner.")
213225
runnerDeleteCmd.Flags().BoolVarP(&bypassGHUnauthorized, "bypass-github-unauthorized", "b", false, "Ignore Unauthorized errors from GitHub and proceed with removing runner from provider and DB. This is useful when credentials are no longer valid and you want to remove your runners. Warning, this has the potential to leave orphaned runners in GitHub. You will need to update your credentials to properly consolidate.")

doc/gitea.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ garm-cli pool add \
346346
You should now see 1 runner being spun up in LXD. You can check the status of the pool by doing:
347347
348348
```bash
349-
garm-cli runner ls -a
349+
garm-cli runner ls
350350
```
351351
352352
To get more details about the runner, run:

doc/quickstart.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ docker run -d \
133133
-p 80:80 \
134134
-v /etc/garm:/etc/garm:rw \
135135
-v /var/snap/lxd/common/lxd/unix.socket:/var/snap/lxd/common/lxd/unix.socket:rw \
136-
ghcr.io/cloudbase/garm:v0.1.4
136+
ghcr.io/cloudbase/garm:v0.1.6
137137
```
138138

139139
You will notice that we also mounted the LXD unix socket from the host inside the container where the config you pasted expects to find it. If you plan to use an external provider that does not need to connect to LXD over a unix socket, feel free to remove that mount.
@@ -166,7 +166,7 @@ Adding the `garm` user to the LXD group will allow it to connect to the LXD unix
166166
Next, download the latest release from the [releases page](https://github.com/cloudbase/garm/releases).
167167

168168
```bash
169-
wget -q -O - https://github.com/cloudbase/garm/releases/download/v0.1.5/garm-linux-amd64.tgz | tar xzf - -C /usr/local/bin/
169+
wget -q -O - https://github.com/cloudbase/garm/releases/download/v0.1.6/garm-linux-amd64.tgz | tar xzf - -C /usr/local/bin/
170170
```
171171

172172
We'll be running under an unprivileged user. If we want to be able to listen on any port under `1024`, we'll have to set some capabilities on the binary:
@@ -199,7 +199,7 @@ Copy the sample `systemd` service file:
199199

200200
```bash
201201
wget -O /etc/systemd/system/garm.service \
202-
https://raw.githubusercontent.com/cloudbase/garm/v0.1.5/contrib/garm.service
202+
https://raw.githubusercontent.com/cloudbase/garm/v0.1.6/contrib/garm.service
203203
```
204204

205205
Reload the `systemd` daemon and start the service:
@@ -234,7 +234,7 @@ Before we can start using GARM, we need initialize it. This will create the `adm
234234
To initialize GARM, we'll use the `garm-cli` tool. You can download the latest release from the [releases page](https://github.com/cloudbase/garm/releases):
235235

236236
```bash
237-
wget -q -O - https://github.com/cloudbase/garm/releases/download/v0.1.5/garm-cli-linux-amd64.tgz | tar xzf - -C /usr/local/bin/
237+
wget -q -O - https://github.com/cloudbase/garm/releases/download/v0.1.6/garm-cli-linux-amd64.tgz | tar xzf - -C /usr/local/bin/
238238
```
239239

240240
Now we can initialize GARM:
@@ -502,7 +502,7 @@ gabriel@rossak:~$ garm-cli pool add \
502502
If we list the pool we should see it:
503503

504504
```bash
505-
gabriel@rock:~$ garm-cli pool ls -a
505+
gabriel@rock:~$ garm-cli pool ls
506506
+--------------------------------------+---------------------------+--------------+-----------------+------------------+-------+---------+---------------+----------+
507507
| ID | IMAGE | FLAVOR | TAGS | BELONGS TO | LEVEL | ENABLED | RUNNER PREFIX | PRIORITY |
508508
+--------------------------------------+---------------------------+--------------+-----------------+------------------+-------+---------+---------------+----------+
@@ -517,7 +517,7 @@ For the purposes of this guide, we'll increase it to 1 so we have a runner creat
517517
First, list current runners:
518518

519519
```bash
520-
gabriel@rossak:~$ garm-cli runner ls -a
520+
gabriel@rossak:~$ garm-cli runner ls
521521
+----+------+--------+---------------+---------+
522522
| NR | NAME | STATUS | RUNNER STATUS | POOL ID |
523523
+----+------+--------+---------------+---------+
@@ -554,7 +554,7 @@ gabriel@rossak:~$ garm-cli pool update 344e4a72-2035-4a18-a3d5-87bd3874b56c --mi
554554
Now if we list the runners:
555555

556556
```bash
557-
gabriel@rossak:~$ garm-cli runner ls -a
557+
gabriel@rossak:~$ garm-cli runner ls
558558
+----+-------------------+----------------+---------------+--------------------------------------+
559559
| NR | NAME | STATUS | RUNNER STATUS | POOL ID |
560560
+----+-------------------+----------------+---------------+--------------------------------------+

doc/using_garm.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ garm-cli controller show
6666
| Webhook Base URL | https://garm.example.com/webhooks |
6767
| Controller Webhook URL | https://garm.example.com/webhooks/a4dd5f41-8e1e-42a7-af53-c0ba5ff6b0b3 |
6868
| Minimum Job Age Backoff | 30 |
69-
| Version | v0.1.5 |
69+
| Version | v0.1.6 |
7070
+-------------------------+----------------------------------------------------------------------------+
7171
```
7272

@@ -567,10 +567,10 @@ ubuntu@garm:~$ garm-cli pool list --repo=be3a0673-56af-4395-9ebf-4521fea67567
567567

568568
If you want to list pools for an organization or enterprise, you can use the `--org` or `--enterprise` options respectively.
569569

570-
You can also list **all** pools from all configureg github entities by using the `--all` option.
570+
In the absence or the `--repo`, `--org` or `--enterprise` options, the command will list all pools in GARM, regardless of the entity they belong to.
571571

572572
```bash
573-
ubuntu@garm:~/garm$ garm-cli pool list --all
573+
ubuntu@garm:~/garm$ garm-cli pool list
574574
+--------------------------------------+---------------------------+--------------+-----------------------------------------+------------------+-------+---------+---------------+----------+
575575
| ID | IMAGE | FLAVOR | TAGS | BELONGS TO | LEVEL | ENABLED | RUNNER PREFIX | PRIORITY |
576576
+--------------------------------------+---------------------------+--------------+-----------------------------------------+------------------+-------+---------+---------------+----------+
@@ -705,7 +705,7 @@ Awesome! This runner will be able to pick up jobs that match the labels we've se
705705
You can list runners for a pool, for a repository, organization or enterprise, or for all of them. To list all runners, you can run:
706706

707707
```bash
708-
ubuntu@garm:~$ garm-cli runner list --all
708+
ubuntu@garm:~$ garm-cli runner list
709709
+----+---------------------+---------+---------------+--------------------------------------+
710710
| NR | NAME | STATUS | RUNNER STATUS | POOL ID |
711711
+----+---------------------+---------+---------------+--------------------------------------+

0 commit comments

Comments
 (0)