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 ?