diff --git a/act/container/docker_run.go b/act/container/docker_run.go index 73672325..1c790d6a 100644 --- a/act/container/docker_run.go +++ b/act/container/docker_run.go @@ -412,6 +412,11 @@ func (cr *containerReference) mergeJobOptions(ctx context.Context, config *conta logger := common.Logger(ctx) + if jobConfig.Config.Healthcheck != nil && len(jobConfig.Config.Healthcheck.Test) > 0 { + logger.Debugf("--health-* options %+v", jobConfig.Config.Healthcheck) + config.Healthcheck = jobConfig.Config.Healthcheck + } + if len(jobConfig.Config.Volumes) > 0 { logger.Debugf("--volume options (except bind) %v", jobConfig.Config.Volumes) err = mergo.Merge(&config.Volumes, jobConfig.Config.Volumes, mergo.WithOverride, mergo.WithAppendSlice) diff --git a/act/container/docker_run_test.go b/act/container/docker_run_test.go index 53a812f6..1069f895 100644 --- a/act/container/docker_run_test.go +++ b/act/container/docker_run_test.go @@ -338,11 +338,18 @@ func TestMergeJobOptions(t *testing.T) { hostConfig *container.HostConfig }{ { - name: "ok", - options: "--volume /frob:/nitz --volume somevolume --tmpfs /tmp:exec,noatime --hostname alternatehost", + name: "Ok", + options: `--volume /frob:/nitz --volume somevolume --tmpfs /tmp:exec,noatime --hostname alternatehost --health-cmd "healthz one" --health-interval 10s --health-timeout 5s --health-retries 3 --health-start-period 30s`, config: &container.Config{ Volumes: map[string]struct{}{"somevolume": {}}, Hostname: "alternatehost", + Healthcheck: &container.HealthConfig{ + Test: []string{"CMD-SHELL", "healthz one"}, + Interval: 10 * time.Second, + Timeout: 5 * time.Second, + StartPeriod: 30 * time.Second, + Retries: 3, + }, }, hostConfig: &container.HostConfig{ Binds: []string{"/frob:/nitz"}, @@ -350,7 +357,17 @@ func TestMergeJobOptions(t *testing.T) { }, }, { - name: "ignore", + name: "DisableHealthCheck", + options: `--no-healthcheck`, + config: &container.Config{ + Healthcheck: &container.HealthConfig{ + Test: []string{"NONE"}, + }, + }, + hostConfig: &container.HostConfig{}, + }, + { + name: "Ignore", options: "--pid=host --device=/dev/sda", config: &container.Config{}, hostConfig: &container.HostConfig{},