As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Commit 2540bbf7 authored by Joseph Snyder's avatar Joseph Snyder
Browse files

Additional fixes to LFS updates

* Use retryablehttp functions
* Catch the result of the Body.Close calls
parent 66cb396d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -278,7 +278,7 @@ func (c *Client) Lock(path, refname string) (*Lock, error) {
}
jsonReader := bytes.NewReader(jsonData)
req, err := http.NewRequest(http.MethodPost, c.href+"/locks", jsonReader)
req, err := newHTTPRequest(http.MethodPost, c.href+"/locks", jsonReader)
if err != nil {
return nil, err
}
Loading
Loading
@@ -286,13 +286,13 @@ func (c *Client) Lock(path, refname string) (*Lock, error) {
req.Header.Set("Content-Type", "application/vnd.git-lfs+json")
req.Header.Set("Authorization", c.auth)
client := http.Client{}
client := newHTTPClient()
res, err := client.Do(req)
if err != nil {
return nil, err
}
defer res.Body.Close()
defer func() { _ = res.Body.Close() }()
switch {
case res.StatusCode >= 200 && res.StatusCode <= 299:
Loading
Loading
@@ -335,7 +335,7 @@ func (c *Client) Unlock(id string, force bool, refname string) (*Lock, error) {
}
jsonReader := bytes.NewReader(jsonData)
req, err := http.NewRequest(http.MethodPost, fmt.Sprintf("%s/locks/%s/unlock", c.href, id), jsonReader)
req, err := newHTTPRequest(http.MethodPost, fmt.Sprintf("%s/locks/%s/unlock", c.href, id), jsonReader)
if err != nil {
return nil, err
}
Loading
Loading
@@ -343,13 +343,13 @@ func (c *Client) Unlock(id string, force bool, refname string) (*Lock, error) {
req.Header.Set("Content-Type", "application/vnd.git-lfs+json")
req.Header.Set("Authorization", c.auth)
client := http.Client{}
client := newHTTPClient()
res, err := client.Do(req)
if err != nil {
return nil, err
}
defer res.Body.Close()
defer func() { _ = res.Body.Close() }()
switch {
case res.StatusCode >= 200 && res.StatusCode <= 299:
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment