Commit Graph

135 Commits

Author SHA1 Message Date
Andrea Luzzardi
bc2dae7e32 docker build support
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-22 14:14:51 -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
3ddd967291 local: fix when include is not specified
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-17 17:19:49 -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
Andrea Luzzardi
5ba6dd1617 embedded stdlib
This PR embeds the stdlib into the dagger binary itself for convenience.
Long term we will want to source the stdlib directly from git.

- Updated go to 1.16 to use the new built-in embedding functionality
- The `stdlib` go package now contains an embed of the stdlib

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-17 10:08:56 -08:00
Andrea Luzzardi
31f1cd9f1d
Merge pull request #119 from dagger/small-cleanup
Small cleanup
2021-02-16 14:41:18 -08:00
Solomon Hykes
be8f600c59 dagger/cc: remove locking methods from public API
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-02-13 17:40:21 +00:00
Solomon Hykes
bff4186bf4 dagger compute auto-fetches standard library from external repo
- Standard library is hosted at github.com/blocklayerhq/dagger-stdlib
- When dagger repo is made public, stdlib can be hosted from same repo
- Vendored cue.mod is merged with stdlib at file granularity
- When developing dagger, set DAGGER_DEV_STDLIB to a local stdlib
  directory

Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-02-12 23:31:13 +00:00
Solomon Hykes
e8527ddcf5 No more runtime spec validation
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-02-12 23:30:46 +00: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
Andrea Luzzardi
3718749db5 re-enable spec generation
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-10 18:43:07 -08:00
Andrea Luzzardi
7cbce4eec1
Merge pull request #108 from verdverm/mount-path
support path option in script/component mounts
2021-02-09 12:51:14 -08:00
Tony Worm
8de7a47b8d support path option in script/component mounts
Signed-off-by: Tony Worm <tony@hofstadter.io>
2021-02-09 15:00:23 -05:00
Solomon Hykes
781b89e41c Simplify op.go by removing unnecessary cue validations
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-02-08 15:10:32 -08: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
Solomon Hykes
622de21883 {do:"subdir"} to select a subdirectory in a script
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-02-05 15:27:37 -08:00
Solomon Hykes
0202f4447b Don't instantiate a global shared Env in cmd/compute.go
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-02-05 15:27:19 -08:00
Solomon Hykes
0fe2ef4fe4 Simplify Env API: Compute/Components instead of Compute/Walk
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-02-05 15:27:19 -08:00
Andrea Luzzardi
5b7bc78cf1
Merge pull request #104 from blocklayerhq/mnt-cache
mount cache support
2021-02-05 15:18:32 -08:00
Andrea Luzzardi
b0294e79d1 solver: trace LLB
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-05 15:14:45 -08:00
Andrea Luzzardi
f336164699 mount cache support
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-05 15:08:44 -08:00
Solomon Hykes
b30febc7c2 Fix out-of-the-blue linter errors
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-02-03 12:39:25 -08:00
Andrea Luzzardi
c6e010d4f0 Misc Export fixes
- Temporarily disable export of base.cue as it causes merge errors at
  the end of compute
- Fixes for JSON export for Scalar and Lists
- Add YAML export
- Removed BOOL and NUMBER support, using JSON for now
- Re-enabled all export tests

Fixes #36

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-02 16:19:46 -08:00
Andrea Luzzardi
86aa031f92 fix concurrency issues in Compiler.Compile and Value.Source
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-02 13:52:52 -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
Andrea Luzzardi
6e31193d64
Merge pull request #87 from blocklayerhq/input-ux
Better ux for inputs
2021-02-02 10:45:48 -08:00
Andrea Luzzardi
78601fefd6 fix dependencies between tasks
due to using an old snapshot of cue.Value, components relying on
dependent tasks were failing because of non-concretness.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-02 10:31:52 -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
Dan POP
23a1211cdf Update gen.sh to remove redundant error check
cue eval spec.cue >/dev/null removed (redunant per @shykes)

Signed-off-by: Dan POP <dan.papandrea@sysdig.com>
2021-01-28 22:38:38 -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
a26b767780 Fix bug in localdir (optional fields in spec not supported)
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-28 19:29:57 -08:00
Solomon Hykes
3e5063828a Fix bug in exec/mount
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-28 19:29:57 -08:00
Andrea Luzzardi
cc5a48d39b
Merge pull request #76 from blocklayerhq/output-no-merge
output: merge base/input/output into a single state.cue
2021-01-26 16:53:32 -08:00
Solomon Hykes
f933278d43 Fix spec validation & merge so that default values are correctly applied
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-26 16:52:14 -08:00
Andrea Luzzardi
04526b5b78 output: merge base/input/output into a single state.cue
Exporting base/input/output separately causes merge errors.
For instance, `foo: string | *"default foo"` gets serialized as
`{"foo":"default foo"}`, which will fail to merge if output contains
a different definition of `foo`.

