mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 21:15:50 +00:00
test webhook trigger 7
This commit is contained in:
parent
2261b95a69
commit
5dff625fee
2 changed files with 57 additions and 1 deletions
56
Jenkinsfile/Jenkinsfile
vendored
Normal file
56
Jenkinsfile/Jenkinsfile
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
pipeline {
|
||||
agent any // This runs the pipeline on any available agent
|
||||
|
||||
environment {
|
||||
// Set environment variables if needed
|
||||
APP_DIR = "/home/vagrant/petclinic"
|
||||
REPO_URL = "https://github.com/yiting68/spring-petclinic.git"
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
// Checkout the latest code from the Git repository
|
||||
git branch: 'main', url: 'https://github.com/yiting68/spring-petclinic.git'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
steps {
|
||||
// Install dependencies and build the project
|
||||
sh './gradlew clean build' // assuming you are using Gradle
|
||||
}
|
||||
}
|
||||
|
||||
stage('Test') {
|
||||
steps {
|
||||
// Run tests (JUnit tests in this case)
|
||||
sh './gradlew test'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
// Deploy the app, e.g., run the JAR file or deploy to your server
|
||||
sh 'nohup java -jar build/libs/spring-petclinic-3.4.0.jar > /home/vagrant/petclinic/app.log 2>&1 &'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
// Actions to perform after the pipeline finishes
|
||||
echo 'Cleaning up'
|
||||
}
|
||||
|
||||
success {
|
||||
// Actions if the pipeline is successful
|
||||
echo 'Build and deploy succeeded!'
|
||||
}
|
||||
|
||||
failure {
|
||||
// Actions if the pipeline fails
|
||||
echo 'Build failed!'
|
||||
}
|
||||
}
|
||||
}
|
|
@ -71,4 +71,4 @@
|
|||
}
|
||||
|
||||
}
|
||||
// Just a comment to test Jenkins webhook, test 6
|
||||
// Just a comment to test Jenkins webhook, test 7
|
||||
|
|
Loading…
Reference in a new issue