Jenkins 如何使用带有通配符的curl命令将工件部署到jfrog工件
如何使用带有通配符的curl命令将工件部署到Jfrog Artifactory repoJenkins 如何使用带有通配符的curl命令将工件部署到jfrog工件,jenkins,jenkins-pipeline,artifactory,jfrog-cli,Jenkins,Jenkins Pipeline,Artifactory,Jfrog Cli,如何使用带有通配符的curl命令将工件部署到Jfrog Artifactory repo 我试图使用下面来自Jenkins管道脚本的代码,但得到了一个错误 stage 'Deploy Aritfacts to Artifactory' withCredentials([usernameColonPassword(credentialsId: '<enter credentials ID>', variable: 'password')]) {
我试图使用下面来自Jenkins管道脚本的代码,但得到了一个错误
stage 'Deploy Aritfacts to Artifactory'
withCredentials([usernameColonPassword(credentialsId: '<enter credentials ID>', variable: 'password')]) {
sh " curl -k -u $password -T ${WORKSPACE}/soureCode/integration/dan-0.0.1-SNAPSHOT.zip "https://<enter artifactory URL>/maven-prereleases-local/com/dan/ "
curl: Can't open '/bld/workspace/demoPipeline/soureCode/integration/dan-*-SNAPSHOT.zip'!
curl: try 'curl --help' or 'curl --manual' for more information
Finished: FAILURE
不幸的是,curl不支持通配符“*”,因此您可以搜索文件/文件位置,然后将其传递到curl命令中
curl: Can't open '/bld/workspace/demoPipeline/soureCode/integration/dan-*-SNAPSHOT.zip'!
curl: try 'curl --help' or 'curl --manual' for more information
Finished: FAILURE
像这样
curl: Can't open '/bld/workspace/demoPipeline/soureCode/integration/dan-*-SNAPSHOT.zip'!
curl: try 'curl --help' or 'curl --manual' for more information
Finished: FAILURE
curl -k -u $password -T $localFilePath $targetFolder/$fileName
您可以使用Jenkins Artifactory插件吗?这将允许您访问jfrog cli,允许使用uploadSpec的
curl: Can't open '/bld/workspace/demoPipeline/soureCode/integration/dan-*-SNAPSHOT.zip'!
curl: try 'curl --help' or 'curl --manual' for more information
Finished: FAILURE
def server = Artifactory.server 'artifactory'
def uploadSpec = """{
"files": [
{
"pattern": "${WORKSPACE}/soureCode/integration/dan-*-SNAPSHOT.zip",
"target": "maven-prereleases-local/com/dan/"
}
]
}"""
server.upload(uploadSpec)