@@ -36,7 +36,15 @@ export async function runContainerStep(
3636 core . debug ( `Created secret ${ secretName } for container job envs` )
3737 const container = createContainerSpec ( stepContainer , secretName , extension )
3838
39- const job = await createJob ( container , extension )
39+ let job : k8s . V1Job
40+ try {
41+ job = await createJob ( container , extension )
42+ } catch ( err ) {
43+ core . debug ( `createJob failed: ${ JSON . stringify ( err ) } ` )
44+ const message = ( err as any ) ?. response ?. body ?. message || err
45+ throw new Error ( `failed to run script step: ${ message } ` )
46+ }
47+
4048 if ( ! job . metadata ?. name ) {
4149 throw new Error (
4250 `Expected job ${ JSON . stringify (
@@ -46,7 +54,15 @@ export async function runContainerStep(
4654 }
4755 core . debug ( `Job created, waiting for pod to start: ${ job . metadata ?. name } ` )
4856
49- const podName = await getContainerJobPodName ( job . metadata . name )
57+ let podName : string
58+ try {
59+ podName = await getContainerJobPodName ( job . metadata . name )
60+ } catch ( err ) {
61+ core . debug ( `getContainerJobPodName failed: ${ JSON . stringify ( err ) } ` )
62+ const message = ( err as any ) ?. response ?. body ?. message || err
63+ throw new Error ( `failed to get container job pod name: ${ message } ` )
64+ }
65+
5066 await waitForPodPhases (
5167 podName ,
5268 new Set ( [ PodPhase . COMPLETED , PodPhase . RUNNING , PodPhase . SUCCEEDED ] ) ,
@@ -58,6 +74,7 @@ export async function runContainerStep(
5874
5975 core . debug ( 'Waiting for container job to complete' )
6076 await waitForJobToComplete ( job . metadata . name )
77+
6178 // pod has failed so pull the status code from the container
6279 const status = await getPodStatus ( podName )
6380 if ( status ?. phase === 'Succeeded' ) {
0 commit comments