I'm trying to use cloud build with private pools to run builds on gitlab self hosted Instance. All are in same VPC, but I'm cloud build when triggered is not able to resolve the host of gitlab instance inspite of being in the same network.
Error: Unable to resolve the host "hostname"
Any suggestions or if you require any information please do tell.
Tried using cloud build private pool hosted in the same VPC.
You can use the following Terraform code to add or set up the DNS peering to make the DNS available to service producers.
## Uncomment this block after adding a valid DNS suffix
# resource "google_service_networking_peered_dns_domain" "default" {
# name = "example-com"
# network = google_compute_network.peering_network.name
# dns_suffix = "example.com."
# service = "servicenetworking.googleapis.com"
# }
With this, your private Cloud Build worker can use the private Cloud DNS zones and VM instances in service projects can use the private connection.
For Cloud Build Trigger, you can follow these steps:
steps:
- name: gcr.io/cloud-builders/git
args:
- '-c'
- |
apt-get update
apt-get install dnsutils -y
echo "dig test.example.com ..."
dig test.example.com
curl test.example.com
id: check private DNS zone and the private connection
entrypoint: bash
options:
workerPool: >-
projects/WORKERPOOL_PROJECT_ID/locations/REGION/workerPools/WORKERPOOL_ID
I hope it works!