feat: try fix ci/cd
This commit is contained in:
parent
95ebc2b95d
commit
6a5498a7a3
|
|
@ -92,16 +92,14 @@ deploy-to-portainer:
|
||||||
|
|
||||||
STACKS_JSON="$BODY"
|
STACKS_JSON="$BODY"
|
||||||
STACK_ID=$(echo "$STACKS_JSON" | jq ".[] | select(.Name == \"$PORTAINER_STACK_NAME\") | .Id")
|
STACK_ID=$(echo "$STACKS_JSON" | jq ".[] | select(.Name == \"$PORTAINER_STACK_NAME\") | .Id")
|
||||||
|
STACK_FILE_PATH="docker-compose.rendered.yml"
|
||||||
# Contenu du compose rendu (une seule ligne, guillemets échappés)
|
|
||||||
STACK_FILE_CONTENT=$(sed 's/"/\\"/g' docker-compose.rendered.yml | tr -d '\n')
|
|
||||||
|
|
||||||
if [ -z "$STACK_ID" ]; then
|
if [ -z "$STACK_ID" ]; then
|
||||||
echo "🆕 Aucune stack '$PORTAINER_STACK_NAME' trouvée, création en cours..."
|
echo "🆕 Aucune stack '$PORTAINER_STACK_NAME' trouvée, création en cours..."
|
||||||
|
|
||||||
JSON_PAYLOAD=$(jq -n \
|
JSON_PAYLOAD=$(jq -n \
|
||||||
--arg name "$PORTAINER_STACK_NAME" \
|
--arg name "$PORTAINER_STACK_NAME" \
|
||||||
--arg content "$STACK_FILE_CONTENT" \
|
--rawfile content "$STACK_FILE_PATH" \
|
||||||
'{name: $name, stackFileContent: $content, prune: true}')
|
'{name: $name, stackFileContent: $content, prune: true}')
|
||||||
|
|
||||||
CREATE_RESP=$(curl -s -w "HTTPSTATUS:%{http_code}" \
|
CREATE_RESP=$(curl -s -w "HTTPSTATUS:%{http_code}" \
|
||||||
|
|
@ -127,7 +125,7 @@ deploy-to-portainer:
|
||||||
|
|
||||||
JSON_PAYLOAD=$(jq -n \
|
JSON_PAYLOAD=$(jq -n \
|
||||||
--arg id "$STACK_ID" \
|
--arg id "$STACK_ID" \
|
||||||
--arg content "$STACK_FILE_CONTENT" \
|
--rawfile content "$STACK_FILE_PATH" \
|
||||||
'{id: ($id|tonumber), stackFileContent: $content, prune: true}')
|
'{id: ($id|tonumber), stackFileContent: $content, prune: true}')
|
||||||
|
|
||||||
UPDATE_RESP=$(curl -s -w "HTTPSTATUS:%{http_code}" \
|
UPDATE_RESP=$(curl -s -w "HTTPSTATUS:%{http_code}" \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue