Skip to content

Commit 8e3de55

Browse files
authored
fix(contrib/artifactory): push build info retry (#6159)
Signed-off-by: francois samin <[email protected]>
1 parent 6e9168d commit 8e3de55

File tree

1 file changed

+11
-2
lines changed
  • contrib/integrations/artifactory/plugin-artifactory-build-info

1 file changed

+11
-2
lines changed

contrib/integrations/artifactory/plugin-artifactory-build-info/main.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,17 @@ func (e *artifactoryBuildInfoPlugin) Run(ctx context.Context, opts *integrationp
148148
return fail("unable to compute build info: %v", err)
149149
}
150150
buildInfoRequest.Modules = modules
151-
if _, err := artiClient.PublishBuildInfo(buildInfoRequest, artifactoryProjectKey); err != nil {
152-
return fail("unable to push build info: %v", err)
151+
var nbAttempts int
152+
for {
153+
nbAttempts++
154+
_, err := artiClient.PublishBuildInfo(buildInfoRequest, artifactoryProjectKey)
155+
if err == nil {
156+
break
157+
} else if nbAttempts >= 3 {
158+
return fail("unable to push build info: %v", err)
159+
} else {
160+
fmt.Printf("Error while pushing buildinfo %s %s. Retrying...\n", buildInfoName, version)
161+
}
153162
}
154163

155164
// Temporary code

0 commit comments

Comments
 (0)