Skip to content

IP address returned by the Runner's API is different from the one returned by a public API

Summary

The IP address reported by the Runner's API /runners/:id is different than the one reported by calling a third party API for reporting the caller's IP address such as http://api.ipify.org.

See to output of https://gitlab.com/sliaquat/shl-test-runner-ip-address/-/jobs/373613193 for an example.

  • From public API: 35.229.32.21
  • From Runner's API: 35.207.54.55

Steps to reproduce

Run this pipeline: https://gitlab.com/sliaquat/shl-test-runner-ip-address/pipelines

Example Project

https://gitlab.com/sliaquat/shl-test-runner-ip-address

What is the current bug behavior?

The IP address reported by the Runner's API does not match the one reported by calling a public API such as http://api.ipify.org from the runner.

What is the expected correct behavior?

The IP address reported by the Runner's API should match the one reported by calling a public API such as http://api.ipify.org from the runner.

Relevant logs and/or screenshots

See: https://gitlab.com/sliaquat/shl-test-runner-ip-address/-/jobs/373613193

41 $ ip=$(curl -s https://api.ipify.org)
42 $ echo "My public IP address is: $ip"
43 My public IP address is: 35.229.32.21
44 $ echo "CI_SERVER_HOST: $CI_SERVER_HOST"
45 CI_SERVER_HOST: gitlab.com
46 $ echo "CI_RUNNER_ID: $CI_RUNNER_ID"
47 CI_RUNNER_ID: 380987
48 $ ip_address=$(curl -s https://$CI_SERVER_HOST/api/v4/runners/$CI_RUNNER_ID?private_token=$CI_SERVER_PERSONAL_ACCESS_TOKEN | jq '.ip_address')
49 $ echo "ip_address from runner API is: $ip_address"
50 ip_address from runner API is: "35.207.54.55"
55 Job succeeded

Output of checks

This bug happens on GitLab.com

Edited by Sanad Liaquat