forked from hellokaton/java11-examples
-
Notifications
You must be signed in to change notification settings - Fork 157
Expand file tree
/
Copy pathjenkinsfilecicd
More file actions
32 lines (29 loc) · 893 Bytes
/
jenkinsfilecicd
File metadata and controls
32 lines (29 loc) · 893 Bytes
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
pipeline {
agent any
stages {
stage('SCM code') {
steps {
git 'https://github.com/hellokaton/java11-examples.git'
}
}
stage('Build') {
steps {
sh 'mvn clean package'
}
}
stage('Publish') {
steps {
archiveArtifacts 'target/*.jar'
}
}
stage('SCP to Remote Host') {
steps {
withCredentials([usernamePassword(credentialsId: 'ssh-login', usernameVariable: 'SSH_USER', passwordVariable: 'SSH_PASS')]) {
sh '''
sshpass -p "$SSH_PASS" scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null target/*.jar $SSH_USER@192.168.111.130:/tmp/
'''
}
}
}
}
}