使用gitlab时从服务中获取构建容器的名称-ci

Get the name of the build container from service when using gitlab-ci

我在 gitlab runner 中为每个构建使用网络。我的构建容器可以解析服务的别名,但是我不知道如何从服务容器中获取构建容器的ip地址。

test_grservice:
  stage: test
  image: opencpi18:5000/testservice
  script:
    - python3 test.py
  services:
    - name: opencpi18:5000/grservice
      alias: grservice
  tags:
    - hw

具体来说,我可以从构建容器中执行以下操作:

ping grservice

我应该在服务容器中输入什么来 ping 构建容器?

这个 link 声称我应该能够从服务中解析构建作业容器名称,但我不知道构建作业容器名称是什么:

https://docs.gitlab.com/runner/executors/docker.html

取自您提供的link:

The build container is resolvable via the build alias as well as it’s GitLab assigned hostname.

你试过了吗(即ping build)?