Skip to content

Commit 5405f3b

Browse files
authored
Add create-repo example (#260)
Shows how you could add images (actually, repos) to your Chainguard organization with your own code.
1 parent 385b97c commit 5405f3b

File tree

4 files changed

+443
-0
lines changed

4 files changed

+443
-0
lines changed

create-repo/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Create Repository
2+
3+
An example of adding an image to your Chainguard organization with the
4+
Chainguard Go SDK.
5+
6+
## Usage
7+
8+
1. Build the example.
9+
10+
```
11+
go build -o create-repo main.go
12+
```
13+
14+
2. Login with `chainctl`. The example will reuse the token this creates for
15+
authentication.
16+
17+
```
18+
chainctl auth login
19+
```
20+
21+
3. Create the repository. This will add the `nginx` image to your organization.
22+
23+
```
24+
./create-repo -parent your.org -repo nginx
25+
```
26+
27+
## Assumable Identity
28+
29+
Rather than relying on `chainctl` for authentication, the example can assume an
30+
identity.
31+
32+
Refer to [the
33+
documentation](https://edu.chainguard.dev/chainguard/administration/assumable-ids/)
34+
for examples of how to create an assumable identity.
35+
36+
```
37+
./create-repo \
38+
-parent your.org \
39+
-repo nginx \
40+
-identity <identity-id> \
41+
-identity-token <identity-token>
42+
```

create-repo/go.mod

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
module github.com/chainguard-dev/platform-examples/create-repo
2+
3+
go 1.25.0
4+
5+
require chainguard.dev/sdk v0.1.50
6+
7+
require (
8+
chainguard.dev/apko v1.1.3 // indirect
9+
chainguard.dev/go-grpc-kit v0.17.15 // indirect
10+
cloud.google.com/go/auth v0.18.1 // indirect
11+
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
12+
cloud.google.com/go/compute/metadata v0.9.0 // indirect
13+
dario.cat/mergo v1.0.1 // indirect
14+
github.com/Microsoft/go-winio v0.6.2 // indirect
15+
github.com/ProtonMail/go-crypto v1.3.0 // indirect
16+
github.com/beorn7/perks v1.0.1 // indirect
17+
github.com/bits-and-blooms/bitset v1.24.4 // indirect
18+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
19+
github.com/chainguard-dev/clog v1.8.0 // indirect
20+
github.com/cloudflare/circl v1.6.1 // indirect
21+
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
22+
github.com/emirpasic/gods v1.18.1 // indirect
23+
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
24+
github.com/go-git/go-billy/v5 v5.6.2 // indirect
25+
github.com/go-git/go-git/v5 v5.16.4 // indirect
26+
github.com/go-logr/logr v1.4.3 // indirect
27+
github.com/go-logr/stdr v1.2.2 // indirect
28+
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
29+
github.com/google/go-cmp v0.7.0 // indirect
30+
github.com/google/go-containerregistry v0.20.7 // indirect
31+
github.com/google/s2a-go v0.1.9 // indirect
32+
github.com/google/uuid v1.6.0 // indirect
33+
github.com/googleapis/enterprise-certificate-proxy v0.3.11 // indirect
34+
github.com/googleapis/gax-go/v2 v2.16.0 // indirect
35+
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 // indirect
36+
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 // indirect
37+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect
38+
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
39+
github.com/kelseyhightower/envconfig v1.4.0 // indirect
40+
github.com/kevinburke/ssh_config v1.2.0 // indirect
41+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
42+
github.com/pjbgf/sha1cd v0.3.2 // indirect
43+
github.com/prometheus/client_golang v1.23.2 // indirect
44+
github.com/prometheus/client_model v0.6.2 // indirect
45+
github.com/prometheus/common v0.66.1 // indirect
46+
github.com/prometheus/procfs v0.16.1 // indirect
47+
github.com/sergi/go-diff v1.4.0 // indirect
48+
github.com/skeema/knownhosts v1.3.1 // indirect
49+
github.com/xanzy/ssh-agent v0.3.3 // indirect
50+
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
51+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect
52+
go.opentelemetry.io/otel v1.39.0 // indirect
53+
go.opentelemetry.io/otel/metric v1.39.0 // indirect
54+
go.opentelemetry.io/otel/trace v1.39.0 // indirect
55+
go.yaml.in/yaml/v2 v2.4.3 // indirect
56+
golang.org/x/crypto v0.47.0 // indirect
57+
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect
58+
golang.org/x/net v0.49.0 // indirect
59+
golang.org/x/oauth2 v0.34.0 // indirect
60+
golang.org/x/sys v0.40.0 // indirect
61+
golang.org/x/text v0.33.0 // indirect
62+
google.golang.org/api v0.264.0 // indirect
63+
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
64+
google.golang.org/genproto/googleapis/rpc v0.0.0-20260122232226-8e98ce8d340d // indirect
65+
google.golang.org/grpc v1.78.0 // indirect
66+
google.golang.org/protobuf v1.36.11 // indirect
67+
gopkg.in/warnings.v0 v0.1.2 // indirect
68+
gopkg.in/yaml.v3 v3.0.1 // indirect
69+
)

0 commit comments

Comments
 (0)