Add service container ID hostname when emulating links functionality

What does this MR do?

Adds the short 12-character service container ID as an additional alias when emulating links functionality.

Why was this MR needed?

Docker links used to provide this for us. GitLab-Runner not having it is a small edge case: typically, a job cannot use this ID to resolve with, because there isn't a mechanism we provide for getting the ID of a service. However, a service might "advertise" it's own hostname via some mechanism, which the job can then use (see #39177 (comment 2993957367)).

What's the best way to test this MR?

This MR includes a test that can determine the service ID of a container by it's entry in /etc/hosts. It will fetch the IP of the known service my_service, and then test of the aliases that point to that IP, ensuring that the service ID is now one of them.

What are the relevant issue numbers?

Relates to #39177 (closed)

Merge request reports

Loading