Skip instead of remove existing secrets
continuous-integration/drone/push Build is failing Details

This commit is contained in:
3wc 2020-09-25 20:47:13 +02:00
parent fc822929e3
commit 4c5c73ec15
1 changed files with 5 additions and 4 deletions

View File

@ -21,10 +21,11 @@ generate_secrets() {
export DOCKER_HOST="ssh://$PLUGIN_USER@$PLUGIN_HOST:$PLUGIN_PORT" export DOCKER_HOST="ssh://$PLUGIN_USER@$PLUGIN_HOST:$PLUGIN_PORT"
for SECRET in $(yq r "$PLUGIN_COMPOSE" 'secrets.*.name'); do for SECRET in $(yq r "$PLUGIN_COMPOSE" 'secrets.*.name'); do
eval "docker secret rm \"$SECRET\" - || true"; if ! docker secret ls | grep $SECRET; then
eval "echo \"generating $SECRET\"" eval "echo \"generating $SECRET\""
PW=$(</dev/urandom tr -dc 'A-Za-z0-9' | head -c 40; echo) PW=$(</dev/urandom tr -dc 'A-Za-z0-9' | head -c 40; echo)
eval "echo \"$PW\" | docker secret create \"$SECRET\" -"; eval "echo \"$PW\" | docker secret create \"$SECRET\" -";
fi
done done
echo "--- end secrets ---" echo "--- end secrets ---"
} }