Merge pull request #1603 from TomChv/europa-0.2.0/fix-docker-run-exports-path

Fix docker run exports path
This commit is contained in:
Solomon Hykes 2022-02-18 13:55:31 -08:00 committed by GitHub
commit 51cc976242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 27 deletions

View File

@ -32,7 +32,7 @@ dagger.#Plan & {
filename: "hello.sh" 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 // Run a script from string
@ -42,7 +42,7 @@ dagger.#Plan & {
export: files: "/output.txt": _ export: files: "/output.txt": _
script: contents: "echo 'Hello, inlined world!' > /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"
} }
} }

View File

@ -84,20 +84,37 @@ import (
export: { export: {
rootfs: dagger.#FS & _exec.output rootfs: dagger.#FS & _exec.output
files: [path=string]: { files: [path=string]: string
contents: string & _read.contents _files: {
_read: dagger.#ReadFile & { for path, _ in files {
input: _exec.output "\(path)": {
"path": path contents: string & _read.contents
_read: dagger.#ReadFile & {
input: _exec.output
"path": path
}
}
} }
} }
directories: [path=string]: { for path, output in _files {
contents: dagger.#FS & _subdir.output files: "\(path)": output.contents
_subdir: dagger.#Subdir & { }
input: _exec.output
"path": path 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
}
} }
} }

View File

@ -33,16 +33,15 @@ dagger.#Plan & {
// Test: export a file // Test: export a file
exportFile: { exportFile: {
image: _image run: docker.#Run & {
command: { input: _image
name: "sh" command: {
flags: "-c": #""" name: "sh"
echo -n hello world >> /output.txt flags: "-c": #"""
"""# echo -n hello world >> /output.txt
} """#
export: files: "/output.txt": _ & { }
// Assert content export: files: "/output.txt": string & "hello world"
contents: "hello world"
} }
} }
@ -61,7 +60,7 @@ dagger.#Plan & {
} }
verify: dagger.#ReadFile & { verify: dagger.#ReadFile & {
input: run.export.directories."/test".contents input: run.export.directories."/test"
path: "/output.txt" path: "/output.txt"
} }
verify: contents: "hello world" verify: contents: "hello world"

View File

@ -99,11 +99,11 @@ import (
} }
// URL of the deployed site // URL of the deployed site
url: container.export.files."/netlify/url".contents url: container.export.files."/netlify/url"
// URL of the latest deployment // 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 // URL for logs of the latest deployment
logsUrl: container.export.files."/netlify/logsUrl".contents logsUrl: container.export.files."/netlify/logsUrl"
} }

View File

@ -116,5 +116,5 @@ import (
} }
// The final contents of the package after build // The final contents of the package after build
output: container.export.directories."/build".contents output: container.export.directories."/build"
} }