Create Jenkinsfile
This commit is contained in:
parent
85c5d93cbd
commit
ec46ba1ed2
1 changed files with 33 additions and 0 deletions
33
src/flask/Jenkinsfile
vendored
Normal file
33
src/flask/Jenkinsfile
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
echo 'Installing dependencies...'
|
||||||
|
sh 'python3 -m venv venv && source venv/bin/activate && pip install -r requirements.txt'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Test') {
|
||||||
|
steps {
|
||||||
|
echo 'Running tests...'
|
||||||
|
sh 'source venv/bin/activate && pytest test_app.py'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Deploy') {
|
||||||
|
steps {
|
||||||
|
echo 'Deploying the Flask app...'
|
||||||
|
sh 'source venv/bin/activate && nohup python app.py &'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
echo "Build and deployment succeeded!"
|
||||||
|
}
|
||||||
|
failure {
|
||||||
|
echo "Build failed. Please check the console output."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue