From ce4c1f036fa47c6bfcad64e6099753d0c0cc2bcb Mon Sep 17 00:00:00 2001 From: Vasek - Tom C Date: Fri, 11 Feb 2022 17:31:36 +0100 Subject: [PATCH] Resolves #1559 Signed-off-by: Vasek - Tom C --- pkg/universe.dagger.io/bash/test/test.cue | 4 +-- pkg/universe.dagger.io/docker/run.cue | 37 ++++++++++++++++------ pkg/universe.dagger.io/docker/test/run.cue | 23 +++++++------- pkg/universe.dagger.io/netlify/netlify.cue | 6 ++-- pkg/universe.dagger.io/yarn/yarn.cue | 2 +- 5 files changed, 44 insertions(+), 28 deletions(-) diff --git a/pkg/universe.dagger.io/bash/test/test.cue b/pkg/universe.dagger.io/bash/test/test.cue index 037a6349..f11ccdc7 100644 --- a/pkg/universe.dagger.io/bash/test/test.cue +++ b/pkg/universe.dagger.io/bash/test/test.cue @@ -32,7 +32,7 @@ dagger.#Plan & { filename: "hello.sh" } } - output: run.export.files."/out.txt".contents & "Hello, world\n" + output: run.export.files."/out.txt" & "Hello, world\n" } // Run a script from string @@ -42,7 +42,7 @@ dagger.#Plan & { export: files: "/output.txt": _ script: contents: "echo 'Hello, inlined world!' > /output.txt" } - output: run.export.files."/output.txt".contents & "Hello, inlined world!\n" + output: run.export.files."/output.txt" & "Hello, inlined world!\n" } } diff --git a/pkg/universe.dagger.io/docker/run.cue b/pkg/universe.dagger.io/docker/run.cue index dfbb58c1..32234dc2 100644 --- a/pkg/universe.dagger.io/docker/run.cue +++ b/pkg/universe.dagger.io/docker/run.cue @@ -84,20 +84,37 @@ import ( export: { rootfs: dagger.#FS & _exec.output - files: [path=string]: { - contents: string & _read.contents - _read: dagger.#ReadFile & { - input: _exec.output - "path": path + files: [path=string]: string + _files: { + for path, _ in files { + "\(path)": { + contents: string & _read.contents + _read: dagger.#ReadFile & { + input: _exec.output + "path": path + } + } } } - directories: [path=string]: { - contents: dagger.#FS & _subdir.output - _subdir: dagger.#Subdir & { - input: _exec.output - "path": path + for path, output in _files { + files: "\(path)": output.contents + } + + directories: [path=string]: dagger.#FS + _directories: { + for path, _ in directories { + "\(path)": { + contents: dagger.#FS & _subdir.output + _subdir: dagger.#Subdir & { + input: _exec.output + "path": path + } + } } } + for path, output in _directories { + directories: "\(path)": output.contents + } } } diff --git a/pkg/universe.dagger.io/docker/test/run.cue b/pkg/universe.dagger.io/docker/test/run.cue index 477b2e27..7bd336f2 100644 --- a/pkg/universe.dagger.io/docker/test/run.cue +++ b/pkg/universe.dagger.io/docker/test/run.cue @@ -32,17 +32,16 @@ dagger.#Plan & { } // Test: export a file - exportFile: docker.#Run & { - input: _image - command: { - name: "sh" - flags: "-c": #""" - echo -n hello world >> /output.txt - """# - } - export: files: "/output.txt": _ & { - // Assert content - contents: "hello world" + exportFile: { + run: docker.#Run & { + input: _image + command: { + name: "sh" + flags: "-c": #""" + echo -n hello world >> /output.txt + """# + } + export: files: "/output.txt": string & "hello world" } } @@ -61,7 +60,7 @@ dagger.#Plan & { } verify: dagger.#ReadFile & { - input: run.export.directories."/test".contents + input: run.export.directories."/test" path: "/output.txt" } verify: contents: "hello world" diff --git a/pkg/universe.dagger.io/netlify/netlify.cue b/pkg/universe.dagger.io/netlify/netlify.cue index a6df38b2..b54bad63 100644 --- a/pkg/universe.dagger.io/netlify/netlify.cue +++ b/pkg/universe.dagger.io/netlify/netlify.cue @@ -99,11 +99,11 @@ import ( } // URL of the deployed site - url: container.export.files."/netlify/url".contents + url: container.export.files."/netlify/url" // URL of the latest deployment - deployUrl: container.export.files."/netlify/deployUrl".contents + deployUrl: container.export.files."/netlify/deployUrl" // URL for logs of the latest deployment - logsUrl: container.export.files."/netlify/logsUrl".contents + logsUrl: container.export.files."/netlify/logsUrl" } diff --git a/pkg/universe.dagger.io/yarn/yarn.cue b/pkg/universe.dagger.io/yarn/yarn.cue index bc96356e..a4ff1d15 100644 --- a/pkg/universe.dagger.io/yarn/yarn.cue +++ b/pkg/universe.dagger.io/yarn/yarn.cue @@ -116,5 +116,5 @@ import ( } // The final contents of the package after build - output: container.export.directories."/build".contents + output: container.export.directories."/build" }