@@ -293,9 +293,18 @@ func (rc *RunContext) startJobContainer() common.Executor {
293
293
if err != nil {
294
294
return fmt .Errorf ("failed to handle service %s credentials: %w" , serviceID , err )
295
295
}
296
- serviceBinds , serviceMounts := rc .GetServiceBindsAndMounts (spec .Volumes )
297
296
298
- exposedPorts , portBindings , err := nat .ParsePortSpecs (spec .Ports )
297
+ interpolatedVolumes := make ([]string , 0 , len (spec .Volumes ))
298
+ for _ , volume := range spec .Volumes {
299
+ interpolatedVolumes = append (interpolatedVolumes , rc .ExprEval .Interpolate (ctx , volume ))
300
+ }
301
+ serviceBinds , serviceMounts := rc .GetServiceBindsAndMounts (interpolatedVolumes )
302
+
303
+ interpolatedPorts := make ([]string , 0 , len (spec .Ports ))
304
+ for _ , port := range spec .Ports {
305
+ interpolatedPorts = append (interpolatedPorts , rc .ExprEval .Interpolate (ctx , port ))
306
+ }
307
+ exposedPorts , portBindings , err := nat .ParsePortSpecs (interpolatedPorts )
299
308
if err != nil {
300
309
return fmt .Errorf ("failed to parse service %s ports: %w" , serviceID , err )
301
310
}
@@ -304,7 +313,7 @@ func (rc *RunContext) startJobContainer() common.Executor {
304
313
c := container .NewContainer (& container.NewContainerInput {
305
314
Name : serviceContainerName ,
306
315
WorkingDir : ext .ToContainerPath (rc .Config .Workdir ),
307
- Image : spec .Image ,
316
+ Image : rc . ExprEval . Interpolate ( ctx , spec .Image ) ,
308
317
Username : username ,
309
318
Password : password ,
310
319
Env : envs ,
@@ -315,7 +324,7 @@ func (rc *RunContext) startJobContainer() common.Executor {
315
324
Privileged : rc .Config .Privileged ,
316
325
UsernsMode : rc .Config .UsernsMode ,
317
326
Platform : rc .Config .ContainerArchitecture ,
318
- Options : spec .Options ,
327
+ Options : rc . ExprEval . Interpolate ( ctx , spec .Options ) ,
319
328
NetworkMode : networkName ,
320
329
NetworkAliases : []string {serviceID },
321
330
ExposedPorts : exposedPorts ,
0 commit comments