#If I wanted to contribute a performance
1 messages · Page 1 of 1 (latest)
The module-specific parts of SDKs are:
- python -
sdk/python/src/dagger/mod - typescript -
sdk/nodejs/introspector - go -
cmd/codegen/generator/go/templates/modules.go(and a few related files in that dir withmodulesin their name
(Go in particular is in a bit of an unexpected place for mostly historical reasons around how codegen worked since the beginning of Cloak. Probably possible to rectify)
However, I'd also say that to the extent possible, we only want to add features in the SDK code that are highly specific to that language.
Something like performance optimizations around pinning image digests and all that should be done in the engine ("server-side") unless there's truly no other way
But if the image refs are specified in the SDK code, how else can I pin them to a digest? I was planning on just adding digests everywhere in the SDK or core code that doesn't have them, should I not do that?
I did find one low-hanging fruit in the core:
diff --git a/core/modules/resolver.go b/core/modules/resolver.go
index b5e928829..40344be4e 100644
--- a/core/modules/resolver.go
+++ b/core/modules/resolver.go
@@ -14,6 +14,12 @@ import (
"github.com/moby/buildkit/identity"
)
+var (
+ // The digest-pinned ref of an address that can run 'git'
+ // FIXME: make this image smaller
+ gitImageRef = "index.docker.io/alpine/git@sha256:1031f50b5bdda7eee6167e362cff09b8c809889cd43e5306abc5bf6438e68890"
+)
+
// Ref contains all of the information we're able to learn about a provided
// module ref.
type Ref struct {
@@ -305,7 +311,7 @@ func ResolveModuleDependency(ctx context.Context, dag *dagger.Client, parent *Re
func defaultBranch(ctx context.Context, dag *dagger.Client, repo string) (string, error) {
output, err := dag.Container().
- From("alpine/git").
+ From(gitImageRef).
WithEnvVariable("CACHEBUSTER", identity.NewID()). // force this to always run so we don't get stale data
WithExec([]string{"git", "ls-remote", "--symref", repo, "HEAD"}, dagger.ContainerWithExecOpts{
SkipEntrypoint: true,
That LGTM 🚢