Commit Graph

47 Commits

Author SHA1 Message Date
Solomon Hykes
e6e8ab390d Rename "deployment" to "environment": code
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-04-27 13:59:27 -07:00
Sam Alba
520030d4ee fixed tests creds + added authprovider to client solver
Signed-off-by: Sam Alba <sam.alba@gmail.com>
2021-04-26 18:00:31 -07:00
Sam Alba
45ecc32423 implemented docker-login op to add custom registry credentials to the buildkit from a pipeline
Signed-off-by: Sam Alba <sam.alba@gmail.com>
2021-04-26 17:40:51 -07:00
Andrea Luzzardi
2b7dfcae29 Revert "support registry auth"
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-04-23 16:59:22 -07:00
Andrea Luzzardi
692bd72095 support registry auth
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>
2021-04-20 15:28:33 -07:00
Sam Alba
83f56897a7 solver/client: add ability to disable the cache at the LLB level
Signed-off-by: Sam Alba <sam.alba@gmail.com>
2021-04-14 16:21:18 -07:00
Andrea Luzzardi
60db93a246 client: pass through the deployment directly
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>
2021-04-08 18:11:06 -07:00
Andrea Luzzardi
e54f1b0c3a store only computed values in compute layer
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-04-07 19:37:48 -07:00
Andrea Luzzardi
5381d0bfe1 up: store outputs and merge in query
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-04-07 19:05:09 -07:00
Andrea Luzzardi
33d5add54b deployment API cleanup
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>
2021-04-02 15:30:38 -07:00
Sam Alba
c583dc20ef implemented ClientDoFunc callback to make the client.Up code reusable for other client actions
Signed-off-by: Sam Alba <sam.alba@gmail.com>
2021-03-31 16:32:15 -07:00
Andrea Luzzardi
b9bd250634 client: fix cue error reporting
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-03-31 14:20:02 -07:00
Andrea Luzzardi
a8b41c06b7 cue: Use FillPath everywhere since Fill is now deprecated
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-03-31 13:14:36 -07:00
Andrea Luzzardi
e6674b7b7e terminology: rename layout -> plan
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-03-30 19:45:18 -07:00
Andrea Luzzardi
f901918266 terminology: rename route -> deployment
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-03-30 19:33:21 -07:00
Andrea Luzzardi
a45f3447b7 env -> route cleanup
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-03-26 16:44:13 -07:00
Andrea Luzzardi
cba524eb0f merge Route into Env, rebase dagger compute to use the new API
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-03-25 22:29:11 +00:00
Andrea Luzzardi
c923e5042b cleanup: solver/fs
- 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>
2021-03-12 13:38:49 -08:00
Andrea Luzzardi
c35eca99e1 push container support
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-03-11 16:41:19 -08:00
Andrea Luzzardi
f35df0475b opentracing support
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-03-04 10:45:20 -08:00
Andrea Luzzardi
14ff14ea4f automatically start/upgrade buildkitd
- 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>
2021-03-02 18:37:30 -08:00
Andrea Luzzardi
1fcb36113f cleanup log messages
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-23 16:37:45 -08:00
Andrea Luzzardi
79b66e82fc logs: extract cue path from buildkit solve status
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-23 15:39:52 -08:00
Andrea Luzzardi
890fdb4176 performance: reduce the number of fills
- 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>
2021-02-19 14:04:40 -08:00
Andrea Luzzardi
845fe7eca4 fix error checking
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-17 15:27:40 -08:00
Andrea Luzzardi
fef148f6c0 rename go package dagger.io/go
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-17 13:13:39 -08:00
Andrea Luzzardi
9e86b011d5 cleanup: wrap errors using go 1.13 built-ins
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-17 10:30:51 -08:00
Andrea Luzzardi
74e084944e compiler cleanup
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>
2021-02-17 10:26:38 -08:00
Solomon Hykes
acba8b3988 Simplify runtime code by removing layers of abstraction
- Remove intermediary types `Component`, `Script`, `Op`, `mount`: just use
  `cc.Value` directly
- Remove `Executable` interface.
- Execute llb code with a simple concrete type `Pipeline`
- Analyze llb code with a simple utility `Analyze`

Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-02-12 22:20:20 +00:00
Solomon Hykes
612a25fb9f Simplify code by moving polyfill cue compiler to sub-package cc
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-02-08 15:10:32 -08:00
Andrea Luzzardi
cd0f21dbd2 client: simplify Compute logic
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-02 12:32:22 -08:00
Andrea Luzzardi
c9e0d0854d client: remove unused printer
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-02 11:12:24 -08:00
Andrea Luzzardi
167edf4a76 simplify: remove compute.go
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-02 11:03:12 -08:00
Solomon Hykes
1954c3f731 dagger compute [--input-dir TARGET=DIR] [--input-string TARGET=STRING] [--input-cue CUE] [--input-git REMOTE#REF]
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-31 22:48:30 -08:00
Solomon Hykes
c4e55a6915 Refactor how client prepares environment. Inputs may now reference local directories
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-28 19:29:57 -08:00
Solomon Hykes
e10025d688 Refactor op/script/component loading and spec validation
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-25 11:36:18 -08:00
Solomon Hykes
795b7f585c Clean up client config. Preparation for fixing local dir issues
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-22 17:15:22 -08:00
Andrea Luzzardi
b59c020631
Merge pull request #58 from blocklayerhq/buildkit-errors
cleanup buildkit errors everywhere
2021-01-20 18:23:25 -08:00
Andrea Luzzardi
0381c58d80 cleanup buildkit errors everywhere
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-20 18:05:40 -08:00
Andrea Luzzardi
41515c931e dagger.Value: make compiler instance private
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-20 16:13:33 -08:00
Andrea Luzzardi
16fd14b0c9 cmd: wire --input flag into client
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-14 15:21:27 -08:00
Andrea Luzzardi
e09723861f re-wire logging on top of zerolog
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-13 18:18:48 -08:00
Andrea Luzzardi
10224682f7 client: keep resource initialization and cleanup together
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-11 11:51:15 -08:00
Solomon Hykes
00414449b7 Clean up debug messages & comments
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-09 17:25:12 -08:00
Andrea Luzzardi
adf3511b1e fix lint errors, enable CI
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-08 17:18:34 +01:00
Solomon Hykes
3162ca0991 Refactor
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-07 13:57:39 -08:00
Solomon Hykes
30f75da114 Move prototype 69-dagger-archon to top-level
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2020-12-29 18:45:16 -08:00