Exemple #1
0
func (c Cache) Rebuild(srcs []string, dst string) error {
	a, err := util.FromFilename(dst)

	if err != nil {
		return err
	}

	return rebuildCache(srcs, dst, c.s, a)
}
Exemple #2
0
func (c Cache) Restore(src string, fallback string) error {
	a, err := util.FromFilename(src)

	if err != nil {
		return err
	}

	err = restoreCache(src, c.s, a)

	if err != nil && fallback != "" && fallback != src {
		log.Warnf("Failed to retrieve %s, trying %s", src, fallback)
		err = restoreCache(fallback, c.s, a)
	}

	// Cache plugin should print an error but it should not return it
	// this is so the build continues even if the cache cant be restored
	if err != nil {
		log.Warnf("Cache could not be restored %s", err)
	}

	return nil
}