Skip to content

Commit a7578e6

Browse files
Merge pull request #369 from depot/feat/org-switching
Add org switching capability
2 parents 8e5993a + 08e81f1 commit a7578e6

File tree

26 files changed

+1221
-140
lines changed

26 files changed

+1221
-140
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/checkout@v4
1212
- uses: actions/setup-go@v5
1313
with:
14-
go-version: "1.22"
14+
go-version: "1.24.4"
1515
check-latest: true
1616
cache: true
1717

@@ -51,13 +51,11 @@ jobs:
5151
assert-nothing-changed go mod tidy
5252
exit $STATUS
5353
54-
- uses: golangci/golangci-lint-action@v6
54+
- uses: golangci/golangci-lint-action@v7
5555
with:
56-
version: v1.56.2
56+
version: v2.2.1
5757
only-new-issues: false
5858
skip-cache: false
59-
skip-build-cache: true
60-
skip-pkg-cache: true
6159
args: --timeout 5m
6260
github-token: ${{ secrets.GITHUB_TOKEN }}
6361

@@ -74,7 +72,7 @@ jobs:
7472
- uses: actions/checkout@v4
7573
- uses: actions/setup-go@v5
7674
with:
77-
go-version: "1.22"
75+
go-version: "1.24.4"
7876
check-latest: true
7977
cache: true
8078

.golangci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
version: "2"
2+
13
run:
2-
go: "1.22"
4+
go: "1.24.4"
5+
linters:
6+
# Disable errcheck which is very strict about error handling
7+
disable:
8+
- errcheck
9+
- staticcheck

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
golang 1.22.12
1+
golang 1.24.4

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=$BUILDPLATFORM golang:1.22 AS build
1+
FROM --platform=$BUILDPLATFORM golang:1.24.4 AS build
22
WORKDIR /src
33
ARG LDFLAGS
44
ARG TARGETARCH

README.md

