Junior — Middle
Do you use Jenkins in your projects for build automation and deployment?
sobes.tech AI
Answer from AI
Yes, I use Jenkins for automation of build and deployment in projects. Jenkins allows setting up pipelines that automatically trigger build, test, and deployment of the application with each commit to the repository. This significantly speeds up the delivery process and reduces the likelihood of errors.
Example of a simple Jenkinsfile for building and deploying to a server:
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'mvn clean package'
}
}
stage('Test') {
steps {
sh 'mvn test'
}
}
stage('Deploy') {
steps {
sh 'scp target/app.jar user@server:/deploy/path'
sh 'ssh user@server systemctl restart app.service'
}
}
}
}