问题描述
我正在使用Jenkins中的通过ssh插件发布来连接到我的应用程序主机以部署应用程序。
我正在从库中获取数据库凭据,并使用sshPublisher()传递给远程主机
(https://wiki.jenkins.io/display/JENKINS/Publish+Over+SSH+Plugin)。
但是,传递的变量$ username在远程主机中显示为空白。
我正在使用类似以下的内容:
withCredentials([[$class: 'UsernamePasswordMultiBinding',credentialsId: 'Id',usernameVariable: 'username',passwordVariable: 'password']]) {
sshPublisher(
publishers: [
sshPublisherDesc(
configName: 'DevHost',transfers: [
sshTransfer(
cleanRemote: false,excludes: '',execCommand: '. /deploy.sh dev',execTimeout: 120000,flatten: false,makeEmptyDirs: false,noDefaultExcludes: false,patternSeparator: '[,]+',remoteDirectory: '/app/dev',remoteDirectorySDF: false,removePrefix: '',sourceFiles: ''
)
],usePromotionTimestamp: false,useWorkspaceInPromotion: false,verbose: false)
]
)
这是在deploy.sh中使用的用户名和密码,但均为NULL
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)