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

add more context to dagger and ci integrations pages #7235

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
43750aa
update argo workflow example with sidecar
kpenfound May 1, 2024
a1d1f52
remove gomodcache from argo workflows example
kpenfound May 1, 2024
47fbee5
update argo workflows markdown text
kpenfound May 1, 2024
0e2cb0a
avoid panic when masked parent is missing (#7227)
vito Apr 30, 2024
6036d9b
engine: nested exec simplifications and service fixes (#7213)
sipsma Apr 30, 2024
4b9df75
docs: Updates troubleshooting guide (#7222)
vikram-dagger Apr 30, 2024
143c6c9
docs: Fixes typos and paths (#7226)
vikram-dagger Apr 30, 2024
7e7b7a3
docs: Updates quickstart examples (#7172)
vikram-dagger Apr 30, 2024
c2a83bd
refactor(sdk/rust): Into -> From (#6959)
kjuulh May 1, 2024
dacf300
feat: use trait for Struct -> StructID instead of renaming objects (#…
kjuulh May 1, 2024
10fa094
fix: close files in the PersistentPreRunE func (#7086)
testwill May 1, 2024
f1e60a4
chore(sdk/elixir): use introspection json schema from codegen (#7146)
wingyplus May 1, 2024
ed841f9
ci: add default view to dagger json (#7231)
jedevc May 1, 2024
5c52afa
chore(sdk/elixir): update documentation (#7147)
wingyplus May 1, 2024
4baf673
update tekton guide to use kubernetes secret
kpenfound May 1, 2024
49b13a0
Update docs/current_docs/integrations/snippets/tekton-dagger-task.yaml
kpenfound May 2, 2024
f5a64f7
docs: don't use command line plaintext injection (#7232)
jedevc May 1, 2024
303f8a6
fix gitlab before_script (#7214)
marcosnils May 1, 2024
aa2f45c
engine: remove ftp_proxy hack (#7228)
sipsma May 1, 2024
4a178a9
chore: use `load*FromID` in tests (#7233)
jedevc May 2, 2024
3e861d0
telemetry: handle more attr type conversions (#7259)
vito May 2, 2024
e2e17ec
ci: exclude .git dir in ci build (#7234)
jedevc May 2, 2024
fb51d63
chore: remove .trivyignore.yaml (#7225)
jedevc May 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 0 additions & 5 deletions .trivyignore.yaml

This file was deleted.

26 changes: 13 additions & 13 deletions ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,37 +35,37 @@ This will re-create all the files required by your code editor - see

Run all tests:

dagger call --source=. test all
dagger call --source=.:default test all

Run a specific test (e.g. `TestModuleNamespacing`):

dagger call --source=. test custom --run="^TestModuleNamespacing" --pkg="./core/integration"
dagger call --source=.:default test custom --run="^TestModuleNamespacing" --pkg="./core/integration"

## Dev environment

Start a little dev shell with dagger-in-dagger:

dagger call --source=. dev
dagger call --source=.:default dev

## Engine & CLI

### Linting

Run the engine linter:

dagger call --source=. engine lint
dagger call --source=.:default engine lint

### Build the CLI

Build the CLI:

dagger call --source=. cli file export --path=./dagger
dagger call --source=.:default cli file export --path=./dagger

### Run the engine service

Run the engine as a service:

dagger call --source=. engine service --name=dagger-engine up --ports=1234:1234
dagger call --source=.:default engine service --name=dagger-engine up --ports=1234:1234

Connect to it from a dagger cli:

Expand All @@ -77,11 +77,11 @@ Connect to it from a dagger cli:

Lint the docs:

dagger call --source=. docs lint
dagger call --source=.:default docs lint

Auto-generate docs components:

dagger call --source=. docs generate export --path=.
dagger call --source=.:default docs generate export --path=.

## SDKs

Expand Down Expand Up @@ -110,28 +110,28 @@ All SDKs have the same functions defined:

Run an SDK linter (replace `<sdk>` with one of the supported SDKs):

dagger call --source=. sdk <sdk> lint
dagger call --source=.:default sdk <sdk> lint

### Tests

Run SDK tests (replace `<sdk>` with one of the supported SDKs):

dagger call --source=. sdk <sdk> test
dagger call --source=.:default sdk <sdk> test

### Generate

Generate SDK static files (replace `<sdk>` with one of the supported SDKs):

dagger call --source=. sdk <sdk> generate export --path=.
dagger call --source=.:default sdk <sdk> generate export --path=.

### Publish

Dry-run an SDK publishing step (replace `<sdk>` with one of the supported SDKs):

dagger call --source=. sdk <sdk> publish --dry-run
dagger call --source=.:default sdk <sdk> publish --dry-run

### Bump

Bump an SDK version for releasing (replace `<sdk>` with one of the supported SDKs):

dagger call --source=. sdk <sdk> bump --version=$VERSION export --path=.
dagger call --source=.:default sdk <sdk> bump --version=$VERSION export --path=.
12 changes: 6 additions & 6 deletions ci/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,19 @@ func (e *Engine) Lint(
// +optional
all bool,
) error {
eg, ctx := errgroup.WithContext(ctx)
src := e.Dagger.Source.AsModule().GeneratedContextDirectory()

pkgs := []string{""}
// pkgs := []string{"", "ci"}
eg, ctx := errgroup.WithContext(ctx)

pkgs := []string{"", "ci"}
cmd := []string{"golangci-lint", "run", "-v", "--timeout", "5m"}
if all {
cmd = append(cmd, "--max-issues-per-linter=0", "--max-same-issues=0")
}
for _, pkg := range pkgs {
golangci := dag.Container().
From(consts.GolangLintImage).
WithMountedDirectory("/app", util.GoDirectory(e.Dagger.Source)).
WithMountedDirectory("/app", util.GoDirectory(src)).
WithWorkdir(path.Join("/app", pkg)).
WithExec(cmd)
eg.Go(func() error {
Expand All @@ -145,8 +145,8 @@ func (e *Engine) Lint(
})

eg.Go(func() error {
return util.DiffDirectoryF(ctx, util.GoDirectory(e.Dagger.Source), func(ctx context.Context) (*dagger.Directory, error) {
return util.GoBase(e.Dagger.Source).
return util.DiffDirectoryF(ctx, util.GoDirectory(src), func(ctx context.Context) (*dagger.Directory, error) {
return util.GoBase(src).
WithExec([]string{"go", "mod", "tidy"}).
Directory("."), nil
}, "go.mod", "go.sum")
Expand Down
33 changes: 12 additions & 21 deletions ci/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@ module github.com/dagger/dagger/ci

go 1.21.7

replace github.com/dagger/dagger => ../

require (
dagger.io/dagger v0.11.1
github.com/dagger/dagger v0.11.1
)

require (
github.com/99designs/gqlgen v0.17.44
github.com/Khan/genqlient v0.7.0
github.com/containerd/containerd v1.7.15-0.20240329193453-0dcf21c1528a
github.com/dagger/dagger v0.11.1
github.com/magefile/mage v1.15.0
github.com/moby/buildkit v0.13.0-rc3.0.20240403135707-dc23e43dc15c
github.com/opencontainers/image-spec v1.1.0
Expand All @@ -28,31 +22,28 @@ require (
)

require (
github.com/Microsoft/hcsshim v0.11.4 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 // indirect
)

require (
github.com/Microsoft/hcsshim v0.11.4 // indirect
github.com/adrg/xdg v0.4.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sosodev/duration v1.2.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240325203815-454cdb8f5daa // indirect
google.golang.org/grpc v1.62.1
google.golang.org/protobuf v1.33.0 // indirect
)

replace github.com/dagger/dagger => ../
7 changes: 0 additions & 7 deletions ci/go.sum
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
dagger.io/dagger v0.11.1 h1:LXKVvGPIq4Uii67jJScmaiOOFaG91F+4GOxCMc3I/GE=
dagger.io/dagger v0.11.1/go.mod h1:ABrEbaXuGQtqOlc0WlHWHQt/azY0jEs/O/X8xkX8xxM=
github.com/99designs/gqlgen v0.17.44 h1:OS2wLk/67Y+vXM75XHbwRnNYJcbuJd4OBL76RX3NQQA=
github.com/99designs/gqlgen v0.17.44/go.mod h1:UTCu3xpK2mLI5qcMNw+HKDiEL77it/1XtAjisC4sLwM=
github.com/Khan/genqlient v0.7.0 h1:GZ1meyRnzcDTK48EjqB8t3bcfYvHArCUUvgOwpz1D4w=
github.com/Khan/genqlient v0.7.0/go.mod h1:HNyy3wZvuYwmW3Y7mkoQLZsa/R5n5yIRajS1kPBvSFM=
github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8=
github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w=
github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls=
github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E=
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=
Expand All @@ -34,8 +30,6 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU=
github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg=
github.com/magefile/mage v1.15.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/moby/buildkit v0.13.0-rc3.0.20240403135707-dc23e43dc15c h1:79uQuWhJQjc9Xl1ZwogIkS/BoKNF6GWps5sKTSOXXrs=
github.com/moby/buildkit v0.13.0-rc3.0.20240403135707-dc23e43dc15c/go.mod h1:k97+3l2jpDDC8JxSHywmN1lNFGgEYXk7WaK6LFrg9p0=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
Expand Down Expand Up @@ -84,7 +78,6 @@ golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
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.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
Expand Down
9 changes: 2 additions & 7 deletions ci/mage/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"path/filepath"
"strings"

"dagger.io/dagger"
"github.com/containerd/containerd/platforms"
"github.com/magefile/mage/mg"
"golang.org/x/mod/semver"
Expand All @@ -27,11 +26,7 @@ var (

// Connect tests a connection to a Dagger Engine
func (t Engine) Connect(ctx context.Context) error {
c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr))
if err != nil {
return err
}
return c.Close()
return util.DaggerCall(ctx, "--help")
}

// Lint lints the engine
Expand Down Expand Up @@ -145,7 +140,7 @@ func (t Engine) Dev(ctx context.Context) error {
}
tarPath := "./bin/engine.tar"
args = append(args, "container", "export", "--path="+tarPath)
args = append(args, "--forced-compression="+string(dagger.Gzip)) // use gzip to avoid incompatibility w/ older docker versions
args = append(args, "--forced-compression=Gzip") // use gzip to avoid incompatibility w/ older docker versions
err := util.DaggerCall(ctx, args...)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion ci/mage/util/dagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func DaggerCall(ctx context.Context, args ...string) error {
}

cmd := exec.CommandContext(ctx, binary)
cmd.Args = append(cmd.Args, "call", "--source=.")
cmd.Args = append(cmd.Args, "call", "--source=.:default")
if path, err := hostDockerConfig(); err == nil {
cmd.Args = append(cmd.Args, "--host-docker-config=file:"+path)
}
Expand Down
16 changes: 3 additions & 13 deletions ci/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/dagger/dagger/ci/internal/dagger"
"github.com/dagger/dagger/ci/util"
"golang.org/x/mod/semver"
)

// A dev environment for the Dagger Engine
Expand All @@ -29,18 +28,9 @@ func New(
// +optional
hostDockerConfig *Secret,
) (*Dagger, error) {
var versionInfo *VersionInfo
switch {
case version == "":
var err error
versionInfo, err = newVersionFromGit(ctx, source.Directory(".git"))
if err != nil {
return nil, err
}
case semver.IsValid(version):
versionInfo = &VersionInfo{Tag: version}
default:
versionInfo = &VersionInfo{Commit: version}
versionInfo, err := newVersion(ctx, source, version)
if err != nil {
return nil, err
}

return &Dagger{
Expand Down
10 changes: 5 additions & 5 deletions ci/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ import (
// A dev environment for the official Dagger SDKs
type SDK struct {
// Develop the Dagger Go SDK
Go *GoSDK
Go *GoSDK
// Develop the Dagger Python SDK
Python *PythonSDK
Python *PythonSDK
// Develop the Dagger Typescript SDK
Typescript *TypescriptSDK

// Develop the Dagger Elixir SDK (experimental)
Elixir *ElixirSDK
// Develop the Dagger Rust SDK (experimental)
Rust *RustSDK
Rust *RustSDK
// Develop the Dagger Java SDK (experimental)
Java *JavaSDK
Java *JavaSDK
// Develop the Dagger PHP SDK (experimental)
PHP *PHPSDK
PHP *PHPSDK
}

func (ci *Dagger) installer(ctx context.Context, name string) (func(*Container) *Container, error) {
Expand Down
9 changes: 6 additions & 3 deletions ci/sdk_elixir.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,17 @@ func (t ElixirSDK) Generate(ctx context.Context) (*Directory, error) {
if err != nil {
return nil, err
}

introspection, err := t.Dagger.introspection(ctx, installer)
if err != nil {
return nil, err
}
gen := t.elixirBase(elixirVersions[0]).
With(installer).
WithExec([]string{"mix", "run", "scripts/fetch_introspection.exs"}).
WithWorkdir("dagger_codegen").
WithExec([]string{"mix", "deps.get"}).
WithExec([]string{"mix", "escript.build"}).
WithExec([]string{"./dagger_codegen", "generate", "--introspection", "../introspection.json", "--outdir", "gen"}).
WithMountedFile("/schema.json", introspection).
WithExec([]string{"./dagger_codegen", "generate", "--introspection", "/schema.json", "--outdir", "gen"}).
WithExec([]string{"mix", "format", "gen/*.ex"}).
Directory("gen")

Expand Down