#Default value for platform?
1 messages ยท Page 1 of 1 (latest)
if p == nil p = runtime.GOARCH?
I don't think there's another way today.
cc @tidal lagoon
?
For arch, that works, I don't think there's a way to know the host OS though
I saw another way being used somewhere in our CI but can't find it anymore ๐ญ
some constant that exists in dagger.gen.go? cc @tiny ermine (sorry for the multiping)
seems like dag.DefaultPlatform(ctx)?
Ah! Yeah that's it! Thank you
(hate that that requires error checking but anyway)
Would be cool to have a way to choose if I want the default to be 1) the engine's default platform, or 2) the caller's platform ๐
DefaultPlatform() is the platform of the engine. For the host, it's supported by the CLI, using the special value "current":
dagger call my-func --platform=current
They use the same underlying library but may get different values because the CLI runs on the host while the API runs in a container.
I know ๐ I want a way to choose between them in my pragmas
Proposal:
func Foo(
// +optional
// +default="client" <-- OPTION 1: use the client's platform
// +default="runtime" <-- OPTION 2: use the current runtime platform (running the current function)
// +default="engine" <-- OPTION 3: use the engine's default platform
platform dagger.Platform,
)
The CLI would map them:
$ dagger call foo --platform=client
$ dagger call foo --platform=runtime
$ dagger call foo --platform=engine
"runtime" and "engine" may not be the same if eg. the engine supports multiple platforms, and the current function is running in a non-default one, in qemu for some reason. I don't think there's a way to configure this at the moment, but it could conceivably happen
Are there any references or WIP references regarding turning the idea into reality?