Files
prestashop-test/.woodpecker.yml
syoul 3adeebc4aa
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
debug: test 1 statique + 2 from_secret
2026-03-17 18:51:17 +01:00

97 lines
3.0 KiB
YAML

when:
- branch: main
event: push
steps:
# Etape 1 : Validation syntaxique du docker-compose.yml
- name: validate
image: docker:27-cli
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
PS_DOMAIN: presta.syoul.fr
PS_ADMIN_FOLDER: admin-secure
DB_PASSWORD: placeholder
DB_ROOT_PASSWORD: placeholder
PRESTASHOP_ADMIN_EMAIL: placeholder
PRESTASHOP_ADMIN_PASSWORD: placeholder
commands:
- docker compose config --quiet
- echo "docker-compose.yml valide"
# Etape 2 : Verifications de securite
- name: security-check
image: alpine:3.20
commands:
- |
if [ -f .env ]; then
echo "ERREUR: .env ne doit pas etre commite dans le depot !"
exit 1
fi
- 'grep -q "^\.env$" .gitignore || (echo "ERREUR: .env manquant dans .gitignore" && exit 1)'
- echo "Verifications de securite OK"
# Debug regression : reproduire exactement pipeline 26
- name: debug-regression
image: alpine:3.20
environment:
TEST_STATIC: hello-world
PS_DOMAIN:
from_secret: ps_domain
PS_ADMIN_FOLDER:
from_secret: ps_admin_folder
commands:
- env | grep -E "TEST_STATIC|PS_DOMAIN|PS_ADMIN"
# Etape 3b : Deploiement sur sonic via Docker socket (sans secrets)
- name: deploy
image: docker:27-cli
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /opt/prestashop:/opt/prestashop
commands:
- cp .env.deploy /opt/prestashop/.env
- chmod 600 /opt/prestashop/.env
- cp docker-compose.yml /opt/prestashop/docker-compose.yml
- cd /opt/prestashop && docker compose pull
- cd /opt/prestashop && docker compose up -d --remove-orphans
- cd /opt/prestashop && docker compose ps
# Etape 4 : Healthcheck post-deploiement
- name: healthcheck
image: alpine:3.20
commands:
- apk add --no-cache --quiet curl
- |
PS_DOMAIN=$(grep '^PS_DOMAIN=' .env.deploy | cut -d= -f2)
if [ -z "${PS_DOMAIN}" ]; then
echo "ERREUR: PS_DOMAIN non defini dans .env.deploy"
exit 1
fi
TARGET="http://${PS_DOMAIN}"
echo "Healthcheck sur ${TARGET} (max 10 minutes)..."
MAX=60
i=0
until [ $i -ge $MAX ]; do
HTTP_CODE=$(curl -sSo /dev/null -w "%{http_code}" "${TARGET}" 2>/dev/null)
echo "Tentative $((i+1))/${MAX} - HTTP ${HTTP_CODE}"
if [ "${HTTP_CODE}" = "200" ] || [ "${HTTP_CODE}" = "301" ] || [ "${HTTP_CODE}" = "302" ]; then
echo "PrestaShop repond correctement sur ${TARGET}"
exit 0
fi
i=$((i+1))
sleep 10
done
echo "ERREUR: PrestaShop ne repond pas apres 10 minutes"
exit 1
# Notification en cas d'echec
- name: notify-failure
image: alpine:3.20
commands:
- 'echo "ECHEC pipeline #${CI_BUILD_NUMBER} sur commit ${CI_COMMIT_SHA}"'
- 'echo "Branche: ${CI_COMMIT_BRANCH}"'
when:
- status: failure