-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from rajatjindal/update
Updates to krew-release-bot
- Loading branch information
Showing
19 changed files
with
94 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.13.9 | ||
1.15.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package source | ||
|
||
// this is a very simplified version of https://github.com/hashicorp/go-retryablehttp | ||
// reason we pulled in here is because we use gock for testing this tool, and gock does | ||
// not work very well with go-retryablehttp as gock replaces transport required by go-retryablehttp | ||
|
||
import ( | ||
"io" | ||
"io/ioutil" | ||
"math" | ||
"net/http" | ||
"time" | ||
) | ||
|
||
const ( | ||
maxRetries = 4 | ||
retryWaitMin = 2 * time.Second | ||
retryWaitMax = 10 * time.Second | ||
) | ||
|
||
// getWithRetry is basically http.Get with retries | ||
// we cannot use RoundTripper as gock (lib we use for testing) | ||
// overrides the Transport and thus we cannot test our retryable transport | ||
func getWithRetry(uri string) (*http.Response, error) { | ||
var resp *http.Response | ||
var err error | ||
|
||
for i := 0; i < maxRetries; i++ { | ||
resp, err = http.Get(uri) | ||
shouldRetry := checkRetry(resp, err) | ||
if !shouldRetry { | ||
break | ||
} | ||
|
||
drainBody(resp.Body) | ||
wait := backoff(retryWaitMin, retryWaitMax, i) | ||
<-time.After(wait) | ||
} | ||
|
||
return resp, err | ||
} | ||
|
||
func checkRetry(resp *http.Response, err error) bool { | ||
return resp.StatusCode == http.StatusNotFound | ||
} | ||
|
||
func drainBody(b io.ReadCloser) { | ||
defer b.Close() | ||
io.Copy(ioutil.Discard, io.LimitReader(b, int64(4096))) | ||
} | ||
|
||
func backoff(min, max time.Duration, attemptNum int) time.Duration { | ||
mult := math.Pow(2, float64(attemptNum)) * float64(min) | ||
sleep := time.Duration(mult) | ||
if float64(sleep) != mult || sleep > max { | ||
sleep = max | ||
} | ||
return sleep | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#! /bin/bash | ||
|
||
VERSION=v0.0.38 | ||
VERSION=v0.0.39 | ||
docker run --rm -v `pwd`:/home/app rajatjindal/krew-release-bot:$VERSION krew-release-bot template |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.