Simplify docker.#Run

* `cmd` is renamed to `command` for readability
  * `script` is removed. Feature moves up the stack (bash.#Run,
    python.#Run)

Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
Solomon Hykes
2022-02-08 01:35:51 +00:00
parent c04d0cdd0b
commit 354334a3dc
18 changed files with 129 additions and 81 deletions

View File

@@ -16,19 +16,28 @@ dagger.#Plan & {
steps: [
alpine.#Build,
docker.#Run & {
script: """
command: {
name: "sh"
flags: "-c": """
echo -n hello > /bar.txt
"""
"""
}
},
docker.#Run & {
script: """
command: {
name: "sh"
flags: "-c": """
echo -n $(cat /bar.txt) world > /foo.txt
"""
"""
}
},
docker.#Run & {
script: """
command: {
name: "sh"
flags: "-c": """
echo -n $(cat /foo.txt) >> /test.txt
"""
"""
}
},
]
}

View File

@@ -17,9 +17,10 @@ dagger.#Plan & {
steps: [
alpine.#Build,
docker.#Run & {
script: """
echo -n $TEST >> /test.txt
"""
command: {
name: "sh"
flags: "-c": "echo -n $TEST >> /test.txt"
}
env: TEST: #testValue
},
]

View File

@@ -27,7 +27,7 @@ dagger.#Plan & {
}
run: docker.#Run & {
image: myimage
cmd: name: "ls"
command: name: "ls"
export: files: {
"/dagger.txt": _ & {
contents: "not hello from dagger"
@@ -57,9 +57,12 @@ dagger.#Plan & {
verify_working_directory: docker.#Run & {
image: myimage
script: #"""
pwd > dir.txt
"""#
command: {
name: "sh"
flags: "-c": #"""
pwd > dir.txt
"""#
}
export: files: "/bin/dir.txt": _ & {
contents: "/bin\n"
}
@@ -67,9 +70,12 @@ dagger.#Plan & {
verify_working_directory_is_overridden: docker.#Run & {
image: myimage
workdir: "/"
script: #"""
pwd > dir.txt
"""#
command: {
name: "sh"
flags: "-c": #"""
pwd > dir.txt
"""#
}
export: files: "/dir.txt": _ & {
contents: "/\n"
}

View File

@@ -5,6 +5,7 @@ import (
"universe.dagger.io/docker"
)
// FIXME: this test is currently broken (see docker.bats)
dagger.#Plan & {
actions: build: docker.#Build & {
steps: [
@@ -16,17 +17,17 @@ dagger.#Plan & {
source: "alpine"
},
docker.#Run & {
cmd: name: "ls"
command: name: "ls"
},
]
},
docker.#Run & {
cmd: name: "ls"
command: name: "ls"
},
]
},
docker.#Run & {
cmd: name: "ls"
command: name: "ls"
},
]
}

View File

@@ -14,12 +14,12 @@ dagger.#Plan & {
source: "alpine"
},
docker.#Run & {
cmd: name: "ls"
command: name: "ls"
},
]
},
docker.#Run & {
cmd: name: "ls"
command: name: "ls"
},
]
}

View File

@@ -13,7 +13,7 @@ dagger.#Plan & {
run: docker.#Run & {
"image": image.output
cmd: {
command: {
name: "/bin/sh"
args: ["-c", "echo -n hello world >> /output.txt"]
}

View File

@@ -13,10 +13,13 @@ dagger.#Plan & {
run: docker.#Run & {
"image": image.output
script: #"""
mkdir -p test
echo -n hello world >> /test/output.txt
"""#
command: {
name: "sh"
flags: "-c": #"""
mkdir -p test
echo -n hello world >> /test/output.txt
"""#
}
export: {
directories: "/test": _
files: "/test/output.txt": _ & {

View File

@@ -12,9 +12,12 @@ dagger.#Plan & {
run: docker.#Run & {
"image": image.output
script: #"""
echo -n hello world >> /output.txt
"""#
command: {
name: "sh"
flags: "-c": #"""
echo -n hello world >> /output.txt
"""#
}
export: files: "/output.txt": _ & {
contents: "hello world"
}

View File

@@ -13,9 +13,12 @@ dagger.#Plan & {
run: docker.#Run & {
"image": image.output
script: #"""
echo -n $TEST_MESSAGE >> /output.txt
"""#
command: {
name: "sh"
flags: "-c": #"""
echo -n $TEST_MESSAGE >> /output.txt
"""#
}
env: TEST_MESSAGE: "hello world"
}