From 8c983acde0e05c3a315f8710b177fdff04a8544f Mon Sep 17 00:00:00 2001 From: vikram-dagger <112123850+vikram-dagger@users.noreply.github.com> Date: Sat, 14 Dec 2024 15:28:36 +0530 Subject: [PATCH 1/3] docs: Add warning for `dagger develop` usage (#9193) * docs: Add warning for `dagger develop` usage Signed-off-by: Vikram Vaswani * Added --compat option to note Signed-off-by: Vikram Vaswani --------- Signed-off-by: Vikram Vaswani --- docs/current_docs/api/clients-sdk.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/current_docs/api/clients-sdk.mdx b/docs/current_docs/api/clients-sdk.mdx index 6e840108716..cfd7e87f324 100644 --- a/docs/current_docs/api/clients-sdk.mdx +++ b/docs/current_docs/api/clients-sdk.mdx @@ -48,8 +48,8 @@ dagger develop --sdk=typescript -:::info -At any point, running `dagger develop` regenerates the module's code based on dependencies and the current state of the module. +:::warning +Running `dagger develop` regenerates the module's code based on dependencies, the current state of the module, and the current Dagger API version. This can result in unexpected results if there are significant changes between the previous and latest installed Dagger API versions. Always refer to the [changelog](https://github.com/dagger/dagger/blob/main/CHANGELOG.md) for a complete list of changes (including breaking changes) in each Dagger release before running `dagger develop`, or use the `--compat=skip` option to bypass updating the Dagger API version. ::: The default template from `dagger develop` creates the following structure: From 5bf65f6424c5ddd805315b562e9db64cfb6edde8 Mon Sep 17 00:00:00 2001 From: vikram-dagger <112123850+vikram-dagger@users.noreply.github.com> Date: Sat, 14 Dec 2024 15:29:18 +0530 Subject: [PATCH 2/3] docs: Add OCI annotations recipe to cookbook (#9170) * docs: Add OCI annotations recipe to cookbook Signed-off-by: Vikram Vaswani * Fix linter error Signed-off-by: Vikram Vaswani * Fixed lint error Signed-off-by: Vikram Vaswani * Added links Signed-off-by: Vikram Vaswani --------- Signed-off-by: Vikram Vaswani --- docs/current_docs/cookbook/cookbook.mdx | 41 ++++++++- .../go/.gitattributes | 0 .../{oci => oci-annotations}/go/.gitignore | 0 .../builds/oci-annotations/go/dagger.json | 6 ++ .../builds/{oci => oci-annotations}/go/go.mod | 0 .../builds/{oci => oci-annotations}/go/go.sum | 0 .../builds/oci-annotations/go/main.go | 26 ++++++ .../builds/oci-annotations/python/main.py | 23 +++++ .../oci-annotations/typescript/index.ts | 25 ++++++ .../builds/oci-labels/go/.gitattributes | 4 + .../snippets/builds/oci-labels/go/.gitignore | 4 + .../builds/{oci => oci-labels}/go/dagger.json | 0 .../snippets/builds/oci-labels/go/go.mod | 40 +++++++++ .../snippets/builds/oci-labels/go/go.sum | 87 +++++++++++++++++++ .../builds/{oci => oci-labels}/go/main.go | 2 +- .../builds/{oci => oci-labels}/python/main.py | 2 +- .../{oci => oci-labels}/typescript/index.ts | 2 +- 17 files changed, 255 insertions(+), 7 deletions(-) rename docs/current_docs/cookbook/snippets/builds/{oci => oci-annotations}/go/.gitattributes (100%) rename docs/current_docs/cookbook/snippets/builds/{oci => oci-annotations}/go/.gitignore (100%) create mode 100644 docs/current_docs/cookbook/snippets/builds/oci-annotations/go/dagger.json rename docs/current_docs/cookbook/snippets/builds/{oci => oci-annotations}/go/go.mod (100%) rename docs/current_docs/cookbook/snippets/builds/{oci => oci-annotations}/go/go.sum (100%) create mode 100644 docs/current_docs/cookbook/snippets/builds/oci-annotations/go/main.go create mode 100644 docs/current_docs/cookbook/snippets/builds/oci-annotations/python/main.py create mode 100644 docs/current_docs/cookbook/snippets/builds/oci-annotations/typescript/index.ts create mode 100644 docs/current_docs/cookbook/snippets/builds/oci-labels/go/.gitattributes create mode 100644 docs/current_docs/cookbook/snippets/builds/oci-labels/go/.gitignore rename docs/current_docs/cookbook/snippets/builds/{oci => oci-labels}/go/dagger.json (100%) create mode 100644 docs/current_docs/cookbook/snippets/builds/oci-labels/go/go.mod create mode 100644 docs/current_docs/cookbook/snippets/builds/oci-labels/go/go.sum rename docs/current_docs/cookbook/snippets/builds/{oci => oci-labels}/go/main.go (93%) rename docs/current_docs/cookbook/snippets/builds/{oci => oci-labels}/python/main.py (93%) rename docs/current_docs/cookbook/snippets/builds/{oci => oci-labels}/typescript/index.ts (93%) diff --git a/docs/current_docs/cookbook/cookbook.mdx b/docs/current_docs/cookbook/cookbook.mdx index cec4a5f5609..115c51ce104 100644 --- a/docs/current_docs/cookbook/cookbook.mdx +++ b/docs/current_docs/cookbook/cookbook.mdx @@ -519,26 +519,59 @@ dagger call build \ --dockerfile https://github.com/vimagick/dockerfiles#master:registry-cli/Dockerfile ``` +### Add OCI annotations to image + +The following Dagger Function adds [OpenContainer Initiative (OCI) annotations](https://github.com/opencontainers/image-spec/blob/main/annotations.md) to an image. + + + + +```go file=./snippets/builds/oci-annotations/go/main.go +``` + + + + +```python file=./snippets/builds/oci-annotations/python/main.py +``` + + + + +```typescript file=./snippets/builds/oci-annotations/typescript/index.ts +``` + + + + +#### Example + +Build and publish an image with OCI annotations: + +```shell +dagger call build +``` + ### Add OCI labels to image -The following Dagger Function adds OpenContainer Initiative (OCI) labels to an image. +The following Dagger Function adds [OpenContainer Initiative (OCI) labels](https://github.com/opencontainers/image-spec/blob/main/config.md) to an image. -```go file=./snippets/builds/oci/go/main.go +```go file=./snippets/builds/oci-labels/go/main.go ``` -```python file=./snippets/builds/oci/python/main.py +```python file=./snippets/builds/oci-labels/python/main.py ``` -```typescript file=./snippets/builds/oci/typescript/index.ts +```typescript file=./snippets/builds/oci-labels/typescript/index.ts ``` diff --git a/docs/current_docs/cookbook/snippets/builds/oci/go/.gitattributes b/docs/current_docs/cookbook/snippets/builds/oci-annotations/go/.gitattributes similarity index 100% rename from docs/current_docs/cookbook/snippets/builds/oci/go/.gitattributes rename to docs/current_docs/cookbook/snippets/builds/oci-annotations/go/.gitattributes diff --git a/docs/current_docs/cookbook/snippets/builds/oci/go/.gitignore b/docs/current_docs/cookbook/snippets/builds/oci-annotations/go/.gitignore similarity index 100% rename from docs/current_docs/cookbook/snippets/builds/oci/go/.gitignore rename to docs/current_docs/cookbook/snippets/builds/oci-annotations/go/.gitignore diff --git a/docs/current_docs/cookbook/snippets/builds/oci-annotations/go/dagger.json b/docs/current_docs/cookbook/snippets/builds/oci-annotations/go/dagger.json new file mode 100644 index 00000000000..1bbe8b4cf1d --- /dev/null +++ b/docs/current_docs/cookbook/snippets/builds/oci-annotations/go/dagger.json @@ -0,0 +1,6 @@ +{ + "name": "my-module", + "sdk": "go", + "source": ".", + "engineVersion": "v0.15.0" +} diff --git a/docs/current_docs/cookbook/snippets/builds/oci/go/go.mod b/docs/current_docs/cookbook/snippets/builds/oci-annotations/go/go.mod similarity index 100% rename from docs/current_docs/cookbook/snippets/builds/oci/go/go.mod rename to docs/current_docs/cookbook/snippets/builds/oci-annotations/go/go.mod diff --git a/docs/current_docs/cookbook/snippets/builds/oci/go/go.sum b/docs/current_docs/cookbook/snippets/builds/oci-annotations/go/go.sum similarity index 100% rename from docs/current_docs/cookbook/snippets/builds/oci/go/go.sum rename to docs/current_docs/cookbook/snippets/builds/oci-annotations/go/go.sum diff --git a/docs/current_docs/cookbook/snippets/builds/oci-annotations/go/main.go b/docs/current_docs/cookbook/snippets/builds/oci-annotations/go/main.go new file mode 100644 index 00000000000..6516c8c3f02 --- /dev/null +++ b/docs/current_docs/cookbook/snippets/builds/oci-annotations/go/main.go @@ -0,0 +1,26 @@ +package main + +import ( + "context" + "fmt" + "math" + "math/rand/v2" +) + +type MyModule struct{} + +// Build and publish image with OCI annotations +func (m *MyModule) Build(ctx context.Context) (string, error) { + address, err := dag.Container(). + From("alpine:latest"). + WithExec([]string{"apk", "add", "git"}). + WithWorkdir("/src"). + WithExec([]string{"git", "clone", "https://github.com/dagger/dagger", "."}). + WithAnnotation("org.opencontainers.image.authors", "John Doe"). + WithAnnotation("org.opencontainers.image.title", "Dagger source image viewer"). + Publish(ctx, fmt.Sprintf("ttl.sh/custom-image-%.0f", math.Floor(rand.Float64()*10000000))) //#nosec + if err != nil { + return "", err + } + return address, nil +} diff --git a/docs/current_docs/cookbook/snippets/builds/oci-annotations/python/main.py b/docs/current_docs/cookbook/snippets/builds/oci-annotations/python/main.py new file mode 100644 index 00000000000..4a19a8534d8 --- /dev/null +++ b/docs/current_docs/cookbook/snippets/builds/oci-annotations/python/main.py @@ -0,0 +1,23 @@ +import random + +from dagger import dag, function, object_type + + +@object_type +class MyModule: + @function + async def build(self) -> str: + """Build and publish image with OCI annotations""" + address = await ( + dag.container() + .from_("alpine:latest") + .with_exec(["apk", "add", "git"]) + .with_workdir("/src") + .with_exec(["git", "clone", "https://github.com/dagger/dagger", "."]) + .with_annotation("org.opencontainers.image.authors", "John Doe") + .with_annotation( + "org.opencontainers.image.title", "Dagger source image viewer" + ) + .publish(f"ttl.sh/custom-image-{random.randrange(10 * 7)}") + ) + return address diff --git a/docs/current_docs/cookbook/snippets/builds/oci-annotations/typescript/index.ts b/docs/current_docs/cookbook/snippets/builds/oci-annotations/typescript/index.ts new file mode 100644 index 00000000000..7a040ae45d1 --- /dev/null +++ b/docs/current_docs/cookbook/snippets/builds/oci-annotations/typescript/index.ts @@ -0,0 +1,25 @@ +import { dag, object, func } from "@dagger.io/dagger" + +@object() +class MyModule { + /** + * Build and publish image with OCI annotations + */ + @func() + async build(): Promise { + const address = await dag + .container() + .from("alpine:latest") + .withExec(["apk", "add", "git"]) + .withWorkdir("/src") + .withExec(["git", "clone", "https://github.com/dagger/dagger", "."]) + .withAnnotation("org.opencontainers.image.authors", "John Doe") + .withAnnotation( + "org.opencontainers.image.title", + "Dagger source image viewer", + ) + .publish(`ttl.sh/custom-image-${Math.floor(Math.random() * 10000000)}`) + + return address + } +} diff --git a/docs/current_docs/cookbook/snippets/builds/oci-labels/go/.gitattributes b/docs/current_docs/cookbook/snippets/builds/oci-labels/go/.gitattributes new file mode 100644 index 00000000000..3a454933cbe --- /dev/null +++ b/docs/current_docs/cookbook/snippets/builds/oci-labels/go/.gitattributes @@ -0,0 +1,4 @@ +/dagger.gen.go linguist-generated +/internal/dagger/** linguist-generated +/internal/querybuilder/** linguist-generated +/internal/telemetry/** linguist-generated diff --git a/docs/current_docs/cookbook/snippets/builds/oci-labels/go/.gitignore b/docs/current_docs/cookbook/snippets/builds/oci-labels/go/.gitignore new file mode 100644 index 00000000000..7ebabcc1426 --- /dev/null +++ b/docs/current_docs/cookbook/snippets/builds/oci-labels/go/.gitignore @@ -0,0 +1,4 @@ +/dagger.gen.go +/internal/dagger +/internal/querybuilder +/internal/telemetry diff --git a/docs/current_docs/cookbook/snippets/builds/oci/go/dagger.json b/docs/current_docs/cookbook/snippets/builds/oci-labels/go/dagger.json similarity index 100% rename from docs/current_docs/cookbook/snippets/builds/oci/go/dagger.json rename to docs/current_docs/cookbook/snippets/builds/oci-labels/go/dagger.json diff --git a/docs/current_docs/cookbook/snippets/builds/oci-labels/go/go.mod b/docs/current_docs/cookbook/snippets/builds/oci-labels/go/go.mod new file mode 100644 index 00000000000..091346fe071 --- /dev/null +++ b/docs/current_docs/cookbook/snippets/builds/oci-labels/go/go.mod @@ -0,0 +1,40 @@ +module dagger/my-module + +go 1.22.1 + +require ( + github.com/99designs/gqlgen v0.17.49 + github.com/Khan/genqlient v0.7.0 + github.com/vektah/gqlparser/v2 v2.5.16 + go.opentelemetry.io/otel v1.27.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0 + go.opentelemetry.io/otel/sdk v1.27.0 + go.opentelemetry.io/otel/trace v1.27.0 + golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa + golang.org/x/sync v0.7.0 + google.golang.org/grpc v1.64.0 +) + +require ( + github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect + github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect + github.com/sosodev/duration v1.3.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.0.0-20240518090000-14441aefdf88 + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.3.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 // indirect + go.opentelemetry.io/otel/log v0.3.0 + go.opentelemetry.io/otel/metric v1.27.0 // indirect + go.opentelemetry.io/otel/sdk/log v0.3.0 + go.opentelemetry.io/proto/otlp v1.3.1 + golang.org/x/net v0.26.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect + google.golang.org/protobuf v1.34.1 // indirect +) diff --git a/docs/current_docs/cookbook/snippets/builds/oci-labels/go/go.sum b/docs/current_docs/cookbook/snippets/builds/oci-labels/go/go.sum new file mode 100644 index 00000000000..6fea81b9cb9 --- /dev/null +++ b/docs/current_docs/cookbook/snippets/builds/oci-labels/go/go.sum @@ -0,0 +1,87 @@ +github.com/99designs/gqlgen v0.17.49 h1:b3hNGexHd33fBSAd4NDT/c3NCcQzcAVkknhN9ym36YQ= +github.com/99designs/gqlgen v0.17.49/go.mod h1:tC8YFVZMed81x7UJ7ORUwXF4Kn6SXuucFqQBhN8+BU0= +github.com/Khan/genqlient v0.7.0 h1:GZ1meyRnzcDTK48EjqB8t3bcfYvHArCUUvgOwpz1D4w= +github.com/Khan/genqlient v0.7.0/go.mod h1:HNyy3wZvuYwmW3Y7mkoQLZsa/R5n5yIRajS1kPBvSFM= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= +github.com/sosodev/duration v1.3.1 h1:qtHBDMQ6lvMQsL15g4aopM4HEfOaYuhWBw3NPTtlqq4= +github.com/sosodev/duration v1.3.1/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/vektah/gqlparser/v2 v2.5.16 h1:1gcmLTvs3JLKXckwCwlUagVn/IlV2bwqle0vJ0vy5p8= +github.com/vektah/gqlparser/v2 v2.5.16/go.mod h1:1lz1OeCqgQbQepsGxPVywrjdBHW2T08PUS3pJqepRww= +go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= +go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.0.0-20240518090000-14441aefdf88 h1:oM0GTNKGlc5qHctWeIGTVyda4iFFalOzMZ3Ehj5rwB4= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.0.0-20240518090000-14441aefdf88/go.mod h1:JGG8ebaMO5nXOPnvKEl+DiA4MGwFjCbjsxT1WHIEBPY= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.3.0 h1:ccBrA8nCY5mM0y5uO7FT0ze4S0TuFcWdDB2FxGMTjkI= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.3.0/go.mod h1:/9pb6634zi2Lk8LYg9Q0X8Ar6jka4dkFOylBLbVQPCE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 h1:R9DE4kQ4k+YtfLI2ULwX82VtNQ2J8yZmA7ZIF/D+7Mc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0/go.mod h1:OQFyQVrDlbe+R7xrEyDr/2Wr67Ol0hRUgsfA+V5A95s= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 h1:qFffATk0X+HD+f1Z8lswGiOQYKHRlzfmdJm0wEaVrFA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0/go.mod h1:MOiCmryaYtc+V0Ei+Tx9o5S1ZjA7kzLucuVuyzBZloQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0 h1:QY7/0NeRPKlzusf40ZE4t1VlMKbqSNT7cJRYzWuja0s= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0/go.mod h1:HVkSiDhTM9BoUJU8qE6j2eSWLLXvi1USXjyd2BXT8PY= +go.opentelemetry.io/otel/log v0.3.0 h1:kJRFkpUFYtny37NQzL386WbznUByZx186DpEMKhEGZs= +go.opentelemetry.io/otel/log v0.3.0/go.mod h1:ziCwqZr9soYDwGNbIL+6kAvQC+ANvjgG367HVcyR/ys= +go.opentelemetry.io/otel/metric v1.27.0 h1:hvj3vdEKyeCi4YaYfNjv2NUje8FqKqUY8IlF0FxV/ik= +go.opentelemetry.io/otel/metric v1.27.0/go.mod h1:mVFgmRlhljgBiuk/MP/oKylr4hs85GZAylncepAX/ak= +go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= +go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A= +go.opentelemetry.io/otel/sdk/log v0.3.0 h1:GEjJ8iftz2l+XO1GF2856r7yYVh74URiF9JMcAacr5U= +go.opentelemetry.io/otel/sdk/log v0.3.0/go.mod h1:BwCxtmux6ACLuys1wlbc0+vGBd+xytjmjajwqqIul2g= +go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5/Rscw= +go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4= +go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= +go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 h1:P8OJ/WCl/Xo4E4zoe4/bifHpSmmKwARqyqE4nW6J2GQ= +google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5/go.mod h1:RGnPtTG7r4i8sPlNyDeikXF99hMM+hN6QMm4ooG9g2g= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 h1:AgADTJarZTBqgjiUzRgfaBchgYB3/WFTC80GPwsMcRI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= +google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/docs/current_docs/cookbook/snippets/builds/oci/go/main.go b/docs/current_docs/cookbook/snippets/builds/oci-labels/go/main.go similarity index 93% rename from docs/current_docs/cookbook/snippets/builds/oci/go/main.go rename to docs/current_docs/cookbook/snippets/builds/oci-labels/go/main.go index 78e28e521cd..d56aa30b6ad 100644 --- a/docs/current_docs/cookbook/snippets/builds/oci/go/main.go +++ b/docs/current_docs/cookbook/snippets/builds/oci-labels/go/main.go @@ -7,7 +7,7 @@ import ( type MyModule struct{} -// Build and publish image with oci labels +// Build and publish image with OCI labels func (m *MyModule) Build( ctx context.Context, ) (string, error) { diff --git a/docs/current_docs/cookbook/snippets/builds/oci/python/main.py b/docs/current_docs/cookbook/snippets/builds/oci-labels/python/main.py similarity index 93% rename from docs/current_docs/cookbook/snippets/builds/oci/python/main.py rename to docs/current_docs/cookbook/snippets/builds/oci-labels/python/main.py index 2884b744392..f055a3ee39f 100644 --- a/docs/current_docs/cookbook/snippets/builds/oci/python/main.py +++ b/docs/current_docs/cookbook/snippets/builds/oci-labels/python/main.py @@ -7,7 +7,7 @@ class MyModule: @function async def build(self) -> str: - """Build and publish image with oci labels""" + """Build and publish image with OCI labels""" ref = ( dag.container() .from_("alpine") diff --git a/docs/current_docs/cookbook/snippets/builds/oci/typescript/index.ts b/docs/current_docs/cookbook/snippets/builds/oci-labels/typescript/index.ts similarity index 93% rename from docs/current_docs/cookbook/snippets/builds/oci/typescript/index.ts rename to docs/current_docs/cookbook/snippets/builds/oci-labels/typescript/index.ts index 09578615830..82a90541443 100644 --- a/docs/current_docs/cookbook/snippets/builds/oci/typescript/index.ts +++ b/docs/current_docs/cookbook/snippets/builds/oci-labels/typescript/index.ts @@ -3,7 +3,7 @@ import { dag, object, func } from "@dagger.io/dagger" @object() class MyModule { /** - * Build and publish image with oci labels + * Build and publish image with OCI labels */ @func() async build(): Promise { From 8bea631db61b6a1e956df8776af9abb857d478bc Mon Sep 17 00:00:00 2001 From: vikram-dagger <112123850+vikram-dagger@users.noreply.github.com> Date: Sat, 14 Dec 2024 15:32:03 +0530 Subject: [PATCH 3/3] docs: Move content on rootless mode from operator manual (#9075) * docs: rework custom configuration docs Signed-off-by: Justin Chadwell * chore: apply suggestions from code review Co-authored-by: vikram-dagger <112123850+vikram-dagger@users.noreply.github.com> Signed-off-by: Justin Chadwell * Copy edit Signed-off-by: Vikram Vaswani * Add Engine API page Signed-off-by: Vikram Vaswani * Add security page Signed-off-by: Vikram Vaswani * docs: Migrate content on rootless mode from operator manual Signed-off-by: Vikram Vaswani * Deleted empty file Signed-off-by: Vikram Vaswani --------- Signed-off-by: Justin Chadwell Signed-off-by: Vikram Vaswani Co-authored-by: Justin Chadwell --- .../configuration/custom-runner.mdx | 1 - docs/current_docs/configuration/engine.mdx | 21 +++++++++++++++++++ docs/current_docs/faq.mdx | 4 ---- docs/netlify.toml | 8 ++++++- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/docs/current_docs/configuration/custom-runner.mdx b/docs/current_docs/configuration/custom-runner.mdx index a42f9eec4f3..e9575b5f022 100644 --- a/docs/current_docs/configuration/custom-runner.mdx +++ b/docs/current_docs/configuration/custom-runner.mdx @@ -75,4 +75,3 @@ are using a connection type that does not provide encryption, then all queries and responses will be sent in plaintext over the wire from the Dagger CLI to the runner. ::: - diff --git a/docs/current_docs/configuration/engine.mdx b/docs/current_docs/configuration/engine.mdx index 0aebeec43ac..258bc66b0f6 100644 --- a/docs/current_docs/configuration/engine.mdx +++ b/docs/current_docs/configuration/engine.mdx @@ -190,6 +190,27 @@ insecure-entitlements = [] +#### Rootless mode + +"Rootless mode" means running the Dagger Engine as a container without the `--privileged` flag. In this case, the container would not run as the `root` user of the system. + +Currently, the Dagger Engine cannot be run as a rootless container; network and filesystem constraints related to rootless usage would currently significantly limit its capabilities and performance. + +##### Filesystem constraints + +The Dagger Engine relies on the `overlayfs` snapshotter for efficient construction of container filesystems. However, only relatively recent Linux kernel versions fully support `overlayfs` inside of rootless user namespaces. On older kernels, there are fallback options such as [`fuse-overlayfs`](https://github.com/containers/fuse-overlayfs), but they come with their own complications in terms of degraded performance and host-specific setup. + +We've not yet invested in the significant work it would take to support+document running optimally on each kernel version, hence the limitation at this time. + +##### Network constraints + +Running the Dagger Engine in rootless mode constrains network management due to the fact that it's not possible for a rootless container to move a network device from the host network namespace to its own network namespace. + +It is possible to use userspace TCP/IP implementations such as [slirp](https://github.com/rootless-containers/slirp4netns) as a workaround, but they often significantly decrease network performance. This [comparison table of network drivers](https://github.com/rootless-containers/rootlesskit/blob/master/docs/network.md#network-drivers) shows that `slirp` is at least five times slower than a root-privileged network driver. + +Newer options for more performant userspace network stacks have arisen in recent years, but they are generally either reliant on relatively recent kernel versions or in a nascent stage that would require significant validation around robustness+security. + + ### Garbage collection The Dagger Engine [caches various operations](./cache.mdx) to improve speed on diff --git a/docs/current_docs/faq.mdx b/docs/current_docs/faq.mdx index 7205ab4a89c..0e7ad88ca89 100644 --- a/docs/current_docs/faq.mdx +++ b/docs/current_docs/faq.mdx @@ -39,10 +39,6 @@ We use telemetry for aggregate analysis, and do not tie telemetry events to a sp Dagger implements the [Console Do Not Track (DNT) standard](https://consoledonottrack.com/). As a result, you can disable the telemetry by setting the environment variable `DO_NOT_TRACK=1` before running the Dagger CLI. -### Can I run the Dagger Engine as a "rootless" container? - -No. "Rootless mode" means running the Dagger Engine as a container without the `--privileged` flag. In this case, the container would not run as the "root" user of the system. Currently, the Dagger Engine cannot be run as a rootless container; network and filesystem constraints related to rootless usage would significantly limit its capabilities and performance. This also means that Dagger is not compatible with platforms which do not support privileged containers, such as AWS Fargate and GKE Autopilot. [Read more about these constraints](https://github.com/dagger/dagger/blob/main/core/docs/d7yxc-operator_manual.md). - ### Can I configure the Dagger Engine? Yes. [Read more about Dagger Engine configuration](https://github.com/dagger/dagger/blob/main/core/docs/d7yxc-operator_manual.md). diff --git a/docs/netlify.toml b/docs/netlify.toml index 3a30ad9d578..5bc44af7c00 100644 --- a/docs/netlify.toml +++ b/docs/netlify.toml @@ -1200,7 +1200,13 @@ [[redirects]] # redirect from = "/configuration/custom-registry" - to = "/configuration/engine#configuring-custom-registries" + to = "/configuration/engine#custom-registries" + status = 301 + +[[redirects]] + # redirect + from = "/configuration/cache" + to = "/api/engine#caching" status = 301 [[redirects]]