@@ -70,10 +70,11 @@ export async function prepareJob(
7070 )
7171 }
7272
73- let services : k8s . V1Container [ ] = [ ]
74- if ( args . services ?. length ) {
75- processServiceContainers ( args . services , container , extension )
76- }
73+ const services : k8s . V1Container [ ] = processServiceContainers (
74+ args . services ,
75+ container ,
76+ extension
77+ )
7778
7879 if ( ! container && ! services ?. length ) {
7980 throw new Error ( 'No containers exist, skipping hook invocation' )
@@ -143,13 +144,16 @@ export async function prepareJob(
143144 generateResponseFile ( responseFile , args , createdPod , isAlpine )
144145}
145146
146- async function processServiceContainers (
147- services : ServiceContainerInfo [ ] ,
147+ function processServiceContainers (
148+ services ? : ServiceContainerInfo [ ] ,
148149 container ?: k8s . V1Container ,
149150 extension ?: k8s . V1PodTemplateSpec
150- ) {
151+ ) : k8s . V1Container [ ] {
152+ if ( ! services ?. length ) {
153+ return [ ]
154+ }
151155 generateServicesName ( services )
152- services = services . map ( service => {
156+ const serviceContainers = services . map ( service => {
153157 core . debug ( `Adding service '${ service . image } ' to pod definition` )
154158 return createContainerSpec (
155159 service ,
@@ -188,6 +192,7 @@ async function processServiceContainers(
188192 }
189193 }
190194 }
195+ return serviceContainers
191196}
192197
193198// Create JobSet and waits for it to come online
0 commit comments