fix: skip service container for empty image (#2281)
* fix: skip service container for empty image It is used to skip empty image name in services which is the only way to handle condition services in github action currently https://github.com/actions/runner/issues/822 * test: add testdata for empty image in services * fix: add missing test call * fix: wring test call * fix: invalid without expression --------- Co-authored-by: ChristopherHX <christopher.homberger@web.de>
This commit is contained in:
@@ -310,11 +310,17 @@ func (rc *RunContext) startJobContainer() common.Executor {
|
||||
return fmt.Errorf("failed to parse service %s ports: %w", serviceID, err)
|
||||
}
|
||||
|
||||
imageName := rc.ExprEval.Interpolate(ctx, spec.Image)
|
||||
if imageName == "" {
|
||||
logger.Infof("The service '%s' will not be started because the container definition has an empty image.", serviceID)
|
||||
continue
|
||||
}
|
||||
|
||||
serviceContainerName := createContainerName(rc.jobContainerName(), serviceID)
|
||||
c := container.NewContainer(&container.NewContainerInput{
|
||||
Name: serviceContainerName,
|
||||
WorkingDir: ext.ToContainerPath(rc.Config.Workdir),
|
||||
Image: rc.ExprEval.Interpolate(ctx, spec.Image),
|
||||
Image: imageName,
|
||||
Username: username,
|
||||
Password: password,
|
||||
Env: envs,
|
||||
|
||||
Reference in New Issue
Block a user