Lines changed: 85 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ Official CLI for [Depot](https://depot.dev) - you can use the CLI to build Docke
3232
- [`depot init`](#depot-init)
3333
- [`depot login`](#depot-login)
3434
- [`depot logout`](#depot-logout)
35+
- [`depot org`](#depot-org)
36+
- [`depot org list`](#depot-org-list)
37+
- [`depot org show`](#depot-org-show)
38+
- [`depot org switch`](#depot-org-switch)
3539
- [`depot pull`](#depot-pull)
3640
- [`depot push`](#depot-push)
3741
- [`depot pull-token`](#depot-pull-token)
@@ -174,7 +178,7 @@ services:
174178
| `provenance` | Shorthand for "--set=\*.attest=type=provenance" |
175179
| `pull` | Always attempt to pull all referenced images |
176180
| `push` | Shorthand for "--set=\*.output=type=registry" |
177-
| `save` | Saves bake targets to the Depot registry |
181+
| `save` | Saves bake targets to the Depot registry |
178182
| `sbom` | Shorthand for "--set=\*.attest=type=sbom" |
179183
| `set` | Override target value (e.g., "targetpattern.key=value") |
180184
| `token` | Depot API token |
@@ -242,7 +246,7 @@ depot build -t repo/image:tag . --push
242246
| `pull` | Always attempt to pull all referenced images |
243247
| `push` | Shorthand for "--output=type=registry" |
244248
| `quiet` | Suppress the build output and print image ID on success |
245-
| `save` | Saves build to the Depot registry |
249+
| `save` | Saves build to the Depot registry |
246250
| `sbom` | Shorthand for "--attest=type=sbom" |
247251
| `secret` | Secret to expose to the build (format: "id=mysecret[,src=/local/secret]") |
248252
| `shm-size` | Size of "/dev/shm" |
@@ -290,21 +294,20 @@ depot exec dagger run ...
290294

291295
#### Flags for `exec`
292296

293-
| Name | Description |
294-
| ------------- | ----------------------------------------------------------------- |
295-
| `env-var` | Environment variable name for the BuildKit connection (default: "BUILDKIT_HOST") |
296-
| `platform` | Platform to execute the command on (linux/amd64 or linux/arm64) |
297-
| `project` | Depot project ID |
298-
| `progress` | Set type of progress output ("auto", "plain", "tty") |
299-
| `token` | Depot token |
297+
| Name | Description |
298+
| ---------- | -------------------------------------------------------------------------------- |
299+
| `env-var` | Environment variable name for the BuildKit connection (default: "BUILDKIT_HOST") |
300+
| `platform` | Platform to execute the command on (linux/amd64 or linux/arm64) |
301+
| `project` | Depot project ID |
302+
| `progress` | Set type of progress output ("auto", "plain", "tty") |
303+
| `token` | Depot token |
300304

301305
### `depot gocache`
302306

303307
Configure Go tools to use Depot Cache. The Go tools will use the remote cache service to store and retrieve build artifacts.
304308

305309
_Note: This requires Go 1.24 or later._
306310

307-
308311
Set the environment variable `GOCACHEPROG` to `depot gocache` to configure Go to use Depot Cache.
309312

310313
```shell
@@ -418,12 +421,12 @@ depot projects create --organization your-org-id --region us-west-2 --cache-stor
418421

419422
#### Flags for `projects create`
420423

421-
| Name | Description |
422-
| --------------------- | ------------------------------------------------------------ |
423-
| `organization` / `-o` | Depot organization ID |
424-
| `region` | Build data storage region (default: "us-east-1") |
425-
| `cache-storage-policy`| Build cache to keep per architecture in GB (default: 50) |
426-
| `token` | Depot API token |
424+
| Name | Description |
425+
| ---------------------- | -------------------------------------------------------- |
426+
| `organization` / `-o` | Depot organization ID |
427+
| `region` | Build data storage region (default: "us-east-1") |
428+
| `cache-storage-policy` | Build cache to keep per architecture in GB (default: 50) |
429+
| `token` | Depot API token |
427430

428431
#### `depot projects list`
429432

@@ -465,6 +468,68 @@ Remove any saved login defails from your local machine.
465468
depot logout
466469
```
467470

471+
### `depot org`
472+
473+
Manage Depot organizations. The `org` command consists of subcommands for each operation.
474+
475+
#### `depot org list`
476+
477+
Display an interactive listing of organizations that you can access. The command shows organization IDs and names in a table format.
478+
479+
To exit type `q` or `ctrl+c`
480+
481+
**Example**
482+
483+
```shell
484+
depot org list
485+
```
486+
487+
**Example**
488+
489+
The list command can output organization information to stdout with the `--output` option. It supports `json` and `csv`.
490+
491+
Output organizations in JSON format:
492+
493+
```shell
494+
depot org list --output json
495+
```
496+
497+
Output organizations in CSV format:
498+
499+
```shell
500+
depot org list --output csv
501+
```
502+
503+
#### `depot org show`
504+
505+
Show the current organization ID that is set in your global Depot settings.
506+
507+
**Example**
508+
509+
```shell
510+
depot org show
511+
```
512+
513+
#### `depot org switch`
514+
515+
Set the current organization in global Depot settings. You can either specify an organization ID as an argument or run the command interactively to select from available organizations.
516+
517+
**Example**
518+
519+
Switch to a specific organization by ID:
520+
521+
```shell
522+
depot org switch your-org-id
523+
```
524+
525+
**Example**
526+
527+
Switch to an organization interactively:
528+
529+
```shell
530+
depot org switch
531+
```
532+
468533
### `depot pull`
469534

470535
Pull an image from the Depot registry to your local Docker daemon.
@@ -510,10 +575,10 @@ depot pull-token --project <PROJECT_ID>
510575

511576
#### Flags for `pull-token`
512577

513-
| Name | Description |
514-
| ---------- | ------------------ |
515-
| `project` | Depot project ID |
516-
| `token` | Depot API token |
578+
| Name | Description |
579+
| --------- | ---------------- |
580+
| `project` | Depot project ID |
581+
| `token` | Depot API token |
517582

518583
### `depot version`
519584

examples/go.mod

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/depot/cli/examples
22

3-
go 1.22
3+
go 1.24.4
44

55
require (
66
github.com/depot/cli v1.8.3
@@ -15,12 +15,23 @@ require (
1515
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
1616
github.com/Microsoft/go-winio v0.6.1 // indirect
1717
github.com/Shopify/logrus-bugsnag v0.0.0-20230117174420-439a4b8ba167 // indirect
18+
github.com/adrg/xdg v0.4.0 // indirect
1819
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect
20+
github.com/atotto/clipboard v0.1.4 // indirect
1921
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
2022
github.com/beorn7/perks v1.0.1 // indirect
2123
github.com/briandowns/spinner v1.18.1 // indirect
24+
github.com/catppuccin/go v0.3.0 // indirect
2225
github.com/cespare/xxhash/v2 v2.2.0 // indirect
23-
github.com/charmbracelet/lipgloss v0.7.1 // indirect
26+
github.com/charmbracelet/bubbles v0.21.0 // indirect
27+
github.com/charmbracelet/bubbletea v1.3.4 // indirect
28+
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
29+
github.com/charmbracelet/huh v0.7.0 // indirect
30+
github.com/charmbracelet/lipgloss v1.1.0 // indirect
31+
github.com/charmbracelet/x/ansi v0.8.0 // indirect
32+
github.com/charmbracelet/x/cellbuf v0.0.13 // indirect
33+
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 // indirect
34+
github.com/charmbracelet/x/term v0.2.1 // indirect
2435
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
2536
github.com/containerd/containerd v1.6.20 // indirect
2637
github.com/containerd/continuity v0.4.1 // indirect
@@ -36,7 +47,12 @@ require (
3647
github.com/docker/go-connections v0.4.0 // indirect
3748
github.com/docker/go-metrics v0.0.1 // indirect
3849
github.com/docker/go-units v0.5.0 // indirect
50+
github.com/dustin/go-humanize v1.0.1 // indirect
51+
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
52+
github.com/erikgeiser/promptkit v0.9.0 // indirect
3953
github.com/fatih/color v1.13.0 // indirect
54+
github.com/felixge/httpsnoop v1.0.4 // indirect
55+
github.com/fsnotify/fsnotify v1.6.0 // indirect
4056
github.com/fvbommel/sortorder v1.0.1 // indirect
4157
github.com/go-logr/logr v1.3.0 // indirect
4258
github.com/go-logr/stdr v1.2.2 // indirect
@@ -50,44 +66,66 @@ require (
5066
github.com/gorilla/mux v1.8.0 // indirect
5167
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
5268
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
69+
github.com/hashicorp/hcl v1.0.0 // indirect
70+
github.com/imdario/mergo v0.3.13 // indirect
5371
github.com/inconshreveable/mousetrap v1.0.1 // indirect
5472
github.com/json-iterator/go v1.1.12 // indirect
5573
github.com/klauspost/compress v1.16.3 // indirect
5674
github.com/klauspost/cpuid/v2 v2.0.4 // indirect
5775
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
76+
github.com/magiconair/properties v1.8.6 // indirect
5877
github.com/mattn/go-colorable v0.1.12 // indirect
59-
github.com/mattn/go-isatty v0.0.19 // indirect
60-
github.com/mattn/go-runewidth v0.0.15 // indirect
78+
github.com/mattn/go-isatty v0.0.20 // indirect
79+
github.com/mattn/go-localereader v0.0.1 // indirect
80+
github.com/mattn/go-runewidth v0.0.16 // indirect
6181
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
6282
github.com/miekg/pkcs11 v1.1.1 // indirect
6383
github.com/minio/sha256-simd v1.0.0 // indirect
84+
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
85+
github.com/mitchellh/mapstructure v1.5.0 // indirect
86+
github.com/moby/locker v1.0.1 // indirect
6487
github.com/moby/patternmatcher v0.5.0 // indirect
88+
github.com/moby/sys/mountinfo v0.6.2 // indirect
6589
github.com/moby/sys/sequential v0.5.0 // indirect
6690
github.com/moby/sys/signal v0.7.0 // indirect
6791
github.com/moby/term v0.0.0-20221120202655-abb19827d345 // indirect
6892
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
6993
github.com/modern-go/reflect2 v1.0.2 // indirect
7094
github.com/morikuni/aec v1.0.0 // indirect
95+
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
96+
github.com/muesli/cancelreader v0.2.2 // indirect
7197
github.com/muesli/reflow v0.3.0 // indirect
72-
github.com/muesli/termenv v0.15.2 // indirect
98+
github.com/muesli/termenv v0.16.0 // indirect
7399
github.com/opencontainers/go-digest v1.0.0 // indirect
74100
github.com/opencontainers/image-spec v1.1.0-rc3 // indirect
75101
github.com/pelletier/go-toml v1.9.5 // indirect
102+
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
76103
github.com/pkg/errors v0.9.1 // indirect
104+
github.com/pmezard/go-difflib v1.0.0 // indirect
77105
github.com/prometheus/client_golang v1.14.0 // indirect
78106
github.com/prometheus/client_model v0.3.0 // indirect
79107
github.com/prometheus/common v0.37.0 // indirect
80108
github.com/prometheus/procfs v0.8.0 // indirect
81-
github.com/rivo/uniseg v0.4.4 // indirect
109+
github.com/rivo/uniseg v0.4.7 // indirect
110+
github.com/sahilm/fuzzy v0.1.1 // indirect
82111
github.com/sirupsen/logrus v1.9.3 // indirect
112+
github.com/spf13/afero v1.9.2 // indirect
113+
github.com/spf13/cast v1.5.0 // indirect
83114
github.com/spf13/cobra v1.6.1 // indirect
115+
github.com/spf13/jwalterweatherman v1.1.0 // indirect
84116
github.com/spf13/pflag v1.0.5 // indirect
117+
github.com/spf13/viper v1.14.0 // indirect
118+
github.com/stretchr/testify v1.10.0 // indirect
119+
github.com/subosito/gotenv v1.4.1 // indirect
85120
github.com/theupdateframework/notary v0.6.1 // indirect
86121
github.com/tonistiigi/fsutil v0.0.0-20230629203738-36ef4d8c0dbb // indirect
87122
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect
88123
github.com/tonistiigi/vt100 v0.0.0-20230623042737-f9a4f7ef6531 // indirect
124+
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
89125
go.opencensus.io v0.24.0 // indirect
90126
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect
127+
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.46.0 // indirect
128+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 // indirect
91129
go.opentelemetry.io/otel v1.20.0 // indirect
92130
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.4.1 // indirect
93131
go.opentelemetry.io/otel/metric v1.20.0 // indirect
@@ -98,10 +136,10 @@ require (
98136
golang.org/x/mod v0.17.0 // indirect
99137
golang.org/x/net v0.25.0 // indirect
100138
golang.org/x/oauth2 v0.11.0 // indirect
101-
golang.org/x/sync v0.10.0 // indirect
102-
golang.org/x/sys v0.28.0 // indirect
139+
golang.org/x/sync v0.12.0 // indirect
140+
golang.org/x/sys v0.31.0 // indirect
103141
golang.org/x/term v0.27.0 // indirect
104-
golang.org/x/text v0.21.0 // indirect
142+
golang.org/x/text v0.23.0 // indirect
105143
golang.org/x/time v0.3.0 // indirect
106144
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
107145
google.golang.org/appengine v1.6.7 // indirect
@@ -111,7 +149,9 @@ require (
111149
google.golang.org/grpc v1.59.0 // indirect
112150
google.golang.org/protobuf v1.32.0 // indirect
113151
gopkg.in/inf.v0 v0.9.1 // indirect
152+
gopkg.in/ini.v1 v1.67.0 // indirect
114153
gopkg.in/yaml.v2 v2.4.0 // indirect
154+
gopkg.in/yaml.v3 v3.0.1 // indirect
115155
gotest.tools/v3 v3.5.0 // indirect
116156
k8s.io/apimachinery v0.25.4 // indirect
117157
k8s.io/client-go v0.25.4 // indirect

0 commit comments

Comments
 (0)