我想使用Openshift Rest API https://docs.openshift.com/container-platform/3.7/rest_api/index.html启动应用的构建。
我需要的:
我在https://docs.openshift.com/container-platform/3.7/rest_api/apis-build.openshift.io/v1.Build.html中找不到该怎么做
可以使用OC Tool Analogue完成:
oc start-build name -n namespase
但是我想使用REST API做到这一点
非常感谢你!
答案 0 :(得分:0)
curl -H "Authorization: Bearer xxx" -H 'Accept: application/json' -XPOST "$openshiftUrl/apis/build.openshift.io/v1/namespaces/YOURNAMESPACE/buildconfigs/CONFIGNAME/instantiatebinary?name=XXXX&namespace=YOURNAMESSPACE" --data-binary @/tmp/eQXEUXr.zip
使用axios
return axios({
method: 'post',
url: 'url/apis/build.openshift.io/v1/namespaces/YYY/buildconfigs/XXX/instantiatebinary?name=XXX&namespace=YYY',
data: fs.createReadStream('/tmp/eQXEUXr.zip'),
headers: {
'content-type': `application/octet-stream`,
'Authorization': 'Bearer aaaaaa',
'Accept': 'application/json'
},
maxContentLength: Infinity,
maxBodyLength: Infinity,
httpsAgent: new Agent({
rejectUnauthorized: false
}),
timeout: 300000,
}