HACK: the way buildkit works, we can only supply an Auth Provider for the entirety of the build session (`dagger up`). Therefore, we start by scanning all auth in the entire Cue tree and supply an auth provider for all of them.
Drawbacks:
- As soon as you add `auth` in a Pipeline for a registry, all other Pipelines have access to the same registry
- You can't use different credentials for the same registry
Fixes#301
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
we can't serialize Cue in a lossless way. The current architecture has
the frontend serialize the state (plan, input, computed) to Cue files,
then the client loads them back. We lose information by doing this, and
therefore the merge fails.
This change removes the abstraction so that we operate directly on the
cue.Instance.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
The API was a bit confusing with code mixing the usage of Deployment and
DeploymentState.
This change marks a clear separation:
- Client is the only piece of code manipulating *Deployment
- CLI commands can manipulate DeploymentState objects and pass them to
Client
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
- Solver: Encapsulates all access to Buildkit. Can solve plain LLB, invoke external frontends (for DockerBuild) and export (for ContainerPush)
- FS (now BuildkitFS) implements the standard Go 1.16 io/fs.FS interface and provides a read-only filesystem on top of a buildkit result. It can be used with built-ins such as fs.WalkDir (no need to have our own Walk functions anymore)
- Moved CueBuild into compiler.Build since it no longer depends on Buildkit. Instead it relies on the io/fs.FS interface, which is used both for the base config and the stdlib (go:embed also uses io/fs.FS). Overlaying base and the stdlib is now done by the same code.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
- Automatically start a buildkit daemon if no BUILDKIT_HOST is
provided (and if not already started)
- Customization of BUILDKIT_HOST is still possible, just like before
- Automatically upgrade the managed daemon to the version used by dagger
if necessary
- Add CI test to make sure the managed buildkit and the vendored
buildkit versions match
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
- Remove unnecessary Fill() in Export()
- Change `set()` and the way we store outputs so we don't fill
intermediaries as much
- WIP: Scan the tree only once. Changed LocalDirs to use cueflow rather than
doing our own Walk. In a follow up we should use the same flow
instance.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
Now using the same pattern as Go's http package.
- the `compiler.Compiler` struct can be used directly (and tests to do
to avoid messing with the global version)
- `compiler.DefaultCompiler` contains a public default Compiler instance
- `compiler` exposes proxy functions (e.g. Compile) back to the
DefaultCompiler
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>