【发布时间】:2021-01-21 18:59:52
【问题描述】:
这是我的 Jenkins 流水线脚本。 TOOL_CREDS_USR 和 TOOL_CREDS_PSW 变量不会传递到远程主机。由于变量为空,我的工作挂起询问用户名
我验证了 python 命令有效,通过直接在远程主机上运行并替换变量来验证它
pipeline {
environment {
TOOL_CREDS = credentials('hello')
}
stages {
stage('Deploy') {
steps {
echo 'Deploying....'
sshPublisher(
continueOnError: false,
failOnError: true,
publishers: [
sshPublisherDesc(
configName: "world",
sshTransfer(execCommand: 'python3 -m pip install --index-url https://$TOOL_CREDS_USR:$TOOL_CREDS_PSW@sample.com/repository/pypi-hosted/simple testpackage')
],
verbose: true
)
]
)
}
}
}
}
我试过 ${} 但也失败了。请帮忙
【问题讨论】:
标签: jenkins ssh jenkins-pipeline jenkins-plugins jenkins-groovy