diff --git a/pkg/universe.dagger.io/docker/build.cue b/pkg/universe.dagger.io/docker/build.cue index 16e0724b..fa58e9d9 100644 --- a/pkg/universe.dagger.io/docker/build.cue +++ b/pkg/universe.dagger.io/docker/build.cue @@ -16,7 +16,12 @@ import ( "\(idx)": step & { // connect input to previous output if idx > 0 { - input: _dag["\(idx-1)"].output + // FIXME: the intermediary `output` is needed because of a possible CUE bug. + // `._dag."0".output: 1 errors in empty disjunction::` + // See: https://github.com/cue-lang/cue/issues/1446 + // input: _dag["\(idx-1)"].output + _output: _dag["\(idx-1)"].output + input: _output } } } diff --git a/pkg/universe.dagger.io/docker/test/bash/bash.cue b/pkg/universe.dagger.io/docker/test/bash/bash.cue deleted file mode 100644 index 20c458e7..00000000 --- a/pkg/universe.dagger.io/docker/test/bash/bash.cue +++ /dev/null @@ -1,15 +0,0 @@ -package docker - -cmd: #Command & { - script: "echo hello world" - exec: { - name: "/bin/bash" - flags: { - "-c": script - "--noprofile": true - "--norc": true - "-e": true - "-o": "pipefail" - } - } -} diff --git a/pkg/universe.dagger.io/docker/test/build/build.cue b/pkg/universe.dagger.io/docker/test/build/build.cue deleted file mode 100644 index 3cdc74c1..00000000 --- a/pkg/universe.dagger.io/docker/test/build/build.cue +++ /dev/null @@ -1,65 +0,0 @@ -package docker - -import ( - "dagger.io/dagger" - "universe.dagger.io/nginx" -) - -tests: { - "set config manually": build: #Build & { - steps: [{ - output: #Image & { - config: user: "foo" - } - }] - } - - // - import nginx base - // - copy app directory into /usr/share/nginx/html - "build static web server": { - source: dagger.#FS - - build: #Build & { - steps: [ - nginx.#Build & { - flavor: "alpine" - }, - { - // Custom step to watermark the image - input: _ - output: input & { - config: user: "42" - } - }, - #Copy & { - contents: source - dest: "/usr/share/nginx/html" - }, - ] - } - - image: build.output - // Assert: - image: config: user: "42" - } - - "Run multiple commands": { - build: #Build & { - steps: [ - #Pull & { - source: "alpine" - }, - #Run & { - script: "echo A > /A.txt" - }, - #Run & { - script: "echo B > /B.txt" - }, - #Run & { - script: "echo C > /C.txt" - }, - ] - } - result: build.output - } -} diff --git a/pkg/universe.dagger.io/docker/test/docker.bats b/pkg/universe.dagger.io/docker/test/docker.bats new file mode 100644 index 00000000..09240f03 --- /dev/null +++ b/pkg/universe.dagger.io/docker/test/docker.bats @@ -0,0 +1,13 @@ +setup() { + load '../../bats_helpers' + + common_setup +} + +@test "docker.#Build" { + dagger up ./nested-build-test.cue + + # FIXME: this is currently broken + run dagger up ./multi-nested-build-test.cue + assert_failure +} diff --git a/pkg/universe.dagger.io/docker/test/multi-nested-build-test.cue b/pkg/universe.dagger.io/docker/test/multi-nested-build-test.cue new file mode 100644 index 00000000..6570d51e --- /dev/null +++ b/pkg/universe.dagger.io/docker/test/multi-nested-build-test.cue @@ -0,0 +1,33 @@ +package docker + +import ( + "dagger.io/dagger" + "universe.dagger.io/docker" +) + +dagger.#Plan & { + actions: build: docker.#Build & { + steps: [ + docker.#Build & { + steps: [ + docker.#Build & { + steps: [ + docker.#Pull & { + source: "alpine" + }, + docker.#Run & { + cmd: name: "ls" + }, + ] + }, + docker.#Run & { + cmd: name: "ls" + }, + ] + }, + docker.#Run & { + cmd: name: "ls" + }, + ] + } +} diff --git a/pkg/universe.dagger.io/docker/test/nested-build-test.cue b/pkg/universe.dagger.io/docker/test/nested-build-test.cue new file mode 100644 index 00000000..e767bd0a --- /dev/null +++ b/pkg/universe.dagger.io/docker/test/nested-build-test.cue @@ -0,0 +1,26 @@ +package docker + +import ( + "dagger.io/dagger" + "universe.dagger.io/docker" +) + +dagger.#Plan & { + actions: build: docker.#Build & { + steps: [ + docker.#Build & { + steps: [ + docker.#Pull & { + source: "alpine" + }, + docker.#Run & { + cmd: name: "ls" + }, + ] + }, + docker.#Run & { + cmd: name: "ls" + }, + ] + } +}