Add retries option to the clone step (#44)

* Add retries option to the clone step
Used to support https://github.com/drone/drone-git/pull/43
Will require a go mod update to add the arg to the manifest: https://github.com/drone/runner-go/pull/22

* Update `runner-go` to v1.12.0

* Add test
This commit is contained in:
Julien Duchesne
2022-06-09 11:14:11 -04:00
committed by GitHub
parent 218235e419
commit 65d05f2c6d
4 changed files with 14 additions and 6 deletions

View File

@@ -34,6 +34,9 @@ func cloneParams(src manifest.Clone) map[string]string {
if depth := src.Depth; depth > 0 {
dst["PLUGIN_DEPTH"] = strconv.Itoa(depth)
}
if retries := src.Retries; retries > 0 {
dst["PLUGIN_RETRIES"] = strconv.Itoa(retries)
}
if skipVerify := src.SkipVerify; skipVerify {
dst["GIT_SSL_NO_VERIFY"] = "true"
dst["PLUGIN_SKIP_VERIFY"] = "true"

View File

@@ -134,10 +134,17 @@ func TestCloneParams(t *testing.T) {
if len(params) != 0 {
t.Errorf("Expect zero depth ignored")
}
params = cloneParams(manifest.Clone{Depth: 50, SkipVerify: true})
params = cloneParams(manifest.Clone{Retries: 0})
if len(params) != 0 {
t.Errorf("Expect zero retries ignored")
}
params = cloneParams(manifest.Clone{Depth: 50, SkipVerify: true, Retries: 4})
if params["PLUGIN_DEPTH"] != "50" {
t.Errorf("Expect clone depth 50")
}
if params["PLUGIN_RETRIES"] != "4" {
t.Errorf("Expect clone retries 4")
}
if params["GIT_SSL_NO_VERIFY"] != "true" {
t.Errorf("Expect GIT_SSL_NO_VERIFY is true")
}