PR feedback
parent
bea818fb9c
commit
2c3cb006c0
|
|
@ -34,7 +34,7 @@ class KubernetesPods {
|
||||||
|
|
||||||
let containerExitCode: number | undefined;
|
let containerExitCode: number | undefined;
|
||||||
let containerSucceeded = false;
|
let containerSucceeded = false;
|
||||||
|
|
||||||
if (containerStatuses.length > 0) {
|
if (containerStatuses.length > 0) {
|
||||||
containerStatuses.forEach((cs, idx) => {
|
containerStatuses.forEach((cs, idx) => {
|
||||||
if (cs.state?.waiting) {
|
if (cs.state?.waiting) {
|
||||||
|
|
@ -64,7 +64,7 @@ class KubernetesPods {
|
||||||
// Check if only PreStopHook failed but container succeeded
|
// Check if only PreStopHook failed but container succeeded
|
||||||
const hasPreStopHookFailure = events.some((e) => e.reason === 'FailedPreStopHook');
|
const hasPreStopHookFailure = events.some((e) => e.reason === 'FailedPreStopHook');
|
||||||
const wasKilled = events.some((e) => e.reason === 'Killing');
|
const wasKilled = events.some((e) => e.reason === 'Killing');
|
||||||
|
|
||||||
// If container succeeded (exit code 0), PreStopHook failure is non-critical
|
// If container succeeded (exit code 0), PreStopHook failure is non-critical
|
||||||
// Also check if pod was killed but container might have succeeded
|
// Also check if pod was killed but container might have succeeded
|
||||||
if (containerSucceeded && containerExitCode === 0) {
|
if (containerSucceeded && containerExitCode === 0) {
|
||||||
|
|
@ -82,7 +82,7 @@ class KubernetesPods {
|
||||||
// Don't throw error - container succeeded, PreStopHook failure is non-critical
|
// Don't throw error - container succeeded, PreStopHook failure is non-critical
|
||||||
return false; // Pod is not running, but we don't treat it as a failure
|
return false; // Pod is not running, but we don't treat it as a failure
|
||||||
}
|
}
|
||||||
|
|
||||||
// If pod was killed and we have PreStopHook failure but no container status yet, wait a bit
|
// If pod was killed and we have PreStopHook failure but no container status yet, wait a bit
|
||||||
// The container might have succeeded but status hasn't been updated yet
|
// The container might have succeeded but status hasn't been updated yet
|
||||||
if (wasKilled && hasPreStopHookFailure && containerExitCode === undefined) {
|
if (wasKilled && hasPreStopHookFailure && containerExitCode === undefined) {
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,12 @@ export class CustomWorkflow {
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
const allowFailure = step.allowFailure === true;
|
const allowFailure = step.allowFailure === true;
|
||||||
const stepName = step.name || step.image || 'unknown';
|
const stepName = step.name || step.image || 'unknown';
|
||||||
|
|
||||||
if (allowFailure) {
|
if (allowFailure) {
|
||||||
CloudRunnerLogger.logWarning(
|
CloudRunnerLogger.logWarning(
|
||||||
`Hook container "${stepName}" failed but allowFailure is true. Continuing build. Error: ${error?.message || error}`,
|
`Hook container "${stepName}" failed but allowFailure is true. Continuing build. Error: ${
|
||||||
|
error?.message || error
|
||||||
|
}`,
|
||||||
);
|
);
|
||||||
// Continue to next step
|
// Continue to next step
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue