Skip to content

Commit

Permalink
fix: panic when --cache-repo used
Browse files Browse the repository at this point in the history
Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
  • Loading branch information
distorhead committed May 16, 2022
1 parent c59f1f9 commit ec2ed93
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/container_backend/legacy_base_image.go
Expand Up @@ -57,6 +57,7 @@ func (i *legacyBaseImage) UnsetInfo() {

func (i *legacyBaseImage) SetStageDescription(stageDesc *image.StageDescription) {
i.stageDesc = stageDesc
i.SetInfo(stageDesc.Info)
}

func (i *legacyBaseImage) GetStageDescription() *image.StageDescription {
Expand Down
9 changes: 9 additions & 0 deletions pkg/storage/manager/storage_manager.go
Expand Up @@ -466,6 +466,15 @@ func (m *StorageManager) FetchStage(ctx context.Context, containerBackend contai
}
} else {
logboek.Context(ctx).Info().LogF("Cache repo image %s exists locally, will not perform fetch\n", stageImage.Name())

stageDesc, err := getStageDescription(ctx, m.ProjectName, *stageID, stagesStorage, nil, getStageDescriptionOptions{WithLocalManifestCache: true})
if err != nil {
return nil, fmt.Errorf("error getting stage %s description from %s: %w", stageID.String(), m.FinalStagesStorage.String(), err)
}
if stageDesc == nil {
return nil, ErrStageNotFound
}
stageImage.SetStageDescription(stageDesc)
}

if err := lrumeta.CommonLRUImagesCache.AccessImage(ctx, stageImage.Name()); err != nil {
Expand Down

0 comments on commit ec2ed93

Please sign in to comment.