This change temporarily merges the 3 streams together before
serializing.

Fixes #51

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-26 12:12:42 -08:00
Andrea Luzzardi
75fbddf6be op: exec: fix dir
Fixes #30

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-25 16:19:20 -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
bbe16283ab Incremental cleanup: wrap env instance in a Value
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
Solomon Hykes
eab6028b70 Replace Fillable interface with a concrete wrapper
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-21 23:46:58 -08:00
Andrea Luzzardi
2ee27e83f3
Merge pull request #65 from blocklayerhq/fix-value-json
Fix bug in Value.JSON(), with regression test
2021-01-21 15:52:16 -08:00
Solomon Hykes
7322ed1aa4 Fix bug in Value.JSON(), with regression test
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-21 15:27:09 -08:00
Solomon Hykes
91654ba786 Unit tests to reproduce issue #19 and narrow down root cause.
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-21 15:24:00 -08:00
Andrea Luzzardi
007b10f455 explicit log message when failing to Fill
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-21 12:16:10 -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
a9698ccd18
Merge pull request #57 from blocklayerhq/clean-abort-non-concrete
script: abort execution with a warning when the op is not concrete
2021-01-20 18:06:32 -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
4edc5764e5 script: abort execution with a warning when the op is not concrete
Fixes #28

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-20 17:34:15 -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
d22326b512 export: log exported value
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-20 13:03:28 -08:00
Andrea Luzzardi
644713e3f9 spec: simplify signature
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-20 13:01:45 -08:00
Andrea Luzzardi
5e5ef6b843 value wrapper: better isolation of the underlying cue.Value
Ported from #17

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-20 12:55:44 -08:00
Andrea Luzzardi
58aa298581 Fix locking around Fill and Lookup
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-20 12:16:56 -08:00
Andrea Luzzardi
e090f657bb solver: solve synchronously
This forces Solve() to be synchronous and ensures operations don't get
discarded because of optimizations.

Improves fix for #14

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-15 14:44:22 -08:00
Andrea Luzzardi
0a66b87d7d compute: spit out errors earlier
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-14 18:40:30 -08:00
Andrea Luzzardi
22fb218b28 component: do not fail if #dagger marker has no compute
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-14 18:01:45 -08:00
Andrea Luzzardi
9e0bb85a1b fs: don't panic when handling scratch output results
Fixes #22

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-14 17:37:07 -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
f8a2109aba env.walk: inject contextual logging information
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-13 18:18:48 -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
49f0c0e149 cmd: re-use existing ui library
Also, move CLI-only utils into `cmd` rather than the top-level package.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-13 14:43:08 -08:00
Andrea Luzzardi
968341fb74 env: no pointer to mutex
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-13 14:30:27 -08:00
Solomon Hykes
338b3d4b46 Protect cueflow calls with mutex
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-13 14:30:27 -08:00
Andrea Luzzardi
b5427cfbaa compiler: properly format cue errors
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-12 11:23:40 -08:00
Solomon Hykes
8b105003bb Component.Compute: force "real" solve. Fixes #14.
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-12 10:31:50 -08:00
Andrea Luzzardi
eef9c7fafd spec: updated generated spec
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-11 18:56:31 -08:00
Andrea Luzzardi
4ad7b6e90e spec: fix linter
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-11 18:42:32 -08:00
Andrea Luzzardi
c093a38d95 component: stop mixing pointers and non pointers
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-11 18:05:52 -08:00
Andrea Luzzardi
fedd85f09d exec: correctly lookup mounts. Fixes #6
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-11 18:05:33 -08:00
dubo-dubon-duponey
07a3e6b02d
Fix #9
Signed-off-by: dubo-dubon-duponey <dubodubonduponey+github@pm.me>
2021-01-11 16:28:13 -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
dubo-dubon-duponey
0097c73931
Fix crash
Signed-off-by: dubo-dubon-duponey <dubodubonduponey+github@pm.me>
2021-01-11 11:09:08 -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
Solomon Hykes
216e808465 Add test to reproduce crash computing examples/simple
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-09 17:22:51 -08:00
Solomon Hykes
27a44a9e58 Fix bug in Env.Walk
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-09 17:07:39 -08:00
Andrea Luzzardi
2dfe2fccbe linter: ensure make generate is up to date
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-01-08 17:29:06 +01: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
c5842f894a clean up & bugfix
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-07 16:54:52 -08: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