prow/pjutil/tot.go
func GetBuildID(name, totURL string) (string, error) {
	if totURL == "" {
		return node.Generate().String(), nil
	}
	var err error
	url, err := url.Parse(totURL)
	if err != nil {
		return "", fmt.Errorf("invalid tot url: %v", err)
	}
	url.Path = path.Join(url.Path, "vend", name)
	sleepDuration := 100 * time.Millisecond
	for retries := 0; retries < 10; retries++ {
		if retries > 0 {
			sleep(sleepDuration)
			sleepDuration = sleepDuration * 2
		}
		var resp *http.Response
		resp, err = http.Get(url.String())
		if err != nil {
			continue
		}
		defer resp.Body.Close()
		if resp.StatusCode != 200 {
			err = fmt.Errorf("got unexpected response from tot: %v", resp.Status)
			continue
		}
		var buf []byte
		buf, err = ioutil.ReadAll(resp.Body)
		if err == nil {
			return string(buf), nil
		}
		return "", err
	}
	return "", err
}
func GetBuildID(name, totURL string) (string, error) {
	if totURL == "" {
		return node.Generate().String(), nil
	}
	var err error
	url, err := url.Parse(totURL)
	if err != nil {
		return "", fmt.Errorf("invalid tot url: %v", err)
	}
	url.Path = path.Join(url.Path, "vend", name)
	sleepDuration := 100 * time.Millisecond
	for retries := 0; retries < 10; retries++ {
		if retries > 0 {
			sleep(sleepDuration)
			sleepDuration = sleepDuration * 2
		}
		var resp *http.Response
		resp, err = http.Get(url.String())
		if err != nil {
			continue
		}
		defer resp.Body.Close()
		if resp.StatusCode != 200 {
			err = fmt.Errorf("got unexpected response from tot: %v", resp.Status)
			continue
		}
		var buf []byte
		buf, err = ioutil.ReadAll(resp.Body)
		if err == nil {
			return string(buf), nil
		}
		return "", err
	}
	return "", err
}
// GetBuildID calls out to `tot` in order
// to vend build identifier for the job