Merge pull request #1580 from shykes/docker-run-simplify
docker.#Run: remove redundant `image` field
This commit is contained in:
commit
1f357df4f8
@ -34,7 +34,7 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check: docker.#Run & {
|
check: docker.#Run & {
|
||||||
image: build.output
|
input: build.output
|
||||||
command: {
|
command: {
|
||||||
name: "sh"
|
name: "sh"
|
||||||
flags: "-c": """
|
flags: "-c": """
|
||||||
|
@ -25,7 +25,7 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run: bash.#Run & {
|
run: bash.#Run & {
|
||||||
image: _image
|
input: _image
|
||||||
export: files: "/out.txt": _
|
export: files: "/out.txt": _
|
||||||
script: {
|
script: {
|
||||||
directory: dir
|
directory: dir
|
||||||
@ -38,7 +38,7 @@ dagger.#Plan & {
|
|||||||
// Run a script from string
|
// Run a script from string
|
||||||
runString: {
|
runString: {
|
||||||
run: bash.#Run & {
|
run: bash.#Run & {
|
||||||
image: _image
|
input: _image
|
||||||
export: files: "/output.txt": _
|
export: files: "/output.txt": _
|
||||||
script: contents: "echo 'Hello, inlined world!' > /output.txt"
|
script: contents: "echo 'Hello, inlined world!' > /output.txt"
|
||||||
}
|
}
|
||||||
|
@ -9,16 +9,8 @@ import (
|
|||||||
|
|
||||||
// Run a command in a container
|
// Run a command in a container
|
||||||
#Run: {
|
#Run: {
|
||||||
_image: #Image
|
// Docker image to execute
|
||||||
|
|
||||||
{
|
|
||||||
image: #Image
|
|
||||||
_image: image
|
|
||||||
} | {
|
|
||||||
// For compatibility with #Build
|
|
||||||
input: #Image
|
input: #Image
|
||||||
_image: input
|
|
||||||
}
|
|
||||||
|
|
||||||
always: bool | *false
|
always: bool | *false
|
||||||
|
|
||||||
@ -113,12 +105,12 @@ import (
|
|||||||
// For compatibility with #Build
|
// For compatibility with #Build
|
||||||
output: #Image & {
|
output: #Image & {
|
||||||
rootfs: _exec.output
|
rootfs: _exec.output
|
||||||
config: _image.config
|
config: input.config
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actually execute the command
|
// Actually execute the command
|
||||||
_exec: engine.#Exec & {
|
_exec: engine.#Exec & {
|
||||||
input: _image.rootfs
|
"input": input.rootfs
|
||||||
"always": always
|
"always": always
|
||||||
"mounts": mounts
|
"mounts": mounts
|
||||||
|
|
||||||
@ -127,29 +119,29 @@ import (
|
|||||||
}
|
}
|
||||||
if command == _|_ {
|
if command == _|_ {
|
||||||
args: list.Concat([
|
args: list.Concat([
|
||||||
if _image.config.entrypoint != _|_ {
|
if input.config.entrypoint != _|_ {
|
||||||
_image.config.entrypoint
|
input.config.entrypoint
|
||||||
},
|
},
|
||||||
if _image.config.cmd != _|_ {
|
if input.config.cmd != _|_ {
|
||||||
_image.config.cmd
|
input.config.cmd
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
"env": env
|
"env": env
|
||||||
if _image.config.env != _|_ {
|
if input.config.env != _|_ {
|
||||||
for key, val in _image.config.env {
|
for key, val in input.config.env {
|
||||||
if env[key] == _|_ {
|
if env[key] == _|_ {
|
||||||
env: "\(key)": val
|
env: "\(key)": val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"workdir": workdir
|
"workdir": workdir
|
||||||
if workdir == _|_ && _image.config.workdir != _|_ {
|
if workdir == _|_ && input.config.workdir != _|_ {
|
||||||
workdir: _image.config.workdir
|
workdir: input.config.workdir
|
||||||
}
|
}
|
||||||
"user": user
|
"user": user
|
||||||
if user == _|_ && _image.config.user != _|_ {
|
if user == _|_ && input.config.user != _|_ {
|
||||||
user: _image.config.user
|
user: input.config.user
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ dagger.#Plan & {
|
|||||||
config: build.config
|
config: build.config
|
||||||
}
|
}
|
||||||
run: docker.#Run & {
|
run: docker.#Run & {
|
||||||
image: myimage
|
input: myimage
|
||||||
command: name: "ls"
|
command: name: "ls"
|
||||||
export: files: {
|
export: files: {
|
||||||
"/dagger.txt": _ & {
|
"/dagger.txt": _ & {
|
||||||
@ -78,13 +78,13 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
verify_cmd_is_run: docker.#Run & {
|
verify_cmd_is_run: docker.#Run & {
|
||||||
image: myimage
|
input: myimage
|
||||||
export: files: "/dagger.txt": _ & {
|
export: files: "/dagger.txt": _ & {
|
||||||
contents: "hello from dagger"
|
contents: "hello from dagger"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
verify_env_is_overridden: docker.#Run & {
|
verify_env_is_overridden: docker.#Run & {
|
||||||
image: myimage
|
input: myimage
|
||||||
export: files: "/dagger.txt": _ & {
|
export: files: "/dagger.txt": _ & {
|
||||||
contents: "hello from europa"
|
contents: "hello from europa"
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
verify_working_directory: docker.#Run & {
|
verify_working_directory: docker.#Run & {
|
||||||
image: myimage
|
input: myimage
|
||||||
command: {
|
command: {
|
||||||
name: "sh"
|
name: "sh"
|
||||||
flags: "-c": #"""
|
flags: "-c": #"""
|
||||||
@ -104,7 +104,7 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
verify_working_directory_is_overridden: docker.#Run & {
|
verify_working_directory_is_overridden: docker.#Run & {
|
||||||
image: myimage
|
input: myimage
|
||||||
workdir: "/"
|
workdir: "/"
|
||||||
command: {
|
command: {
|
||||||
name: "sh"
|
name: "sh"
|
||||||
|
@ -18,7 +18,7 @@ dagger.#Plan & {
|
|||||||
image: alpine.#Build
|
image: alpine.#Build
|
||||||
|
|
||||||
run: docker.#Run & {
|
run: docker.#Run & {
|
||||||
image: _image
|
input: _image
|
||||||
command: {
|
command: {
|
||||||
name: "/bin/sh"
|
name: "/bin/sh"
|
||||||
args: ["-c", "echo -n hello world >> /output.txt"]
|
args: ["-c", "echo -n hello world >> /output.txt"]
|
||||||
@ -50,7 +50,7 @@ dagger.#Plan & {
|
|||||||
// Test: export a directory
|
// Test: export a directory
|
||||||
exportDirectory: {
|
exportDirectory: {
|
||||||
run: docker.#Run & {
|
run: docker.#Run & {
|
||||||
image: _image
|
input: _image
|
||||||
command: {
|
command: {
|
||||||
name: "sh"
|
name: "sh"
|
||||||
flags: "-c": #"""
|
flags: "-c": #"""
|
||||||
|
@ -59,6 +59,7 @@ import (
|
|||||||
|
|
||||||
// Run the netlify client in a container
|
// Run the netlify client in a container
|
||||||
container: bash.#Run & {
|
container: bash.#Run & {
|
||||||
|
input: _build.output
|
||||||
script: {
|
script: {
|
||||||
_load: engine.#Source & {
|
_load: engine.#Source & {
|
||||||
path: "."
|
path: "."
|
||||||
@ -68,8 +69,6 @@ import (
|
|||||||
filename: "deploy.sh"
|
filename: "deploy.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
image: _build.output
|
|
||||||
|
|
||||||
always: true
|
always: true
|
||||||
env: {
|
env: {
|
||||||
NETLIFY_SITE_NAME: site
|
NETLIFY_SITE_NAME: site
|
||||||
|
@ -59,7 +59,7 @@ import (
|
|||||||
|
|
||||||
// Run yarn in a docker container
|
// Run yarn in a docker container
|
||||||
container: bash.#Run & {
|
container: bash.#Run & {
|
||||||
image: _buildImage.output
|
input: _buildImage.output
|
||||||
|
|
||||||
// FIXME: move shell script to its own file
|
// FIXME: move shell script to its own file
|
||||||
script: contents: #"""
|
script: contents: #"""
|
||||||
|
Reference in New Issue
Block a user