Fix network error on docker-compose

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau
2021-06-06 17:51:28 +02:00
parent b6c8ef34b0
commit f2d8cb39bd
13 changed files with 79 additions and 36 deletions

View File

@@ -33,12 +33,14 @@ import (
#code: #"""
# Export host
export DOCKER_HOST="ssh://$DOCKER_USERNAME@$DOCKER_HOSTNAME:$DOCKER_PORT"
export DOCKER_HOST="unix://$(pwd)/docker.sock"
# Start ssh agent
eval $(ssh-agent) > /dev/null
ssh-add /key > /dev/null
ssh -i /key -o "StreamLocalBindUnlink=yes" -fNT -L "$(pwd)"/docker.sock:/var/run/docker.sock -p "$DOCKER_PORT" "$DOCKER_USERNAME"@"$DOCKER_HOSTNAME" || true
# Down
cd /context
docker-compose down -v
@@ -66,11 +68,18 @@ import (
DOCKER_HOSTNAME: ssh.host
DOCKER_USERNAME: ssh.user
DOCKER_PORT: strconv.FormatInt(ssh.port, 10)
if ssh.keyPassphrase != _|_ {
SSH_ASKPASS: "/get_passphrase"
DISPLAY: "1"
}
}
mount: {
if ssh.key != _|_ {
"/key": secret: ssh.key
}
if ssh.keyPassphrase != _|_ {
"/passphrase": secret: ssh.keyPassphrase
}
}
},
]

View File

@@ -21,13 +21,13 @@ TestCompose: {
"""#
}
verify: #VerifyCompose & {
ssh: up.ssh
port: 8080
}
//verify: #VerifyCompose & {
// ssh: up.ssh
// port: 8080
//}
cleanup: #CleanupCompose & {
context: up
ssh: verify.ssh
ssh: up.ssh
}
}

View File

@@ -55,8 +55,9 @@ import (
# Add host to known hosts
ssh -i /key -o "UserKnownHostsFile "$HOME"/.ssh/known_hosts" -o "StrictHostKeyChecking accept-new" -p "$REMOTE_PORT" "$REMOTE_USERNAME"@"$REMOTE_HOSTNAME" /bin/true > /dev/null 2>&1
fi
ssh -i /key -p "$REMOTE_PORT" "$REMOTE_USERNAME"@"$REMOTE_HOSTNAME" curl localhost:"$CONTAINER_PORT"
sleep 2 ; ssh -i /key -p "$REMOTE_PORT" "$REMOTE_USERNAME"@"$REMOTE_HOSTNAME" curl -L localhost:"$CONTAINER_PORT"
"""#
#up: [