Source:
<code>boolean areAllContainersRunning(Pod pod) { PodStatus podStatus = pod.getStatus(); if (podStatus == null) { return false; } List<ContainerStatus> containerStatuses = pod.getStatus().getContainerStatuses(); if (containerStatuses.isEmpty()) { return false; } for (ContainerStatus containerStatus : containerStatuses) { if (containerStatus != null) { ContainerStateWaiting waitingState = containerStatus.getState().getWaiting(); if (waitingState != null) { String waitingStateMsg = waitingState.getMessage(); if (waitingStateMsg != null && waitingStateMsg.contains("Back-off pulling image")) { LOGGER.log(Level.INFO, "Unable to pull Docker image"); Jenkins jenkins = Jenkins.getInstanceOrNull(); if (jenkins != null) { Queue q = jenkins.getQueue(); for (Queue.Item item : q.getItems()) { Label itemLabel = item.getAssignedLabel(); if (itemLabel != null && isCorrespondingLabels(itemLabel.getDisplayName(), pod.getMetadata().getName(), LOGGER)) { String itemTaskName = item.task.getFullDisplayName(); String jobName = getJobName(itemTaskName); if (jobName.equals("")) { LOGGER.log(Level.WARNING, "Unknown / Invalid job format name"); break; } <START> Run run = getCorrespondingJobBuild(jenkins.allItems(Job.class).iterator(), jobName, getBuildNumber(itemTaskName)); <END> if (run != null) { try { writeStream(run, "ERROR: Unable to pull Docker image. Check if image name is spelled correctly"); } catch (IOException e) { LOGGER.log(Level.WARNING, "ERROR: Unable to print bad Docker image error message to build console"); } } q.cancel(item); break; } } } } return false; } if (containerStatus.getState().getTerminated() != null) { return false; } if (!containerStatus.getReady()) { return false; } } } return true; }</code><technical_language>work. suffice for KubernetesLauncher.launch pass TaskListener constructor of AllContainersRunningPodWatcher. a simple java listener.error("Unable pull Docker image. Check if image name is spelled correctly"); done</technical_language>

Target:
boolean areAllContainersRunning(Pod pod) { PodStatus podStatus = pod.getStatus(); if (podStatus == null) { return false; } List<ContainerStatus> containerStatuses = pod.getStatus().getContainerStatuses(); if (containerStatuses.isEmpty()) { return false; } for (ContainerStatus containerStatus : containerStatuses) { if (containerStatus != null) { ContainerStateWaiting waitingState = containerStatus.getState().getWaiting(); if (waitingState != null) { String waitingStateMsg = waitingState.getMessage(); if (waitingStateMsg != null && waitingStateMsg.contains("Back-off pulling image")) { runListener.error("Unable to pull Docker image \""+containerStatus.getImage()+"\". Check if image name is spelled correctly"); Jenkins jenkins = Jenkins.getInstanceOrNull(); if (jenkins != null) { Queue q = jenkins.getQueue(); for (Queue.Item item : q.getItems()) { Label itemLabel = item.getAssignedLabel(); if (itemLabel != null && isCorrespondingLabels(itemLabel.getDisplayName(), pod.getMetadata().getName())) { String itemTaskName = item.task.getFullDisplayName(); String jobName = getJobName(itemTaskName); if (jobName.equals("")) { LOGGER.log(Level.WARNING, "Unknown / Invalid job format name"); break; } q.cancel(item); break; } } } } return false; } if (containerStatus.getState().getTerminated() != null) { return false; } if (!containerStatus.getReady()) { return false; } } } return true; }