File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -985,9 +985,19 @@ func (m *cleanupManager) protectRelativeStageDescSetByStageDesc(targetStageDesc
985
985
targetStageDescSet := image .NewStageDescSet ()
986
986
if targetStageDesc .Info .IsIndex {
987
987
for _ , platformImageInfo := range targetStageDesc .Info .Index {
988
- stageID := platformImageInfo .Tag
989
- if platformStageDesc := m .stageManager .GetStageDescByStageID (stageID ); platformStageDesc != nil {
990
- targetStageDescSet .Add (platformStageDesc )
988
+ platformImageDigest := platformImageInfo .GetDigest ()
989
+ if platformImageDigest == "" {
990
+ continue
991
+ }
992
+
993
+ // platformImageInfo.Tag cannot be used as a stage ID because it matches the index manifest tag,
994
+ // and the index manifest itself does not contain platform tag information.
995
+ for platformStageDesc := range m .stageManager .GetStageDescSet ().Iter () {
996
+ if platformStageDesc .Info .GetDigest () == platformImageDigest {
997
+ m .stageManager .MarkStageDescAsProtected (platformStageDesc , stage_manager .ProtectionReasonImageIndexPlatform , false )
998
+ targetStageDescSet .Add (platformStageDesc )
999
+ break
1000
+ }
991
1001
}
992
1002
}
993
1003
} else {
Original file line number Diff line number Diff line change 40
40
ProtectionReasonImportSource = newProtectionReason ("import source" )
41
41
ProtectionReasonDependencySource = newProtectionReason ("dependency source" )
42
42
ProtectionReasonAncestor = newProtectionReason ("ancestor" )
43
+ ProtectionReasonImageIndexPlatform = newProtectionReason ("image index platform" )
43
44
ProtectionReasonNotFoundInRepo = newProtectionReason ("not found in repo" )
44
45
)
45
46
You can’t perform that action at this time.
0 commit comments