refactor(server): Use package source specific cache keys
Use the PackageSource.CacheKey function introduced in the previous commit to determine the key at which a manifest should be cached in the local cache. Due to this change, manifests for moving target sources are no longer cached and the recency threshold logic has been removed.
This commit is contained in:
parent
980f5e2187
commit
051eb77b3d
2 changed files with 21 additions and 32 deletions
|
|
@ -110,7 +110,7 @@ func convenienceNames(packages []string) []string {
|
|||
// Call out to Nix and request that an image be built. Nix will, upon success,
|
||||
// return a manifest for the container image.
|
||||
func BuildImage(ctx *context.Context, cfg *config.Config, cache *BuildCache, image *Image, bucket *storage.BucketHandle) (*BuildResult, error) {
|
||||
resultFile, cached := cache.manifestFromCache(image)
|
||||
resultFile, cached := cache.manifestFromCache(cfg.Pkgs, image)
|
||||
|
||||
if !cached {
|
||||
packages, err := json.Marshal(image.Packages)
|
||||
|
|
@ -158,7 +158,7 @@ func BuildImage(ctx *context.Context, cfg *config.Config, cache *BuildCache, ima
|
|||
log.Println("Finished Nix image build")
|
||||
|
||||
resultFile = strings.TrimSpace(string(stdout))
|
||||
cache.cacheManifest(image, resultFile)
|
||||
cache.cacheManifest(cfg.Pkgs, image, resultFile)
|
||||
}
|
||||
|
||||
buildOutput, err := ioutil.ReadFile(resultFile)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue