-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
51 lines (45 loc) · 1.06 KB
/
Copy pathJenkinsfile
File metadata and controls
51 lines (45 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
pipeline {
agent { label 'built-in' }
tools {
maven "Maven-Jenkins"
}
environment {
DEPLOY_USER = "jenkins"
DEPLOY_DIR = "/opt/liberty/wlp/usr/servers/defaultServer/apps"
ARTIFACT = "target/PostWizardREST.war"
WAR_FILE = "PostWizardREST.war"
SSH_CRED = "jenkins"
}
stages {
stage('Checkout') {
steps {
git branch: 'main',
changelog: false,
credentialsId: '66e84ea5-1cb6-4a43-b1d2-cd2f7ecdb6ae',
url: 'git@github.com:Urbine/PostWizardREST.git'
}
}
stage('Build') {
steps {
sh 'mvn -B -DskipTests clean package'
stash includes: "${ARTIFACT}",
name: "war_file"
}
}
stage('Deploy to agent') {
agent { label "WMen DevOps" }
steps {
unstash "war_file"
sh "rm ${DEPLOY_DIR}/${WAR_FILE}"
sh "mv ${ARTIFACT} ${DEPLOY_DIR}"
sh "rm -rf ${DEPLOY_DIR}/expanded"
sh "sudo systemctl restart liberty"
}
}
}
post {
always {
cleanWs()
}
}
}