From 9f9d4bafe973da7aab6566d24c20d5c199810692 Mon Sep 17 00:00:00 2001 From: 3wc <3wc.git@doesthisthing.work> Date: Sun, 27 Sep 2020 21:51:20 +0200 Subject: [PATCH] Wait for newly-created networks before continuing --- plugin.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin.sh b/plugin.sh index 1b5799b..6c39f32 100755 --- a/plugin.sh +++ b/plugin.sh @@ -14,8 +14,10 @@ create_networks() { echo "--- start create_networks ---" IFS=',' read -ra NETWORKS <<< "$PLUGIN_NETWORKS" for NETWORK in "${NETWORKS[@]}"; do + echo "$NETWORK" docker -H "$REMOTE_DOCKER_HOST" \ network create --driver=overlay "$NETWORK" --scope swarm || true + until [ -n "$(docker -H "$REMOTE_DOCKER_HOST" network ls -f "name=$NETWORK" -q)" ]; do sleep 1; done done echo "--- end create_networks ---" } @@ -88,7 +90,6 @@ run_plugin() { load_deploy_key output_versions - echo "$PLUGIN_NETWORKS" if [ -n "$PLUGIN_NETWORKS" ]; then create_networks fi