Jenkins Pipeline SSH Publisher 环境变量、参数引用 要用双引号
Jenkins Pipeline SSH Publisher 环境变量、参数引用 要用双引号
在 Pipeline 脚本中,如果要使用变量,就必须使用 “ 双引号
pipeline { agent any environment { PROJECT_NAME='vipsoft' } stages { stage('Docker Build 、Push Repository') { steps { echo " PROJECT_NAME => '${PROJECT_NAME}'" sshPublisher(publishers: [sshPublisherDesc(configName: "DockerPublishSSH", transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: """ pwd mkdir -p /opt/jenkins/${PROJECT_NAME} cd /opt/jenkins/${PROJECT_NAME} echo "/opt/jenkins/${PROJECT_NAME}" pwd echo 'COPY /target/${PROJECT_NAME}.jar /app/code/' > Dockerfile """, execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: "${PROJECT_NAME}", remoteDirectorySDF: false, removePrefix: '', sourceFiles: "target//${PROJECT_NAME}.jar")], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: true)]) echo 'Docker Build、Push SUCCESS' } } } }
本文来自博客园,作者:VipSoft 转载请注明原文链接:https://www.cnblogs.com/vipsoft/p/16865490.html