diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8507697..0a76755 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,15 +21,17 @@ deploy_to_portainer: STACK_CREATE=$(curl -s -X POST "$PORTAINER_URL/stacks?type=1&method=string&endpointId=$ENDPOINT_ID" \ -H "Authorization: Bearer $PORTAINER_TOKEN" \ -H "Content-Type: application/json" \ - -d "{\"Name\": \"$STACK_NAME\", \"StackFileContent\": \"$(cat docker-compose.yml | sed 's/"/\\"/g' | sed 's/$/\\n/' | tr -d '\n')\", \"Prune\": false}") + -d "{\"Name\": \"$STACK_NAME\", \"StackFileContent\": \"$(cat docker-compose.yml | sed 's/\"/\\\"/g' | sed 's/$/\\n/' | tr -d '\n')\", \"Prune\": false}") echo "Réponse de création : $STACK_CREATE" else echo "La stack existe, mise à jour en cours" STACK_UPDATE=$(curl -s -X PUT "$PORTAINER_URL/stacks/$STACK_ID?endpointId=$ENDPOINT_ID" \ -H "Authorization: Bearer $PORTAINER_TOKEN" \ -H "Content-Type: application/json" \ - -d "{\"StackFileContent\": \"$(cat docker-compose.yml | sed 's/"/\\"/g' | sed 's/$/\\n/' | tr -d '\n')\", \"Prune\": false, \"PullImage\": true}") + -d "{\"StackFileContent\": \"$(cat docker-compose.yml | sed 's/\"/\\\"/g' | sed 's/$/\\n/' | tr -d '\n')\", \"Prune\": false, \"PullImage\": true}") echo "Réponse de mise à jour : $STACK_UPDATE" fi only: - main + tags: + - docker