-
Notifications
You must be signed in to change notification settings - Fork 90
feat: Added retention command #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: ALTHAF <[email protected]>
Signed-off-by: ALTHAF <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
…nges-pr Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
rizul@rizu:~/OSS/harbor-cli$ ./harbor-cli tag retention create
INFO[0036] Added Tag Retention Rule rizul@rizu:~/OSS/harbor-cli$ ./harbor-cli tag retention list --project-name asdfghj
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ID Action Disabled Params Priority Scope Selectors Tag Selectors Template │
│ ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │
│ 0 retain false latestPushedK: 2, 0 repository: [{repoMatches **}] &{matches {"untagged":true} **} latestPushedK │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ rizul@rizu:~/OSS/harbor-cli$ ./harbor-cli tag retention delete
INFO[0010] retention rule deleted successfully
INFO[0010] Retention Policy deleted successfully all 3 are happening smoothly |
BUG: Inconsistent behavior from Harbor API after deleting a retention policy.
This is error from harbor API side I think. |
Signed-off-by: Rizul Gupta <[email protected]>
this seems to be a problem with upstream Harbor. I suggest creating an issue there explaining the problem and referencing it here. |
Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
retention
command
fb007fb
to
a830729
Compare
Signed-off-by: Rizul Gupta <[email protected]> fix lint issues Signed-off-by: Rizul Gupta <[email protected]> lint errors fix Signed-off-by: Rizul Gupta <[email protected]> minor fixes Signed-off-by: Rizul Gupta <[email protected]> uncomment login test Signed-off-by: Rizul Gupta <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rizul2108 do we currently have a workaround for the tag deletion issue: goharbor/harbor#21783
No currently not should I add that ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retention tag delete fails. because of the problem with harbor. for now we should do workaround as in UI.
Currently in the UI, there's only an option to delete a single rule at a time — not the entire tag retention policy for a project. Given this, should we update the CLI |
@bupd is this approach correct can I move forward with this ? |
Sure go ahead |
Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
Screencast.from.09-04-25.01.22.53.PM.IST.webm |
@bupd @Vad1mo As a workaround, we're forced to pass the entire rule object between functions to delete a specific rule, rather than using a simple ID. While this approach works, it feels like a poor and error-prone design. This seems like a design oversight on Harbor's side. Below is the JSON data that is being rendered in the above image. {
"algorithm": "or",
"id": 132,
"rules": [
{
"action": "retain",
"params": {
"latestPushedK": 10
},
"scope_selectors": {
"repository": [
{
"decoration": "repoMatches",
"pattern": "**"
}
]
},
"tag_selectors": [
{
"decoration": "matches",
"extras": "{\"untagged\":true}",
"pattern": "**"
}
],
"template": "latestPushedK"
},
{
"action": "retain",
"params": {
"nDaysSinceLastPush": 3
},
"scope_selectors": {
"repository": [
{
"decoration": "repoMatches",
"kind": "doublestar",
"pattern": "**"
}
]
},
"tag_selectors": [
{
"decoration": "matches",
"extras": "{\"untagged\":true}",
"kind": "doublestar",
"pattern": "**"
}
],
"template": "nDaysSinceLastPush"
}
],
"scope": {
"level": "project",
"ref": 1532
},
"trigger": {
"kind": "Schedule",
"settings": {
"cron": ""
}
}
} |
Signed-off-by: Rizul Gupta <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
retention
command
Description
Fixes #183
This PR continues the work started by @Althaf66 in #184.
Changes and Fixes:
Incorporating changes suggested by @bupd
Related Issue: goharbor/harbor#21783