groovyCopy code
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'pip install -r requirements.txt'
}
}
stage('Test') {
steps {
sh 'pytest'
}
}
stage('Deploy') {
steps {
// An example of a conditional step for deployment
when {
branch 'main'
}
sh './deploy.sh'
}
}
}
post {
success {
// Code for notification of successful build
}
failure {
// Code for notification of failed build
}
}
}