I’m trying to delete pods through Jenkins stage. But for loop not working to delete pods. Any suggestions?
stage(' second') {
withCredentials([usernamePassword(credentialsId:"xxx", passwordVariable: 'xxx', usernameVariable: 'xxx')])
{
sh '''
xxxx logging into cluster working here <===
pods= $(oc -n ns get pods | grep -i pod** | awk {'print $1'}) <=== getting list of pods working fine
for pod in "${pods}"
do
echo "$pod"
oc -n ns delete $pod;
done
'''
}
}
## Heading ##