MCPcopy Index your code
hub / github.com/devspace-sh/devspace / GetLatestVersion

Function GetLatestVersion

pkg/util/git/helper.go:89–112  ·  view source on GitHub ↗
(repository string)

Source from the content-addressed store, hash-verified

87}
88
89func GetLatestVersion(repository string) (string, error) {
90 client := &http.Client{
91 CheckRedirect: func(req *http.Request, via []*http.Request) error {
92 return http.ErrUseLastResponse
93 },
94 }
95
96 resp, err := client.Get(repository + "/releases/latest")
97 if err != nil {
98 return "", err
99 }
100
101 redirect := resp.Header.Get("location")
102 if redirect == "" {
103 return "", fmt.Errorf("redirect URL not found")
104 }
105
106 matches := LatestTagRegEx.FindStringSubmatch(redirect)
107 if len(matches) != 2 {
108 return "", errors.Errorf("Couldn't find latest release version")
109 }
110
111 return matches[1], nil
112}

Callers 2

downloadFileFunction · 0.92

Calls 2

GetMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected