如何在 jenkinsfile 中正确使用 jenkins 'publish over ssh' 插件?
How do I correctly use the jenkins 'publish over ssh' plugin in a jenkinsfile?
关于https://jenkins.io/doc/pipeline/steps/publish-over-ssh/#code-sshpublisher-code-send-build-artifacts-over-ssh的文档不是太清楚...
sshPublisher publishers transfer sourceFiles: '/appdata/jenkins/jobs/project/otcm-${pom.version}.tar.gz'
以上给出了 'no such property' 个错误。正确的语法是什么?
我的詹金斯文件:
node {
stage 'Clean Up'
deleteDir()
stage 'Env Setup'
env.JAVA_HOME = "${tool 'JDK 8'}"
def mvnHome = tool '3.0.3'
stage 'Compile/Package'
checkout scm
stage 'Compile/Package - Get app version'
def pom = readMavenPom file: 'pom.xml'
echo "${pom.version}"
stage 'Compile/Package - Compile and upload to S3'
sh "${mvnHome}/bin/mvn clean install -DskipTests"
/* should i bother with pushing to s3 since snapshot? */
stage 'Push to S3'
stage 'Install'
sh "ssh devci@server 'rm -rf /appdata/devci/app'"
sh "ssh devci@server 'mkdir /appdata/devci/app'"
/* ssh push the tar to remote dir */
/* use the jenkins sshPublisher??? */
/* Remote - explode tar */
/* Remote - download project properties */
/* Remove - start app without new relic using custom port 8007 */
}
所以有这个管道片段生成器!
https://jenkins.io/blog/2016/05/31/pipeline-snippetizer/
对新手很有用!
关于https://jenkins.io/doc/pipeline/steps/publish-over-ssh/#code-sshpublisher-code-send-build-artifacts-over-ssh的文档不是太清楚...
sshPublisher publishers transfer sourceFiles: '/appdata/jenkins/jobs/project/otcm-${pom.version}.tar.gz'
以上给出了 'no such property' 个错误。正确的语法是什么?
我的詹金斯文件:
node {
stage 'Clean Up'
deleteDir()
stage 'Env Setup'
env.JAVA_HOME = "${tool 'JDK 8'}"
def mvnHome = tool '3.0.3'
stage 'Compile/Package'
checkout scm
stage 'Compile/Package - Get app version'
def pom = readMavenPom file: 'pom.xml'
echo "${pom.version}"
stage 'Compile/Package - Compile and upload to S3'
sh "${mvnHome}/bin/mvn clean install -DskipTests"
/* should i bother with pushing to s3 since snapshot? */
stage 'Push to S3'
stage 'Install'
sh "ssh devci@server 'rm -rf /appdata/devci/app'"
sh "ssh devci@server 'mkdir /appdata/devci/app'"
/* ssh push the tar to remote dir */
/* use the jenkins sshPublisher??? */
/* Remote - explode tar */
/* Remote - download project properties */
/* Remove - start app without new relic using custom port 8007 */
}
所以有这个管道片段生成器!
https://jenkins.io/blog/2016/05/31/pipeline-snippetizer/
对新手很有用!