Merge pull request #1156 from gerhard/add-docker-host-support
Add support for tcp:// DOCKER_HOST
This commit is contained in:
commit
764ef2761c
@ -30,6 +30,10 @@ import (
|
|||||||
keyPassphrase?: dagger.#Secret @dagger(input)
|
keyPassphrase?: dagger.#Secret @dagger(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Connect via DOCKER_HOST, supports tcp://
|
||||||
|
// TODO: Consider refactoring to support ssh:// & even file://
|
||||||
|
host?: string @dagger(input)
|
||||||
|
|
||||||
// Command to execute
|
// Command to execute
|
||||||
command: string
|
command: string
|
||||||
|
|
||||||
@ -203,6 +207,9 @@ import (
|
|||||||
FINGERPRINT: ssh.fingerprint
|
FINGERPRINT: ssh.fingerprint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if host != _|_ && ssh == _|_ {
|
||||||
|
DOCKER_HOST: host
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"mount": {
|
"mount": {
|
||||||
if ssh != _|_ {
|
if ssh != _|_ {
|
||||||
|
@ -124,6 +124,10 @@ import (
|
|||||||
keyPassphrase?: dagger.#Input & {dagger.#Secret}
|
keyPassphrase?: dagger.#Input & {dagger.#Secret}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Connect via DOCKER_HOST, supports tcp://
|
||||||
|
// TODO: Consider refactoring to support ssh:// & even file://
|
||||||
|
host?: string @dagger(input)
|
||||||
|
|
||||||
// Mount local docker socket
|
// Mount local docker socket
|
||||||
socket?: dagger.#Stream & dagger.#Input
|
socket?: dagger.#Stream & dagger.#Input
|
||||||
|
|
||||||
@ -146,6 +150,9 @@ import (
|
|||||||
if ssh != _|_ {
|
if ssh != _|_ {
|
||||||
"ssh": ssh
|
"ssh": ssh
|
||||||
}
|
}
|
||||||
|
if host != _|_ && ssh == _|_ {
|
||||||
|
"host": host
|
||||||
|
}
|
||||||
if socket != _|_ {
|
if socket != _|_ {
|
||||||
"socket": socket
|
"socket": socket
|
||||||
}
|
}
|
||||||
@ -194,6 +201,10 @@ import (
|
|||||||
keyPassphrase?: dagger.#Input & {dagger.#Secret}
|
keyPassphrase?: dagger.#Input & {dagger.#Secret}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Connect via DOCKER_HOST, supports tcp://
|
||||||
|
// TODO: Consider refactoring to support ssh:// & even file://
|
||||||
|
host?: string @dagger(input)
|
||||||
|
|
||||||
// Mount local docker socket
|
// Mount local docker socket
|
||||||
socket?: dagger.#Stream & dagger.#Input
|
socket?: dagger.#Stream & dagger.#Input
|
||||||
|
|
||||||
@ -246,6 +257,9 @@ import (
|
|||||||
if ssh != _|_ {
|
if ssh != _|_ {
|
||||||
"ssh": ssh
|
"ssh": ssh
|
||||||
}
|
}
|
||||||
|
if host != _|_ && ssh == _|_ {
|
||||||
|
"host": host
|
||||||
|
}
|
||||||
if socket != _|_ {
|
if socket != _|_ {
|
||||||
"socket": socket
|
"socket": socket
|
||||||
}
|
}
|
||||||
|
13
stdlib/docker/tests/command-host/command.cue
Normal file
13
stdlib/docker/tests/command-host/command.cue
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package docker
|
||||||
|
|
||||||
|
TestConfig: {
|
||||||
|
host: string @dagger(input)
|
||||||
|
}
|
||||||
|
|
||||||
|
TestHost: client: #Command & {
|
||||||
|
command: #"""
|
||||||
|
docker $CMD
|
||||||
|
"""#
|
||||||
|
host: TestConfig.host
|
||||||
|
env: CMD: "version"
|
||||||
|
}
|
21
stdlib/docker/tests/run-host/simple.cue
Normal file
21
stdlib/docker/tests/run-host/simple.cue
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package docker
|
||||||
|
|
||||||
|
import (
|
||||||
|
"alpha.dagger.io/random"
|
||||||
|
)
|
||||||
|
|
||||||
|
TestConfig: {
|
||||||
|
host: string @dagger(input)
|
||||||
|
}
|
||||||
|
|
||||||
|
TestHost: {
|
||||||
|
suffix: random.#String & {
|
||||||
|
seed: "docker-tcp-test"
|
||||||
|
}
|
||||||
|
|
||||||
|
run: #Run & {
|
||||||
|
name: "daggerci-test-tcp-\(suffix.out)"
|
||||||
|
ref: "hello-world"
|
||||||
|
host: TestConfig.host
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user