Skip to content

Commit d312f58

Browse files
committed
Update based on PR feedback
Signed-off-by: dkwon17 <dakwon@redhat.com>
1 parent f8e5d42 commit d312f58

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

project-clone/internal/git/setup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func doInitialGitClone(project *dw.Project) error {
6464
}
6565
}
6666
if cloneErr != nil {
67-
return fmt.Errorf("failed to clone project: %s", cloneErr)
67+
return fmt.Errorf("failed to clone project: %w", cloneErr)
6868
}
6969

7070
if project.Attributes.Exists(internal.ProjectSparseCheckout) {

project-clone/internal/global.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const (
3737
publicCertsDir = "/public-certs"
3838
cloneRetriesEnvVar = "PROJECT_CLONE_RETRIES"
3939
defaultCloneRetries = 3
40+
maxCloneRetries = 10
4041
BaseRetryDelay = 1 * time.Second
4142
)
4243

@@ -70,6 +71,9 @@ func init() {
7071
parsed, err := strconv.Atoi(val)
7172
if err != nil || parsed < 0 {
7273
log.Printf("Invalid value for %s: %q, using default (%d)", cloneRetriesEnvVar, val, defaultCloneRetries)
74+
} else if parsed > maxCloneRetries {
75+
log.Printf("Value for %s (%d) exceeds maximum (%d), using maximum", cloneRetriesEnvVar, parsed, maxCloneRetries)
76+
CloneRetries = maxCloneRetries
7377
} else {
7478
CloneRetries = parsed
7579
}

0 commit comments

Comments
 (0)