Skip to content

Try all specified TCP ports when doing a service container health-check

What does this MR do?

This MR tries all specified TCP ports when doing a service container health-check, instead of only the largest port.

Why was this MR needed?

Over in health-check port discovery should be consisten... (!3033 - merged) we changed the port used to do the health-check. At least with docker:dind images, this broke the service health-check, resulting in #29130 (closed). A good summary of how the change broke service container health-check is here

In the case where a service exposes more than one TCP port, we have no way of knowing on which port to do the health-check, so let's check them all.

Note that a proper fix would be something like Use health probes for docker service startup (#3984 - closed), but that is a big piece of work, and sufficient users are being impacted by gitlab-runner 15.1.0 regresses docker-in-docker... (#29130 - closed) that an interim solution is warranted.

What's the best way to test this MR?

Add a docker:dind service to a job, and to make sure this change hasn't broken other services, add them to the job too:

Click to expand
stages:
  - build

variables:
  POSTGRES_PASSWORD: password

build:
  stage: build
  services:
    - docker:dind
    - postgres:latest
    - redis:latest
  image: docker:stable
  script:
    - ping redis -w 1
    - ping postgres -w 1
    - docker info

Note that privileged = true will be required in the [runners.docker] config to enable the docker:dind container to start successfully.

What are the relevant issue numbers?

closes gitlab-runner 15.1.0 regresses docker-in-docker... (#29130 - closed)

Notes

  • Still working on tests Integration tests updated.
Edited by Axel von Bertoldi

Merge request reports