Commit 3524c195 authored by Martin Vala's avatar Martin Vala
Browse files

Merge branch '39-docker-pull-before-eos-docker-stop' into 'master'

Resolve "Docker pull before eos-docker stop"

Closes #39

See merge request !20
parents c38aa946 fee2ad2f
Pipeline #338060 passed with stage
in 7 minutes and 25 seconds
Name: eos-docker-utils Name: eos-docker-utils
Version: 1.0.1 Version: 1.0.2
Release: 0%{?dist} Release: 0%{?dist}
Summary: EOS docker utils Summary: EOS docker utils
License: LGPL v3+ License: LGPL v3+
......
...@@ -89,6 +89,9 @@ cat > $ED_ROOT_DIR/$ED_CONFIG_FILE.simple << EOF ...@@ -89,6 +89,9 @@ cat > $ED_ROOT_DIR/$ED_CONFIG_FILE.simple << EOF
#!/bin/bash #!/bin/bash
# EOS docker generated config $(date) # EOS docker generated config $(date)
# EOS DOCKER version
export ED_DOCKER_IMAGE_NAME_VERSION="$ED_DOCKER_IMAGE_NAME_VERSION"
# EOS # EOS
export ED_EOS_INSTANCE_NAME="test" export ED_EOS_INSTANCE_NAME="test"
...@@ -107,6 +110,9 @@ cat > $ED_ROOT_DIR/$ED_CONFIG_FILE.alice << EOF ...@@ -107,6 +110,9 @@ cat > $ED_ROOT_DIR/$ED_CONFIG_FILE.alice << EOF
#!/bin/bash #!/bin/bash
# EOS docker for ALICE generated config $(date) # EOS docker for ALICE generated config $(date)
# EOS DOCKER version
export ED_DOCKER_IMAGE_NAME_VERSION="$ED_DOCKER_IMAGE_NAME_VERSION"
# EOS # EOS
export ED_EOS_INSTANCE_NAME="alice.test" export ED_EOS_INSTANCE_NAME="alice.test"
...@@ -215,6 +221,25 @@ function eosDockerRun() { ...@@ -215,6 +221,25 @@ function eosDockerRun() {
fi fi
} }
function eosDockerPull() {
for t in $*;do
DEBUG "Pulling $t ..."
if [ "$t" == "mgm" -o "$t" == "_single" ];then
INFO "Pulling docker '$ED_DOCKER_PREFIX/$ED_DOCKER_IMAGE_NAME_VERSION' ..."
$ED_DOCKER_CMD pull $ED_DOCKER_PREFIX/$ED_DOCKER_IMAGE_NAME_VERSION
elif [ "$t" == "fsts" ];then
[[ $ED_NODE_TYPE == mgm* ]] && [ -f $ED_ROOT_DIR/$ED_FST_HOSTS ] && eos-docker-ssh pull
elif [ "$t" == "host" ];then
[[ $ED_NODE_TYPE == mgm* ]] && eos-docker-ssh pull $ED_HOSTS_HOST
fi
done
return 0
}
function eosDockerStart() { function eosDockerStart() {
for t in $*;do for t in $*;do
...@@ -289,13 +314,16 @@ function eosDockerUpdate() { ...@@ -289,13 +314,16 @@ function eosDockerUpdate() {
for t in $*;do for t in $*;do
DEBUG "Updating $t ..." DEBUG "Updating $t ..."
if [ "$t" == "mgm" -o "$t" == "_single" ];then if [ "$t" == "mgm" -o "$t" == "_single" ];then
eosDockerPull $t
eosDockerClean $t eosDockerClean $t
eosDockerCleanDocker eosDockerCleanDocker
eosDockerStart $t eosDockerStart $t
elif [ "$t" == "fsts" ];then elif [ "$t" == "fsts" ];then
eosDockerPull $t
eosDockerClean $t eosDockerClean $t
eosDockerStart $t eosDockerStart $t
elif [ "$t" == "host" ];then elif [ "$t" == "host" ];then
eosDockerPull $t
eosDockerClean $t eosDockerClean $t
eosDockerStart $t eosDockerStart $t
fi fi
...@@ -383,7 +411,11 @@ function eosDockerFirewallPrint() { ...@@ -383,7 +411,11 @@ function eosDockerFirewallPrint() {
function eosDockerCleanDocker() { function eosDockerCleanDocker() {
$ED_DOCKER_CMD stop $($ED_DOCKER_CMD ps --format "{{.Names}}" | grep eos-)> /dev/null 2>&1 $ED_DOCKER_CMD stop $($ED_DOCKER_CMD ps --format "{{.Names}}" | grep eos-)> /dev/null 2>&1
$ED_DOCKER_CMD rm $($ED_DOCKER_CMD ps --format "{{.Names}}" | grep eos-)> /dev/null 2>&1 $ED_DOCKER_CMD rm $($ED_DOCKER_CMD ps --format "{{.Names}}" | grep eos-)> /dev/null 2>&1
$ED_DOCKER_CMD rmi -f $($ED_DOCKER_CMD images --format "{{.ID}}" --filter=reference=$ED_DOCKER_PREFIX/$ED_DOCKER_IMAGE_NAME_VERSION) > /dev/null 2>&1 for d in $($ED_DOCKER_CMD images --format "{{.ID}}_{{.Repository}}:{{.Tag}}" --filter=reference=$ED_DOCKER_PREFIX/$(echo $ED_DOCKER_IMAGE_NAME_VERSION | cut -d ':' -f1) | grep -v $ED_DOCKER_PREFIX/$ED_DOCKER_IMAGE_NAME_VERSION); do
INFO "Removing image '$d' ..."
img=$(echo "$d" | cut -d '_' -f1)
$ED_DOCKER_CMD rmi -f $img > /dev/null 2>&1
done
} }
function eosDockerEnter() { function eosDockerEnter() {
...@@ -592,6 +624,7 @@ else ...@@ -592,6 +624,7 @@ else
exit 1 exit 1
fi fi
export ED_TYPE=$(readlink -f $ED_ROOT_DIR/$ED_CONFIG_FILE | cut -d. -f3) export ED_TYPE=$(readlink -f $ED_ROOT_DIR/$ED_CONFIG_FILE | cut -d. -f3)
[ -z $ED_MONITORING ] && export ED_MONITORING=0 [ -z $ED_MONITORING ] && export ED_MONITORING=0
...@@ -633,6 +666,9 @@ case "$1" in ...@@ -633,6 +666,9 @@ case "$1" in
INFO "Init of EOS docker '$ED_TYPE' done ..." INFO "Init of EOS docker '$ED_TYPE' done ..."
exit $? exit $?
;; ;;
pull)
eosDockerPull $ED_HOSTS_TYPES
;;
start) start)
eosDockerStart $ED_HOSTS_TYPES eosDockerStart $ED_HOSTS_TYPES
;; ;;
......
...@@ -49,6 +49,11 @@ function eosDockerSSHSetHosts() { ...@@ -49,6 +49,11 @@ function eosDockerSSHSetHosts() {
fi fi
} }
function eosDockerSSHStart() {
$ED_PSSH_CMD $ED_ROOT_DIR/bin/eos-docker pull _single
}
function eosDockerSSHStart() { function eosDockerSSHStart() {
$ED_PSSH_CMD $ED_ROOT_DIR/bin/eos-docker start _single $ED_PSSH_CMD $ED_ROOT_DIR/bin/eos-docker start _single
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment