Skip to content

Commit

Permalink
mirror: retry publish if tarball is not valid (#1174)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroProfundis authored Mar 2, 2021
1 parent cd48569 commit fa61d0a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cmd/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,9 @@ func newMirrorPublishCmd() *cobra.Command {
goos, goarch, flagSet,
)
if err != nil {
// retry if the error is manifest too old
if err == repository.ErrManifestTooOld {
// retry if the error is manifest too old or validation failed
if err == repository.ErrManifestTooOld ||
strings.Contains(err.Error(), "INVALID TARBALL") {
fmt.Printf("server returned an error: %s, retry...\n", err)
if _, ferr := tarfile.Seek(0, 0); ferr != nil { // reset the reader
return ferr
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/operation/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func increaseScheduleLimit(ctx context.Context, pc *api.PDClient) (
newLimit = regionScheduleLimitThreshold
}
if err := pc.SetReplicationConfig("region-schedule-limit", newLimit); err != nil {
// try to revert leader scheduler limit by our best effort, does not make sence
// try to revert leader scheduler limit by our best effort, does not make sense
// to handle this error again
_ = pc.SetReplicationConfig("leader-schedule-limit", currLeaderScheduleLimit)
return currLeaderScheduleLimit, currRegionScheduleLimit, err
Expand Down
1 change: 1 addition & 0 deletions server/handler/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (h *componentSigner) sign(r *http.Request, m *v1manifest.RawManifest) (sr *
case model.ErrorWrongSignature:
return nil, ErrorForbiden
case model.ErrorWrongChecksum, model.ErrorWrongFileName:
log.Errorf("Publish component: %s", err.Error())
return nil, ErrorInvalidTarball
case nil:
return nil, nil
Expand Down

0 comments on commit fa61d0a

Please sign in to comment.