-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjenkinsfile
48 lines (43 loc) · 2 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
pipeline {
agent any
options {
timestamps()
}
stages {
// stage('Clone') {
// steps {
// checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'shangxianapp-github-xuexb-ssh-key', url: 'git@github.com:shangxianapp/docker-sg02-nginx-proxy.git']]]
// sh "mkdir dist"
// sh "ls -lh"
// sh "cp -r html inc docker-compose.yml nginx.conf dist/"
// }
// }
stage('Publish') {
steps {
sh "ls -lh"
sh "sh ./build.sh"
sshPublisher(publishers: [sshPublisherDesc(configName: 'sg02', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'echo \'success ok\'', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: "${DOCKER_NGINX_DIR}", remoteDirectorySDF: false, removePrefix: 'dist', sourceFiles: 'dist/**/*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
}
}
stage('Reload') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'shangxianapp-xiaowu-ssh-key', keyFileVariable: 'identity', passphraseVariable: '', usernameVariable: 'userName')]) {
script {
def remote = [:]
remote.name = 'sg02'
remote.host = 'sg02.ddns.shangxian.app'
remote.allowAnyHosts = true
remote.user = userName
remote.identityFile = identity
sshCommand remote: remote, command: '/bin/sh $DOCKER_NGINX_DIR/reload.sh'
}
}
}
}
}
post {
always {
deleteDir()
}
}
}