runner/act/container
Earl Warren 96891ab314
feat: wait for services to be healthy before starting a job (#805)
If a --health-cmd is defined for a container, block until its status is healthy or unhealthy. The timeout is defined by the server internal logic based on associated --health-* defined delays. If it blocks indefinitely, the job timeout will eventually cancel it.

While waiting, the simplest solution would be to sleep 1 second until the container is healthy or unhealthy. To minimize log verbosity, the sleep interval is instead set to --health-interval and default to one second if it is not defined.

This logic does not apply to host containers as they do not support services. They are assumed to always be healthy.

If --health-cmd is set for the container running a job, the first step will start to run without waiting for the container to become healthy. There may be valid use cases for that but they are not the focus of this implementation.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/805): <!--number 805 --><!--line 0 --><!--description ZmVhdDogd2FpdCBmb3Igc2VydmljZXMgdG8gYmUgaGVhbHRoeSBiZWZvcmUgc3RhcnRpbmcgYSBqb2I=-->feat: wait for services to be healthy before starting a job<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/805
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-08-07 04:36:26 +00:00
..
testdata refactor: filecollector into new package (#2174) 2024-01-30 00:46:45 +00:00
container_types.go feat: wait for services to be healthy before starting a job (#805) 2025-08-07 04:36:26 +00:00
docker_auth.go chore: to allow the runner to be imported, v9 needs to be in the go module (#777) 2025-07-31 10:35:11 +00:00
docker_build.go chore: to allow the runner to be imported, v9 needs to be in the go module (#777) 2025-07-31 10:35:11 +00:00
docker_cli.go chore: use the same .golangci.yml as the runner & gofumpt over gofmt (#206) 2025-07-28 12:26:41 +00:00
docker_cli_test.go chore: use the same .golangci.yml as the runner & gofumpt over gofmt (#206) 2025-07-28 12:26:41 +00:00
docker_images.go chore: use the same .golangci.yml as the runner & gofumpt over gofmt (#206) 2025-07-28 12:26:41 +00:00
docker_images_test.go chore(tests): add coverage for ./pkg/container (#201) 2025-07-26 16:37:12 +00:00
DOCKER_LICENSE fix: support docker create arguments from container.options (#1022) (#1351) 2022-10-06 22:09:43 +00:00
docker_logger.go Add support for NetBSD (#2023) 2024-01-08 19:26:03 +00:00
docker_network.go chore: to allow the runner to be imported, v9 needs to be in the go module (#777) 2025-07-31 10:35:11 +00:00
docker_pull.go chore: to allow the runner to be imported, v9 needs to be in the go module (#777) 2025-07-31 10:35:11 +00:00
docker_pull_test.go Improve logging (#1171) 2022-06-17 15:55:21 +00:00
docker_run.go feat: wait for services to be healthy before starting a job (#805) 2025-08-07 04:36:26 +00:00
docker_run_test.go feat: wait for services to be healthy before starting a job (#805) 2025-08-07 04:36:26 +00:00
docker_stub.go chore: to allow the runner to be imported, v9 needs to be in the go module (#777) 2025-07-31 10:35:11 +00:00
docker_volume.go chore: to allow the runner to be imported, v9 needs to be in the go module (#777) 2025-07-31 10:35:11 +00:00
executions_environment.go [FORGEJO] implement lxc separately from self-hosted 2024-03-11 15:30:55 +07:00
host_environment.go feat: wait for services to be healthy before starting a job (#805) 2025-08-07 04:36:26 +00:00
host_environment_test.go chore: use the same .golangci.yml as the runner & gofumpt over gofmt (#206) 2025-07-28 12:26:41 +00:00
linux_container_environment_extensions.go fix: allow overriding RUNNER_TOOL_CACHE from the config file (#178) 2025-07-13 21:55:02 +00:00
linux_container_environment_extensions_test.go feat: Host environment (#1293) 2022-11-16 21:29:45 +00:00
parse_env_file.go chore: to allow the runner to be imported, v9 needs to be in the go module (#777) 2025-07-31 10:35:11 +00:00
util.go chore: upgrade golangci-lint and address findings (#1904) 2023-07-10 17:12:12 -07:00
util_openbsd_mips64.go feat: Host environment (#1293) 2022-11-16 21:29:45 +00:00
util_plan9.go feat: Host environment (#1293) 2022-11-16 21:29:45 +00:00
util_windows.go feat: Host environment (#1293) 2022-11-16 21:29:45 +00:00