【发布时间】:2020-01-14 15:10:09
【问题描述】:
我有一个在 Jenkins 脚本控制台中运行的 Groovy 脚本。该脚本使用 JFrog Rest API 来运行一些查询。其中一个返回:状态码:404,原因短语:未找到
卷曲:
$ curl -X GET -H "X-JFrog-Art-Api:APIKey" https://OU.jfrog.io/OU/api/storage/test-repository/docker-log-gen/1.12/manifest.json?properties
{
"properties" : { ... },
"uri" : "https://OU.jfrog.io/artifactory/api/storage/test-repository/docker-log-gen/1.12/manifest.json"
}
WGET
$ wget --header="X-JFrog-Art-Api:APIKey" https://OU.jfrog.io/OU/api/storage/test-repository/docker-log-gen/1.12/manifest.json?properties
--2020-01-14 13:12:16-- https://OU.jfrog.io/OU/api/storage/test-repository/docker-log-gen/1.12/manifest.json?properties
HTTP request sent, awaiting response... 200 OK
Jenkins Groovy
def restClient = new RESTClient('https://OU.jfrog.io')
restClient.headers['X-JFrog-Art-Api'] = 'APIKey'
println(restClient.get(path: '/OU/api/storage/test-repository/docker-log-gen/1.12/manifest.json?properties', requestContentType: 'text/plain') )
groovyx.net.http.HttpResponseException: status code: 404, reason phrase: Not Found
脚本中的其他调用(api/docker)在此调用之前进行并成功返回。我无法确定此响应的原因,因为命令行调用返回了预期的 JSON。
请帮忙。
【问题讨论】:
标签: rest jenkins-groovy