Create Jenkinsfile
This commit is contained in:
parent
85c5d93cbd
commit
fb02608625
1 changed files with 40 additions and 0 deletions
40
src/flask/Jenkinsfile
vendored
Normal file
40
src/flask/Jenkinsfile
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
environment {
|
||||||
|
VENV_DIR = 'venv'
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
echo '📦 Creating virtual environment and installing dependencies...'
|
||||||
|
sh '/usr/bin/python3 -m venv $VENV_DIR'
|
||||||
|
sh '. $VENV_DIR/bin/activate && pip install -r requirements.txt'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Test') {
|
||||||
|
steps {
|
||||||
|
echo '✅ Running unit tests...'
|
||||||
|
sh '. $VENV_DIR/bin/activate && pytest'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Deploy') {
|
||||||
|
steps {
|
||||||
|
echo '🚀 Deploying Flask app...'
|
||||||
|
sh '. $VENV_DIR/bin/activate && nohup python app.py &'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
echo '✅ Build and deployment successful!'
|
||||||
|
}
|
||||||
|
failure {
|
||||||
|
echo '❌ Build or tests failed. Check logs.'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue