我無法使用jenkins管道插件從我的artifactory服務器下載構建到我的windows jenkins從屬節點。這一切出現會好起來的,但它並沒有真正下載文件。難道我做錯了什麼?Jenkins管道+ Artifactory下載不下載
我看不到任何請求在我的Artifactory系統日誌中下載,只是爲了上傳。
(2017-04-25 18:39:48,096 [http-nio-8081-exec-2] [INFO](oaeUploadServiceImpl:516) - 部署到'BUILDS:windows/5840/build.tar.gz 「內容長度:278600525)
我一直在使用這個作爲參考:https://wiki.jenkins-ci.org/pages/viewpage.action?pageId=99910084
下面是從我詹金斯管道輸出:
For pattern: build.tar.gz 1 artifacts were found.
Deploying artifact: http://myartifactory:8081/artifactory/BUILDS/windows/5840/build.tar.gz
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] timeout
Timeout set to expire in 3 min 0 sec
[Pipeline] {
[Pipeline] node
Running on test-windows-0 in C:/jenkinsroot/workspace/test-windows
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] echo
{
"files": [
{
"pattern": "BUILDS/windows/5840/build.tar.gz",
"target": "download/",
}
]
}
[Pipeline] echo
Artifactory Download: BUILDS/windows/5840/build.tar.gz -> download/
的文件存在於artifactory的。
這裏是我的詹金斯代碼:
@NonCPS
def downloadArtifactory(String localPath, String repository, String remotePath) {
def downloadSpec = """{
"files": [
{
"pattern": "${repository}/${remotePath}",
"target": "${localPath}",
}
]
}"""
echo "${downloadSpec}"
echo "Artifactory Download: ${repository}/${remotePath} -> ${localPath}"
def server = Artifactory.server("MYARTIFACTORYSERVER")
def buildInfo = server.download spec: downloadSpec
return buildInfo
}
與調用:
downloadArtifactory("download/", "BUILDS", "windows/5840/build.tar.gz")
從你的echo語句看起來你的def downloadSpec正在創建一個名爲downloadSpec的空變量。也許在spec語句開頭的三重引號會讓你感到困惑,你只會得到前兩個引號,並將它分配給一個空字符串。 – Tuffwer
@Tuffwer:雖然它似乎在打印downloadSpec變量,不是嗎?我使用相同的格式上傳。我很困惑:) – Jordan
你是對的我在那裏讀了額外的回聲。在瀏覽你提到的頁面後,我想知道是否需要以不同的方式調用下載。在頁面上執行下載的例子是'server.download(downloadSpec)'。 – Tuffwer