restart-pod fails when pod does not exist (is not deployed) #9

Open
opened 2026-04-13 12:02:45 +00:00 by pawel.derehajlo · 0 comments

Example: https://git.kvant.cloud/Buchzentrum/bz-data-exchange-service/actions/runs/2/jobs/1/attempt/1

Install oc
Authenticate with OpenShift
Fetch Image tag
Fetching tag of 'app.kubernetes.io/name=bz-data-exchange-service' in 'namespace=bz-dev'
Deployed image name: 'Error executing template: array index out of bounds: index 0, length 0. Printing more information for debugging the template:
	template was:
		{.items[0].spec.containers[0].image}
	object given to jsonpath engine was:
		map[string]interface {}{"kind":"List", "apiVersion":"v1", "metadata":map[string]interface {}{"selfLink":"", "resourceVersion":""}, "items":[]interface {}{}}'
Deployed image tag:  ' array index out of bounds
		{.items[0].spec.containers[0].image}
"List", "apiVersion"'
Compare the Image tags
Comparing tags
Expected image tag: ''
Deployed image tag: ''
No expected image tag set. Skipping.
Restart Pod
Tags are matching. Restarting the Pod.
No resources found

Is this case it should gently fail (do nothing, skip) instead of failing the action

Example: https://git.kvant.cloud/Buchzentrum/bz-data-exchange-service/actions/runs/2/jobs/1/attempt/1 ``` Install oc Authenticate with OpenShift Fetch Image tag Fetching tag of 'app.kubernetes.io/name=bz-data-exchange-service' in 'namespace=bz-dev' Deployed image name: 'Error executing template: array index out of bounds: index 0, length 0. Printing more information for debugging the template: template was: {.items[0].spec.containers[0].image} object given to jsonpath engine was: map[string]interface {}{"kind":"List", "apiVersion":"v1", "metadata":map[string]interface {}{"selfLink":"", "resourceVersion":""}, "items":[]interface {}{}}' Deployed image tag: ' array index out of bounds {.items[0].spec.containers[0].image} "List", "apiVersion"' Compare the Image tags Comparing tags Expected image tag: '' Deployed image tag: '' No expected image tag set. Skipping. Restart Pod Tags are matching. Restarting the Pod. No resources found ``` Is this case it should gently fail (do nothing, skip) instead of failing the action
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
phoenix-oss/forgejo-actions#9
No description provided.