Plugins: Do not fail bootstrap stage if single decorate step fails (#73147)

* don't fail all if decorate step fails

* fix casing

* include err too

* cover pluginsintegration too
This commit is contained in:
Will Browne
2023-08-10 14:46:38 +02:00
committed by GitHub
parent 67de18ff06
commit c5e9a82ccb
19 changed files with 75 additions and 69 deletions
+6 -6
View File
@@ -43,7 +43,7 @@ func (c *Client) Download(_ context.Context, pluginZipURL, checksum string, comp
}
defer func() {
if err := os.Remove(tmpFile.Name()); err != nil {
c.log.Warn("Failed to remove temporary file", "file", tmpFile.Name(), "err", err)
c.log.Warn("Failed to remove temporary file", "file", tmpFile.Name(), "error", err)
}
}()
@@ -52,7 +52,7 @@ func (c *Client) Download(_ context.Context, pluginZipURL, checksum string, comp
err = c.downloadFile(tmpFile, pluginZipURL, checksum, compatOpts)
if err != nil {
if err := tmpFile.Close(); err != nil {
c.log.Warn("Failed to close file", "err", err)
c.log.Warn("Failed to close file", "error", err)
}
return nil, fmt.Errorf("failed to download plugin archive: %w", err)
}
@@ -81,7 +81,7 @@ func (c *Client) SendReq(url *url.URL, compatOpts CompatOpts) ([]byte, error) {
}
defer func() {
if err = bodyReader.Close(); err != nil {
c.log.Warn("Failed to close stream", "err", err)
c.log.Warn("Failed to close stream", "error", err)
}
}()
return io.ReadAll(bodyReader)
@@ -100,7 +100,7 @@ func (c *Client) downloadFile(tmpFile *os.File, pluginURL, checksum string, comp
}
defer func() {
if err := f.Close(); err != nil {
c.log.Warn("Failed to close file", "err", err)
c.log.Warn("Failed to close file", "error", err)
}
}()
_, err = io.Copy(tmpFile, f)
@@ -151,7 +151,7 @@ func (c *Client) downloadFile(tmpFile *os.File, pluginURL, checksum string, comp
}
defer func() {
if err := bodyReader.Close(); err != nil {
c.log.Warn("Failed to close body", "err", err)
c.log.Warn("Failed to close body", "error", err)
}
}()
@@ -209,7 +209,7 @@ func (c *Client) handleResp(res *http.Response, compatOpts CompatOpts) (io.ReadC
body, err := io.ReadAll(res.Body)
defer func() {
if err := res.Body.Close(); err != nil {
c.log.Warn("Failed to close response body", "err", err)
c.log.Warn("Failed to close response body", "error", err)
}
}()
if err != nil || len(body) == 0 {