I know oc tag -d python:3.5
will remove only 3.5 tag.However I would like to remove multiple old tags from the same Image Stream using oc command.
For instance image streams phython:rel-1, phython:rel-2, phython:rel-3.
I am trying like oc tag -d python:rel-*
. But I end up with below error message.
*Error from server (NotFound): imagestreamtags.image.openshift.io "rel-*" not found*
I am wondering is there any way to apply wildcards for tags to remove multiple old tags in one go?
Not fully tested, and you can't do it in one command invocation, but you can use a shell script something like:
#!/bin/bash
TAGS=`oc get is python --template='{{range .spec.tags}}{{" "}}{{.name}}{{end}}{{"\n"}}'`
for tag in $TAGS; do
if [[ "$tag" = rel-* ]]; then
oc tag python:$tag -d
fi
done