Emulate deprecated Docker links functionality with ExtraHosts

What does this MR do?

Docker has further deprecated their links functionality.

Our containers, where network per build is not enabled, need to be able to contact each other. This functionality can be provided by using ExtraHosts that resolve to the service containers IP address.

Why was this MR needed?

Docker 29 further removes links support and this broke some customers job's when they upgraded.

What's the best way to test this MR?

Existing integration should should have this covered.

But you can also test it manually with:

job:
  image: golang
  services:
    - name: registry.gitlab.com/gitlab-org/ci-cd/tests/liveness:0.1.0-amd64-2acfbea1
      alias: whatever
      command:
        - 'server'
        - '--addr'
        - ':8333'
      variables:
        HEALTHCHECK_TCP_PORT: 8333
  script:
   - cat /etc/hosts
   - go install gitlab.com/gitlab-org/ci-cd/tests/liveness@latest
   - 'liveness client --header "X-Status: 404" --data "hello" "whatever:8333/?timeout=5s"'

What are the relevant issue numbers?

Closes #39129 (closed)

Closes #39100 (closed)

Edited by Arran Walker

Merge request reports

Loading