I think this is similar to how I have feature branch jobs setup. If a dev checked in a branch called feature-test
to the circle
repo they can access the deploy at circle-feature-test.ci.example.com
. If that’s the kind of thing you need then maybe this will help.
I put the generated deploy URL into a the meta
block
meta {
hostname = "[[ $hostname ]]"
}
of the job as well as an haproxy
tag. I’m running HAProxy with consul-template and a stanza like the following to scrape all of the URLs and set up load balancing
[[- range services -]]
[[ if .Tags | contains "haproxy" -]]
[[- range $index, $name := service .Name -]]
[[ if eq $index 0 ]]
backend b_[[.Name]]
mode http
[[- /* server-template [[.Name]] 3 _[[.Name]]._tcp.service.consul resolvers consul resolve-opts allow-dup-ip resolve-prefer #ipv4 check */]]
[[- end ]]
server [[.Name]]-[[ $index ]] [[.Address]]:[[.Port]]
[[- end -]]
[[- end -]]
[[- end ]]
Our local DNS server returns the LB IP for any request to *.ci.example.com
Hope that helps!