-
Notifications
You must be signed in to change notification settings - Fork 18.2k
/
Jenkinsfile
68 lines (68 loc) · 2.41 KB
/
Jenkinsfile
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Running build automation'
sh './gradlew build'
archiveArtifacts artifacts: 'src/index.html'
}
}
stage('DeployToStage') {
when {
branch 'master'
}
steps {
withCredentials([string(credentialsId: 'cloud_user_pw', variable: 'USERPASS')]) {
sshPublisher(
failOnError: true,
publishers: [
sshPublisherDesc(
configName: 'staging',
sshCredentials: [
username: 'cloud_user',
encryptedPassphrase: "$USERPASS"
],
transfers: [
sshTransfer(
sourceFiles: 'src/**',
removePrefix: 'src/'
)
]
)
]
)
}
}
}
stage('DeployToProd') {
when {
branch 'master'
}
steps {
input 'Does the staging environment look OK?'
milestone(1)
withCredentials([string(credentialsId: 'cloud_user_pw', variable: 'USERPASS')]) {
sshPublisher(
failOnError: true,
publishers: [
sshPublisherDesc(
configName: 'production',
sshCredentials: [
username: 'cloud_user',
encryptedPassphrase: "$USERPASS"
],
transfers: [
sshTransfer(
sourceFiles: 'src/**',
removePrefix: 'src/'
)
]
)
]
)
}
}
}
}
}