54 lines
1.4 KiB
Groovy
54 lines
1.4 KiB
Groovy
pipeline {
|
|
agent any
|
|
|
|
stages {
|
|
|
|
stage('Checkout') {
|
|
steps {
|
|
echo 'Code checked out'
|
|
}
|
|
}
|
|
|
|
stage('Install Dependencies') {
|
|
steps {
|
|
sh '''
|
|
cd platform
|
|
python3 -m venv venv
|
|
venv/bin/pip install -r requirements.txt --quiet
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('Test') {
|
|
steps {
|
|
sh '''
|
|
cd platform
|
|
echo "Running basic syntax check..."
|
|
venv/bin/python -m py_compile app.py && echo "✅ app.py syntax OK"
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('Deploy to Server 1') {
|
|
steps {
|
|
sh '''
|
|
cp -r platform/* /root/management-platform/
|
|
cd /root/management-platform
|
|
venv/bin/pip install -r requirements.txt --quiet 2>/dev/null || true
|
|
systemctl restart management-platform
|
|
sleep 4
|
|
systemctl is-active --quiet management-platform && echo "✅ Deployed OK" || exit 1
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
success {
|
|
echo '✅ Pipeline succeeded — platform deployed'
|
|
}
|
|
failure {
|
|
echo '❌ Pipeline failed — old version still running'
|
|
}
|
|
}
|
|
} |