Files
sgl/Jenkinsfile
Soriba SYLLA 165894c92b
Some checks failed
Organisation/sgl/pipeline/head There was a failure building this commit
Fix: Nom des produits doivent être unique
2026-09-18 09:31:46 +00:00

51 lines
1.3 KiB
Groovy

pipeline
{
agent any
options {
skipDefaultCheckout(true)
}
environment
{
SUDO_PASSWORD = credentials('sudo-password')
}
stages
{
stage ( 'checkout' )
{
steps
{
sh 'echo "Debut du pipeline"'
cleanWs()
checkout scm
}
}
stage ( 'Deploiement' )
{
when { branch 'main' }
steps {
sh '''
cd /var/www/sgl
echo $SUDO_PASSWORD | sudo -S chown -R jenkins:jenkins /var/www/sgl
git fetch origin main
git reset --hard origin/main
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
echo $SUDO_PASSWORD | sudo -S rm -r staticfiles
python manage.py collectstatic --noinput
echo $SUDO_PASSWORD | sudo -S chown -R www-data:www-data /var/www/sgl
echo "Deploiement reussi"
echo $SUDO_PASSWORD | sudo -S supervisorctl restart sgl
'''
}
}
}
}