@@ -95,10 +95,11 @@ func findRemote(host string) (string, error) {
9595
9696 // Strip off any trailing :port number after the host name.
9797 host = strings .Split (host , ":" )[0 ]
98+ builderHost := getBuilderHostname (host )
9899
99100 for _ , line := range strings .Split (cmd , "\n " ) {
100101 for _ , remote := range strings .Split (line , " " ) {
101- if strings .Contains (remote , host ) {
102+ if strings .Contains (remote , host ) || strings . Contains ( remote , builderHost ) {
102103 return strings .Split (remote , "\t " )[1 ], nil
103104 }
104105 }
@@ -111,5 +112,12 @@ func findRemote(host string) (string, error) {
111112func RemoteURL (host , appID string ) string {
112113 // Strip off any trailing :port number after the host name.
113114 host = strings .Split (host , ":" )[0 ]
114- return fmt .Sprintf ("ssh://git@%s:2222/%s.git" , host , appID )
115+ return fmt .Sprintf ("ssh://git@%s:2222/%s.git" , getBuilderHostname (host ), appID )
116+ }
117+
118+ // getBuilderHostname derives the builder host name from the controller host name.
119+ func getBuilderHostname (host string ) string {
120+ hostTokens := strings .Split (host , "." )
121+ hostTokens [0 ] = fmt .Sprintf ("%s-builder" , hostTokens [0 ])
122+ return strings .Join (hostTokens , "." )
115123}
0 commit comments