socket -> stream

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-09-17 15:17:28 -07:00
parent 408f147fab
commit 0f4a55a482
5 changed files with 17 additions and 17 deletions

View File

@ -22,14 +22,14 @@ _No input._
_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._
### dagger.#Socket Outputs
### dagger.#Stream Outputs
_No output._

View File

@ -506,15 +506,15 @@ func (p *Pipeline) mount(ctx context.Context, dest string, mnt *compiler.Value)
), nil
}
// eg. mount: "/var/run/docker.sock": socket: mysocket
if socket := mnt.Lookup("socket"); socket.Exists() {
if !socket.HasAttr("socket") {
return nil, fmt.Errorf("invalid socket %q: not a socket", socket.Path().String())
// eg. mount: "/var/run/docker.sock": stream: mystream
if stream := mnt.Lookup("stream"); stream.Exists() {
if !stream.HasAttr("stream") {
return nil, fmt.Errorf("invalid stream %q: not a stream", stream.Path().String())
}
unixValue := socket.Lookup("unix")
unixValue := stream.Lookup("unix")
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()

View File

@ -14,9 +14,9 @@ import (
...
}
// Dagger socket. Can be mounted as a UNIX socket.
#Socket: {
@dagger(socket)
// Dagger stream. Can be mounted as a UNIX socket.
#Stream: {
@dagger(stream)
unix: string
}

View File

@ -148,10 +148,10 @@ setup() {
assert_output --partial "secret=mySecret;hash="
}
@test "core: socket" {
@test "core: stream" {
dagger init
dagger_new_with_plan test-socket "$TESTDIR"/core/socket
dagger_new_with_plan test-stream "$TESTDIR"/core/stream
# Set dir input
"$DAGGER" input socket dockersocket /var/run/docker.sock

View File

@ -6,7 +6,7 @@ import (
"alpha.dagger.io/alpine"
)
dockersocket: dagger.#Socket & dagger.#Input
dockersocket: dagger.#Stream & dagger.#Input
TestDockerSocket: #up: [
op.#Load & {
@ -17,7 +17,7 @@ TestDockerSocket: #up: [
op.#Exec & {
always: true
mount: "/var/run/docker.sock": socket: dockersocket
mount: "/var/run/docker.sock": stream: dockersocket
args: ["docker", "info"]
},
]