#services v2 is merged :elmofire:
1 messages ยท Page 1 of 1 (latest)
35: exec go build -o /runtime .
35: > in load builtin module sdk go
35: [0.51s] # dagger
35: [0.51s] ./worker.go:223:34: cannot use registrySvc (variable of type *Container) as *Service value in argument to worker.WithServiceBinding
35: [0.51s] ./worker.go:224:41: cannot use privateRegistry() (value of type *Container) as *Service value in argument to worker.WithServiceBinding("registry", registrySvc).WithServiceBinding
35: [0.51s] ./worker.go:231:26: worker.Endpoint undefined (type *Container has no field or method Endpoint)
35: [0.51s] ./worker.go:231:40: undefined: ContainerEndpointOpts
35: [0.51s] ./worker.go:266:39: cannot use worker (variable of type *Container) as *Service value in argument to w.GoBase.WithExec([]string{โฆ}).WithMountedDirectory("/app", dag.Host().Directory(".")).WithMountedDirectory(utilDirPath, testEngineUtils).WithEnvVariable("_DAGGER_TESTS_ENGINE_TAR", filepath.Join(utilDirPath, "engine.tar")).WithWorkdir("/app").WithServiceBinding
35: [0.51s] ./worker.go:267:34: cannot use registrySvc (variable of type *Container) as *Service value in argument to w.GoBase.WithExec([]string{โฆ}).WithMountedDirectory("/app", dag.Host().Directory(".")).WithMountedDirectory(utilDirPath, testEngineUtils).WithEnvVariable("_DAGGER_TESTS_ENGINE_TAR", filepath.Join(utilDirPath, "engine.tar")).WithWorkdir("/app").WithServiceBinding("dagger-engine", worker).WithServiceBinding
35: exec go build -o /runtime . ERROR: process "go build -o /runtime ." did not complete successfully: exit code: 1
Going to try to get Solomon's dagger module that builds dagger working with the new style. Going to look up the breaking change description
yep - you can get rid of the WithExec(nil) now too
nice. I think I'm running into issues duing dagger mod sync though
this one is weird...wonder if I can delete the WithExec...
WithExec(nil, ContainerWithExecOpts{
InsecureRootCapabilities: true,
}).Service()
using dagger cli built by ./hack/dev on main
seems like a chicken-egg with dagger.gen.go that I've run into sometimes
those first few errors are interesting ๐ค seems related to https://github.com/dagger/dagger/pull/5881
can you link the module?
Here's a simpler one
package main
import (
"context"
)
type Test struct {}
func (m *Test) MyFunction(ctx context.Context) (string, error) {
// create HTTP service container with exposed port 8080
httpSrv := dag.Container().
From("python").
WithDirectory("/srv", dag.Directory().WithNewFile("index.html", "Hello, world!")).
WithWorkdir("/srv").
WithExec([]string{"python", "-m", "http.server", "8080"}).
WithExposedPort(8080).
Service() // ONLY DIFFERENCE
// create client container with service binding
// access HTTP service and print result
val, err := dag.Container().
From("alpine").
WithServiceBinding("www", httpSrv).
WithExec([]string{"wget", "-O-", "http://www:8080"}).
Stdout(ctx)
return val, err
}
using code from the PR s/client/dag/
test โค dagger mod init --name=test --sdk=go
test โค dagger mod sync git:main*
โ asModule(sourceSubpath: ".") ERROR [1.41s]
โถ load builtin module sdk go
โ exec go build -o /runtime . ERROR [0.24s]
โ # test
โ ./main.go:17:3: dag.Container().From("python").WithDirectory("/srv", dag.Directory().WithNewFile("index.html", "Hello,
โ ld!")).WithWorkdir("/srv").WithExec([]string{โฆ}).WithExposedPort(8080).Service undefined (type *Container has no field
โ method Service)
โข Engine: c3980dd25c6c (version devel ())
โง 1.76s โ 16 โ
2 โ 2
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "test" to get functions: failed to get function output directory: process "go build -o /runtime ." did not complete successfully: exit code: 1
needs to be AsService() now
but i'm more worried about those "LoadCommitFromID" errors
This PR combines a few efforts that have been piling up throughout our chaotic Zenith adventures; sorry for the huge PR:
Switch services to run via the gateway interface instead of via Solve() (pr...
I just used that code
Will fix
yep
package main
import (
"context"
)
type Test struct {}
func (m *Test) MyFunction(ctx context.Context) (string, error) {
// create HTTP service container with exposed port 8080
httpSrv := dag.Container().
From("python").
WithDirectory("/srv", dag.Directory().WithNewFile("index.html", "Hello, world!")).
WithWorkdir("/srv").
WithExec([]string{"python", "-m", "http.server", "8080"}).
WithExposedPort(8080).
AsService() // ONLY DIFFERENCE
// create client container with service binding
// access HTTP service and print result
val, err := dag.Container().
From("alpine").
WithServiceBinding("www", httpSrv).
WithExec([]string{"wget", "-O-", "http://www:8080"}).
Stdout(ctx)
return val, err
}
dagger query -m . <<EOF git:main*
query {
test { myFunction }
}
EOF
works!
updated the PR description to avoid confusion
still looking for a repro on those other errors though, could just be a link to the module you tried to sync
Errors ๐
will try to move the name of the service container as discussed
Guessing the issue with the the superGit module being used since
dagger2 โค dagger mod use github.com/shykes/daggerverse/supergit@e2f1b5443f8c398a9866fc9f11eba4b7f20f6471
โ asModule(sourceSubpath: ".") ERROR [2.02s]
โถ load builtin module sdk go โถ load builtin module sdk go
โ exec go build -o /runtime . ERROR [0.23s]
โ # dagger
โ ./dagger.gen.go:226:12: dag.LoadCommitFromID undefined (type *Client has no field or method LoadCommitFromID)
โ ./dagger.gen.go:226:29: undefined: CommitID
โ ./dagger.gen.go:4161:12: dag.LoadRemoteTagFromID undefined (type *Client has no field or method LoadRemoteTag
โ ID)
โ ./dagger.gen.go:4161:32: undefined: RemoteTagID
โข Engine: c3980dd25c6c (version devel ())
โง 3.29s โ 41 โ
9 โ 2
Error: failed to automate vcs: failed to get vcs ignored paths: input:1: host.directory.asModule failed to call module "dagger" to get functions: failed to get function output directory: process "go build -o /runtime ." did not complete successfully: exit code: 1
figured that one out โ๏ธ - it's because Commit and RemoteTag define an "ID" method, which is effectively a reserved word, since that indicates to codegen that the object is ID-able
we should document that as a no-no
or find some other way of dealing with that
i think that'll just have to be reserved, since we also want all objects to be ID-able at some point in the future (I'd guess short/medium-term)
Got it. Yeah, I had some weirdness with a "Version" method at one point where I couldn't update via dagger mod sync but I could recreate the module fresh and use the code with Version in it.
I think that's what was happening...
# supergit
โ ./remote.go:92:22: field and method with the same name Commit
โ ./remote.go:89:2: other declaration of Commit
โ ./remote.go:93:9: cannot use rt.Commit (value of type func() string) as string value in return statement
We should put that one in linear; feel like it should probably just be an error case if a user adds an id field/func (at least for now)
Got it all to agree again
https://github.com/jpadams/shykes-daggerverse-servicesv2
gonna go make a bunch of issues from the sync @frosty trellis @last tulip and I had earlier, will include this
Also created:
- https://linear.app/dagger/issue/DEV-2864/daggerverse-should-only-index-oss-licensed-modules
- https://linear.app/dagger/issue/DEV-2865/document-how-to-convert-a-classic-dagger-codebase-to-zenith
- https://linear.app/dagger/issue/DEV-2866/dagger-mod-init-should-create-a-readmemd
- https://linear.app/dagger/issue/DEV-2867/when-dagger-mod-sync-fails-it-should-at-least-sync-down-the-failing
@supple bane I've just placed these directly in "Zenith for Kubecon" but we can/should discuss whether they're actually a requirement, maybe one or two can be deferred.
Another question that came out in the discussion was, "should dagger mod init take kebab-case module names in addition to graphQL camelCase"
or alternatively, be able to work with several casing schemes
dagger mod init fooBar
dagger mod init FooBar
dagger mod init foo_bar
dagger mod init foo-bar
I moved the last three to the relevant subissues, added my best guesses at priority
the most recent cli work has gone the direction of accepting multiple casing schemes (just become aliases); I'll add an issue for backporting that to the other pre-existing cli commands (if it hasn't been done already)