Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2093980

Summary: When delete the unwanted image only delete the manifest from registry , will leave the metadata
Product: OpenShift Container Platform Reporter: zhou ying <yinzhou>
Component: ocAssignee: Ross Peoples <rpeoples>
oc sub component: oc-mirror QA Contact: zhou ying <yinzhou>
Status: CLOSED WONTFIX Docs Contact:
Severity: medium    
Priority: medium CC: jpower, vdinh
Version: 4.11   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-01-17 10:56:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description zhou ying 2022-06-06 13:39:23 UTC
Description of problem:
When delete the unwanted image only delete the manifest from registry , will leave the metadata 

Version-Release number of selected component (if applicable):
oc-mirror version 
Client Version: version.Info{Major:"", Minor:"", GitVersion:"4.11.0-202206030929.p0.gb22233e.assembly.stream-b22233e", GitCommit:"b22233e611ab4692748ffc992a235abd9c231ecf", GitTreeState:"clean", BuildDate:"2022-06-03T10:12:00Z", GoVersion:"go1.18", Compiler:"gc", Platform:"linux/amd64"}


How reproducible:
Always

Steps to Reproduce:
1. Used following config to do the image mirror first time:
cat settingconfig.yaml 
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  registry:
    imageURL: localhost:5000/detest
    skipTLS: false
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.10
      packages:
        - name: vertical-pod-autoscaler
          channels:
            - name: stable

`oc-mirror --config settingconfig.yaml  docker://localhost:5000 --dest-use-http --continue-on-error -v 9`
2.  Update the config and do the second mirror :
cat settingconfig.yaml 
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  registry:
    imageURL: localhost:5000/detest
    skipTLS: false
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.10
      packages:
        - name: sriov-network-operator
          channels:
            - name: stable

`oc-mirror --config settingconfig.yaml  docker://localhost:5000 --dest-use-http --continue-on-error -v 9`



Actual results:
2.  Only delete the manifests for the image , the metadata still there :

……
Deleting manifest sha256:1f13f9453e97230fd3b20dd2d610ac9e9dabf6ff05a06ef90b99bd823967b336 from repo openshift4/ose-vertical-pod-autoscaler-operator-metadata
Deleting manifest sha256:2cea056feace888454b8da99b22545b2bc490ca18ce5216ba7a968aa2f4fcb0a from repo openshift4/ose-vertical-pod-autoscaler-rhel8
Deleting manifest sha256:c543094905b0cb817b0730df4b5a5797bfc7a6922d39449b2e4422faad8c6b32 from repo openshift4/ose-vertical-pod-autoscaler-rhel8-operator
……

Expected result:
2. Also delete the metadata at the same time.


Additional info:

Comment 1 Jennifer Power 2022-06-06 15:01:26 UTC
@yinzhou What metadata are you specifically referring to? Is it the manifest config?

Comment 2 zhou ying 2022-06-29 03:43:44 UTC
When do push , we could see logs:
Pushing metadata to registry at localhost:5000/detest:latest
Checking for existing metadata image at localhost:5000/detest:latest
looking for metadata file at "publish/.metadata.json"
Pushing metadata to registry at localhost:5000/oc-mirror:20cf460e-61ca-4d98-95c7-a5c21c8bac00



but when do the prune, only delete the manifest , did not delete the metadata .

Comment 3 zhou ying 2022-06-29 04:11:26 UTC
after first push :
[root@localhost oc-mirror]# tree .
.
├── _layers
│   └── sha256
│       ├── 197ced108dcfed686e6498e77595c9084c14d7245865ae1acc0d6584b418b623
│       │   └── link
│       └── 9990b2eb9a8f1b3280e9a1c736d3f4f7e6d7809374cb5ec6c17082003ec1d962
│           └── link
├── _manifests
│   ├── revisions
│   │   └── sha256
│   │       └── b618a0febd407e168f1ab7470faf08ee23b8e176f67dd336d2e9dfbfe78fa56c
│   │           └── link
│   └── tags
│       └── 99a6e0ac-8e07-4e0a-a8ac-937c82675f4f
│           ├── current
│           │   └── link
│           └── index
│               └── sha256
│                   └── b618a0febd407e168f1ab7470faf08ee23b8e176f67dd336d2e9dfbfe78fa56c
│                       └── link
└── _uploads
    └── 4a92bc47-7828-4208-9dc0-17103d2abda7
        └── hashstates
            └── sha256
                └── 0

18 directories, 6 files


after second push :
tree .
.
├── _layers
│   └── sha256
│       ├── 197ced108dcfed686e6498e77595c9084c14d7245865ae1acc0d6584b418b623
│       │   └── link
│       ├── 9990b2eb9a8f1b3280e9a1c736d3f4f7e6d7809374cb5ec6c17082003ec1d962
│       │   └── link
│       ├── d5589e3f4505eae9f5ba2a8bbeac779326550b69769a2973dfaf39999deed931
│       │   └── link
│       └── e5675bbd658321ec402912e2ac0eab64deb098566c55e0ff6043d1a7a816e761
│           └── link
├── _manifests
│   ├── revisions
│   │   └── sha256
│   │       ├── 163f9d0e2c21af12765eb8f47b9949f0577f12ac4e0dcd0325d191667f7a56b3
│   │       │   └── link
│   │       └── b618a0febd407e168f1ab7470faf08ee23b8e176f67dd336d2e9dfbfe78fa56c
│   │           └── link
│   └── tags
│       └── 99a6e0ac-8e07-4e0a-a8ac-937c82675f4f
│           ├── current
│           │   └── link
│           └── index
│               └── sha256
│                   ├── 163f9d0e2c21af12765eb8f47b9949f0577f12ac4e0dcd0325d191667f7a56b3
│                   │   └── link
│                   └── b618a0febd407e168f1ab7470faf08ee23b8e176f67dd336d2e9dfbfe78fa56c
│                       └── link
└── _uploads
    ├── 4a92bc47-7828-4208-9dc0-17103d2abda7
    │   └── hashstates
    │       └── sha256
    │           └── 0
    └── 5042f792-9102-49b1-98eb-3542179e057d
        └── hashstates
            └── sha256
                └── 0

25 directories, 11 files

we could see the  metadata of the first push still there.