socket -> stream
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
408f147fab
commit
0f4a55a482
@ -22,14 +22,14 @@ _No input._
|
|||||||
|
|
||||||
_No output._
|
_No output._
|
||||||
|
|
||||||
## dagger.#Socket
|
## dagger.#Stream
|
||||||
|
|
||||||
Dagger socket. Can be mounted as a UNIX socket.
|
Dagger stream. Can be mounted as a UNIX socket.
|
||||||
|
|
||||||
### dagger.#Socket Inputs
|
### dagger.#Stream Inputs
|
||||||
|
|
||||||
_No input._
|
_No input._
|
||||||
|
|
||||||
### dagger.#Socket Outputs
|
### dagger.#Stream Outputs
|
||||||
|
|
||||||
_No output._
|
_No output._
|
||||||
|
@ -506,15 +506,15 @@ func (p *Pipeline) mount(ctx context.Context, dest string, mnt *compiler.Value)
|
|||||||
), nil
|
), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// eg. mount: "/var/run/docker.sock": socket: mysocket
|
// eg. mount: "/var/run/docker.sock": stream: mystream
|
||||||
if socket := mnt.Lookup("socket"); socket.Exists() {
|
if stream := mnt.Lookup("stream"); stream.Exists() {
|
||||||
if !socket.HasAttr("socket") {
|
if !stream.HasAttr("stream") {
|
||||||
return nil, fmt.Errorf("invalid socket %q: not a socket", socket.Path().String())
|
return nil, fmt.Errorf("invalid stream %q: not a stream", stream.Path().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
unixValue := socket.Lookup("unix")
|
unixValue := stream.Lookup("unix")
|
||||||
if !unixValue.Exists() {
|
if !unixValue.Exists() {
|
||||||
return nil, fmt.Errorf("invalid socket %q: not a unix socket", socket.Path().String())
|
return nil, fmt.Errorf("invalid stream %q: not a unix socket", stream.Path().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
unix, err := unixValue.String()
|
unix, err := unixValue.String()
|
||||||
|
@ -14,9 +14,9 @@ import (
|
|||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dagger socket. Can be mounted as a UNIX socket.
|
// Dagger stream. Can be mounted as a UNIX socket.
|
||||||
#Socket: {
|
#Stream: {
|
||||||
@dagger(socket)
|
@dagger(stream)
|
||||||
|
|
||||||
unix: string
|
unix: string
|
||||||
}
|
}
|
||||||
|
@ -148,10 +148,10 @@ setup() {
|
|||||||
assert_output --partial "secret=mySecret;hash="
|
assert_output --partial "secret=mySecret;hash="
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "core: socket" {
|
@test "core: stream" {
|
||||||
dagger init
|
dagger init
|
||||||
|
|
||||||
dagger_new_with_plan test-socket "$TESTDIR"/core/socket
|
dagger_new_with_plan test-stream "$TESTDIR"/core/stream
|
||||||
|
|
||||||
# Set dir input
|
# Set dir input
|
||||||
"$DAGGER" input socket dockersocket /var/run/docker.sock
|
"$DAGGER" input socket dockersocket /var/run/docker.sock
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"alpha.dagger.io/alpine"
|
"alpha.dagger.io/alpine"
|
||||||
)
|
)
|
||||||
|
|
||||||
dockersocket: dagger.#Socket & dagger.#Input
|
dockersocket: dagger.#Stream & dagger.#Input
|
||||||
|
|
||||||
TestDockerSocket: #up: [
|
TestDockerSocket: #up: [
|
||||||
op.#Load & {
|
op.#Load & {
|
||||||
@ -17,7 +17,7 @@ TestDockerSocket: #up: [
|
|||||||
|
|
||||||
op.#Exec & {
|
op.#Exec & {
|
||||||
always: true
|
always: true
|
||||||
mount: "/var/run/docker.sock": socket: dockersocket
|
mount: "/var/run/docker.sock": stream: dockersocket
|
||||||
args: ["docker", "info"]
|
args: ["docker", "info"]
|
||||||
},
|
},
|
||||||
]
|
]
|
Reference in New Issue
Block a user