diff --git a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts index 7293f623e..45b7a48e8 100644 --- a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts +++ b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts @@ -772,11 +772,12 @@ export class KubeClient extends Client { } async gzippedLogFiles(podName: string): Promise { - const [podId, podStatus] = await this.getPodIdAndStatus(podName); + const [podId, podStatus, zombieRole] = await this.getPodInfo(podName); debug("podId", podId); debug("podStatus", podStatus); - // we can only get compressed files from `Running` pods - if (podStatus !== "Running") return []; + debug("zombieRole", zombieRole); + // we can only get compressed files from `Running` and not temp pods + if (podStatus !== "Running" || zombieRole == "temp") return []; // log dir in ci /var/log/pods/__/ const logsDir = `/var/log/pods/${this.namespace}_${podName}_${podId}/${podName}`; @@ -830,14 +831,14 @@ export class KubeClient extends Client { return result.stdout; } - async getPodIdAndStatus(podName: string): Promise { + async getPodInfo(podName: string): Promise { // kubectl get pod -n -o jsonpath='{.metadata.uid}' const args = [ "get", "pod", podName, "-o", - 'jsonpath={.metadata.uid}{","}{.status.phase}', + 'jsonpath={.metadata.uid}{","}{.status.phase}{","}{.metadata.labels.zombie-role}', ]; const result = await this.runCommand(args, { scoped: true,