Jenkinsfile

main
Araozu 2023-11-08 05:58:27 -05:00
parent 5d1017f0be
commit 1acb22e1fe
3 changed files with 38 additions and 2 deletions

36
Jenkinsfile.groovy Normal file
View File

@ -0,0 +1,36 @@
// Simple pipeline for deploying spring
pipeline {
agent any
stages {
stage('Stop previous deploy') {
environment {
PATH = "/var/lib/jenkins/.nvm/versions/node/v20.9.0/bin:${env.PATH}"
}
steps {
sh "pm2 stop ${env.JOB_NAME}"
}
}
stage('Build') {
steps {
sh './mvnw clean package'
}
}
stage('Deploy') {
environment {
PATH = "/var/lib/jenkins/.nvm/versions/node/v20.9.0/bin:${env.PATH}"
}
steps {
dir('/var/www/jerguero') {
// Remove previous deploy
sh 'rm /var/www/jerguero/*'
// Copy new deploy
sh 'cp /var/lib/jenkins/workspace/jerguero/target/jerguero-0.0.1.jar /var/www/jerguero'
// run jar with pm2
sh "pm2 start jerguero-0.0.1.jar --name ${env.JOB_NAME}"
// Save state
sh 'pm2 save'
}
}
}
}
}

View File

@ -10,7 +10,7 @@
</parent> </parent>
<groupId>dev.araozu</groupId> <groupId>dev.araozu</groupId>
<artifactId>jerguero</artifactId> <artifactId>jerguero</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1</version>
<name>jerguero</name> <name>jerguero</name>
<description>jerguero</description> <description>jerguero</description>
<properties> <properties>

View File

@ -12,7 +12,7 @@
</head> </head>
<body> <body>
<div class="bg-teal-900 text-white rounded-xl p-4 m-4 shadow"> <div class="bg-teal-900 text-white rounded-xl p-4 m-4 shadow">
<p th:text="|Oh hi, ${name}, thanks for checking in, i'm|"/> <p th:text="|Oh hi ${name}, thanks for checking in, i'm|"/>
<p class="bg-white text-teal-900 p-2 my-2 rounded-xl shadow-inner"> <p class="bg-white text-teal-900 p-2 my-2 rounded-xl shadow-inner">
still a piece of garbage still a piece of garbage
</p> </p>