Skip to content

Commit

Permalink
feat: Save metadata last
Browse files Browse the repository at this point in the history
  • Loading branch information
zsolt-marta-bitrise committed Aug 6, 2024
1 parent fbf3999 commit 22ae8df
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
32 changes: 16 additions & 16 deletions cmd/saveXcodeDerivedDataFiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,22 @@ func saveXcodeDerivedDataFilesCmdFn(cacheMetadataPath, projectRoot, providedCach
return fmt.Errorf("checksum of metadata file: %w", err)
}

logger.TInfof("Uploading DerivedData files")
ddUploadStats, err := xcode.UploadCacheFilesToBuildCache(metadata.DerivedData, kvClient, logger)
if err != nil {
return fmt.Errorf("upload derived data files to build cache: %w", err)
}

ddUploadedT := time.Now()
tracker.LogDerivedDataUploaded(ddUploadedT.Sub(metadataSavedT), ddUploadStats)

if xcodeCachePath != "" {
logger.TInfof("Uploading Xcode cache files")
if _, err := xcode.UploadCacheFilesToBuildCache(metadata.XcodeCacheDir, kvClient, logger); err != nil {
return fmt.Errorf("upload xcode cache files to build cache: %w", err)
}
}

logger.TInfof("Uploading metadata checksum of %s (%s) for key %s", cacheMetadataPath, mdChecksum, cacheKey)
if err := xcode.UploadStreamToBuildCache(mdChecksumReader, cacheKey, mdChecksumReader.Size(), kvClient, logger); err != nil {
return fmt.Errorf("upload metadata checksum to build cache: %w", err)
Expand All @@ -150,21 +166,5 @@ func saveXcodeDerivedDataFilesCmdFn(cacheMetadataPath, projectRoot, providedCach
}
}

logger.TInfof("Uploading DerivedData files")
ddUploadStats, err := xcode.UploadCacheFilesToBuildCache(metadata.DerivedData, kvClient, logger)
if err != nil {
return fmt.Errorf("upload derived data files to build cache: %w", err)
}

ddUploadedT := time.Now()
tracker.LogDerivedDataUploaded(ddUploadedT.Sub(metadataSavedT), ddUploadStats)

if xcodeCachePath != "" {
logger.TInfof("Uploading Xcode cache files")
if _, err := xcode.UploadCacheFilesToBuildCache(metadata.XcodeCacheDir, kvClient, logger); err != nil {
return fmt.Errorf("upload xcode cache files to build cache: %w", err)
}
}

return nil
}
2 changes: 1 addition & 1 deletion internal/xcode/per_file_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func DownloadCacheFilesFromBuildCache(dd FileGroupInfo, kvClient *kv.Client, log

wg.Wait()

logger.TInfof("(i) Downloaded: %s", humanize.Bytes(uint64(stats.DownloadSize)))
logger.TInfof("(i) Downloaded: %d files (%s). Missing: %d files", stats.FilesDownloaded, humanize.Bytes(uint64(stats.DownloadSize)), stats.FilesMissing)

if stats.FilesFailedToDownload > 0 {
return DownloadFilesStats{}, fmt.Errorf("failed to download some files")
Expand Down

0 comments on commit 22ae8df

Please sign in to comment.