如何使用Jenkins Pipeline在OpenShift容器平台中检查图像速度是否存在
我运行了此代码以检查和删除OpenShift中的成像仪
openshift.withCluster("${CLUSTER_NAME}") {
openshift.withProject("${DEV_ENV}") {
if (openshift.selector('imagestreams', '${imagestream_name}').exists()) {
openshift.selector('imagestreams', '${imagestream_name}').delete()
那我跑了这个
openshift.withCluster("${CLUSTER_NAME}") {
openshift.withProject("${DEV_ENV}") {
openshift.apply(openshift.raw("create -f '${imagestream_name}'.yaml"))
要从本地yaml文件创建新的成像剧院,但最终会出现此错误
ERROR: raw command [create -f 'imagestream-test'.yaml] returned an error;
{err=Error from server (AlreadyExists): error when creating "imagestream-test.yaml": imagestreams.image.openshift.io "testimagestream" already exists
无论如何,是否可以检查图像传播是否已经在OpenShift中?
I ran this code to check and delete the imagestreams in Openshift
openshift.withCluster("${CLUSTER_NAME}") {
openshift.withProject("${DEV_ENV}") {
if (openshift.selector('imagestreams', '${imagestream_name}').exists()) {
openshift.selector('imagestreams', '${imagestream_name}').delete()
then I ran this
openshift.withCluster("${CLUSTER_NAME}") {
openshift.withProject("${DEV_ENV}") {
openshift.apply(openshift.raw("create -f '${imagestream_name}'.yaml"))
to create new imagestream from local yaml file but it end up with this error
ERROR: raw command [create -f 'imagestream-test'.yaml] returned an error;
{err=Error from server (AlreadyExists): error when creating "imagestream-test.yaml": imagestreams.image.openshift.io "testimagestream" already exists
Is there anyway to check if the imagestream is already in openshift ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如何使用
应用
而不是创建
?OC应用
如果不存在或更新,则将创建资源。How about using
apply
instead ofcreate
?oc apply
will create a resource if it doesn't exist or update if it does.