Handle broken cache manifest
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
parent
d26b288cde
commit
657b562f31
|
@ -91,9 +91,7 @@ func Download(ctx context.Context, opts Options) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
m, err := getManifest(cacheDir)
|
m, err := getManifest(cacheDir)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
return err
|
|
||||||
}
|
|
||||||
t = m.Type
|
t = m.Type
|
||||||
|
|
||||||
dest := filepath.Join(opts.Destination, m.Name)
|
dest := filepath.Join(opts.Destination, m.Name)
|
||||||
|
@ -108,6 +106,15 @@ func Download(ctx context.Context, opts Options) (err error) {
|
||||||
} else if ok {
|
} else if ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// If we cannot read the manifest,
|
||||||
|
// this cache entry is invalid and
|
||||||
|
// the source must be re-downloaded.
|
||||||
|
err = os.RemoveAll(cacheDir)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Downloading source").Str("source", opts.Name).Str("downloader", d.Name()).Send()
|
log.Info("Downloading source").Str("source", opts.Name).Str("downloader", d.Name()).Send()
|
||||||
|
|
Loading…
Reference in New Issue