Skip to content

Commit

Permalink
fix(build, cache-repo): fix "panic: runtime error: info must be set f…
Browse files Browse the repository at this point in the history
…or image"

Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
  • Loading branch information
alexey-igrychev committed Jun 26, 2024
1 parent a62eb83 commit 71e19bc
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions pkg/storage/manager/storage_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,21 +511,19 @@ func (m *StorageManager) FetchStage(ctx context.Context, containerBackend contai
}

prepareCacheStageAsPrimary := func(cacheImg container_backend.LegacyImageInterface, primaryStage stage.Interface) error {
stageID := primaryStage.GetStageImage().Image.GetStageDescription().StageID
primaryImg := primaryStage.GetStageImage().Image
stageID := primaryImg.GetStageDescription().StageID
primaryImageName := m.StagesStorage.ConstructStageImageName(m.ProjectName, stageID.Digest, stageID.UniqueID)

// TODO(buildah): check no bugs introduced by removing of following calls
// if err := containerBackend.RenameImage(ctx, cacheDockerImage, primaryImageName, false); err != nil {
// return fmt.Errorf("unable to rename image %s to %s: %w", fetchedDockerImage.Image.Name(), primaryImageName, err)
// }
if err := containerBackend.RenameImage(ctx, cacheImg, primaryImageName, true); err != nil {
return fmt.Errorf("unable to rename image %s to %s: %w", cacheImg.Name(), primaryImageName, err)
}

// if err := containerBackend.RefreshImageObject(ctx, &container_backend.Image{Image: primaryStage.GetImage()}); err != nil {
// return fmt.Errorf("unable to refresh stage image %s: %w", primaryStage.GetImage().Name(), err)
// }
if err := containerBackend.RefreshImageObject(ctx, primaryImg); err != nil {
return fmt.Errorf("unable to refresh stage image %s: %w", primaryImageName, err)
}

// TODO(buildah): check no bugs introduced by removing of following calls
// if err := storeStageDescriptionIntoLocalManifestCache(ctx, m.ProjectName, *stageID, m.StagesStorage, ConvertStageDescriptionForStagesStorage(cacheDockerImage.Image.GetStageDescription(), m.StagesStorage)); err != nil {
if err := storeStageDescriptionIntoLocalManifestCache(ctx, m.ProjectName, *stageID, m.StagesStorage, cacheImg.GetStageDescription()); err != nil {
if err := storeStageDescriptionIntoLocalManifestCache(ctx, m.ProjectName, *stageID, m.StagesStorage, primaryImg.GetStageDescription()); err != nil {
return fmt.Errorf("error storing stage %s description into local manifest cache: %w", primaryImageName, err)
}

Expand Down

0 comments on commit 71e19bc

Please sign in to comment.