goharbor / harbor

An open source trusted cloud native registry project that stores, signs, and scans content.
https://goharbor.io
Apache License 2.0
23.7k stars 4.73k forks source link

create/update/delete of harbor image retention policy is not stable via api #20906

Open ramkrish12 opened 1 week ago

ramkrish12 commented 1 week ago

If you are reporting a problem, please make sure the following information are provided:

Expected behavior and actual behavior: image retention policy creation works fine through api. but when delete operation is performed via api, retention policies are not accessible either through command line or in UI.

we are getting "internal server error" in core logs and in UI. please share the image attached. harbor-create-retention-rule-UI-failure harbor-policy

expected behavior is that we are able to create/update/delete retention policy via api

Steps to reproduce the problem:

  1. create 1 or more retention rule using API,
  2. try deleting a retention rule.
  3. try accessing policy for a specific project in UI, later any policy create option either in command line or in the UI fails.

Versions: Please specify the versions of following systems.

Additional context: Harbor core logs

2024-09-06T09:16:45Z [ERROR] [/lib/http/error.go:57]: {"errors":[{"code":"UNKNOWN","message":"unknown: no such Retention policy with id 1"}]} 2024-09-06T09:17:50Z [INFO] [/server/middleware/security/robot.go:71][requestID="aacc7e0eac187a71c437112134a55a0b"]: a robot security context generated for request GET /service/token 2024-09-06T09:17:51Z [INFO] [/server/middleware/security/robot.go:71][requestID="bceb8fc9f25690178b2e8de28d4a7d10"]: a robot security context generated for request GET /service/token 2024-09-06T09:21:30Z [ERROR] [/lib/http/error.go:57]: {"errors":[{"code":"UNKNOWN","message":"unknown: no such Retention policy with id 1"}]} 2024-09-06T09:22:17Z [ERROR] [/lib/http/error.go:57]: {"errors":[{"code":"UNKNOWN","message":"unknown: no such Retention policy with id 1"}]}

wy65701436 commented 1 week ago

@ramkrish12 can you share the request for creation the retention api in the step 1?