in repositories/gcs.go [170:202]
func (gcs *GCSRepo) GetCandidateVersions(bazeliskHome string) ([]string, error) {
history, err := getVersionHistoryFromGCS()
if err != nil {
return []string{}, err
}
if len(history) == 0 {
return []string{}, errors.New("could not find any Bazel versions")
}
// Find most recent directory that contains any release candidates.
// Typically it should be the last or second-to-last, depending on whether there are new rolling releases.
for pos := len(history) - 1; pos >= 0; pos-- {
// Append slash to match directories
bucket := fmt.Sprintf("%s/", history[pos])
rcPrefixes, _, err := listDirectoriesInReleaseBucket(bucket)
if err != nil {
return []string{}, fmt.Errorf("could not list release candidates for latest release: %v", err)
}
rcs := make([]string, 0)
for _, v := range getVersionsFromGCSPrefixes(rcPrefixes) {
// Remove full and rolling releases
if strings.Contains(v, "rc") {
rcs = append(rcs, v)
}
}
if len(rcs) > 0 {
return rcs, nil
}
}
return nil, nil
}