Files
test-cicd/.woodpecker/deploy-pipeline.yml
spassignat 95222843e6
Some checks failed
ci/woodpecker/push/build-pipeline Pipeline was successful
ci/woodpecker/deployment/deploy-pipeline Pipeline failed
patch: pipeline minio
2026-05-04 19:40:20 +02:00

95 lines
3.1 KiB
YAML
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Documentation: https://woodpecker-ci.org/docs/usage/workflow-syntax
when:
- event: [ deployment,manual ]
variables:
minio_mc: &minio_mc minio/mc
appleboy_drone_scp: &appleboy_drone_scp appleboy/drone-scp
appleboy_drone_ssh: &appleboy_drone_ssh appleboy/drone-ssh
curlimages_curl: &curlimages_curl curlimages/curl:latest
nexus_url: &nexus_url http://nexus.cicd.exygen.fr/repository/domaine-passignat/apps
steps:
- name: get-share-data
image: *minio_mc
commands:
- echo " Load pipeline info"
- mc alias set local http://minio:9000 minioadmin minioadmin123
- mc get local/cicd/repository_$CI_REPO_REMOTE_ID/pipeline_$CI_PIPELINE_PARENT .buildinfo
- ls -als
- name: get-artifact
image: *curlimages_curl
environment:
NEXUS_USERNAME:
from_secret: nexus_username
NEXUS_PASSWORD:
from_secret: nexus_password
NEXUS_REPOSITORY: domaine-passignat
NEXUS_URL: *nexus_url
commands:
- ls -als
- source .buildinfo
- env
- echo $NEW_VERSION
- echo ${NEW_VERSION}
- echo $NEXUS_URL
- echo ${NEXUS_URL}
- echo ${CI_REPO_NAME}
- curl -o /tmp/${CI_REPO_NAME}-${NEW_VERSION}.tar "$NEXUS_URL/${CI_REPO_NAME}/${NEW_VERSION}/${CI_REPO_NAME}-${NEW_VERSION}.tar"
depends_on: [ get-share-data ]
# Étape 7: Transfert vers le serveur distant (SCP)
- name: transfert
image: *appleboy_drone_scp
settings:
host:
from_secret: remote_host
username:
from_secret: remote_user
password:
from_secret: remote_password
port: 22
source: /tmp/${CI_REPO_NAME}-${NEW_VERSION}.tar
target: /tmp/
depends_on: [ get-artifact ]
# Étape 8: Déploiement sur le serveur distant
- name: deploy
image: *appleboy_drone_ssh
environment:
SUDO_PASSWORD:
from_secret: remote_password
settings:
host:
from_secret: remote_host
username:
from_secret: remote_user
password:
from_secret: remote_password
port: 22
envs:
- SUDO_PASSWORD
script:
- source .buildinfo
- echo "$${SUDO_PASSWORD}" | sudo -S systemctl stop gestion
- mkdir -p /srv/volumes/gestion/{front-binaries,back-binaries,tmpdb}
- rm -rf /srv/volumes/gestion/front-binaries/*
- rm -rf /srv/volumes/gestion/back-binaries/*
- rm -rf /srv/volumes/gestion/tmpdb/*
- tar -xvf /tmp/${CI_REPO_NAME}-${NEW_VERSION}.tar -C /tmp
- tar -xvf /tmp/front.tar.gz -C /srv/volumes/gestion/front-binaries
- tar -xzvf /tmp/back.tar.gz -C /srv/volumes/gestion/back-binaries
- tar -xzvf /tmp/db.tar.gz -C /srv/volumes/gestion/tmpdb
- rm -f /tmp/front.tar.gz
- rm -f /tmp/back.tar.gz
- rm -f /tmp/db.tar.gz
- rm -f /tmp/${CI_REPO_NAME}-${NEW_VERSION}.tar
- docker-compose up database
- cd /srv/volumes/gestion/tmpdb
- npm ci --cache .npm --prefer-offline
- npm run install-db
- echo "$${SUDO_PASSWORD}" | sudo -S systemctl start gestion
depends_on: [ transfert ]