Skip to content
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

Tag retention rules for multiple repos with slashes crashes the backend #20129

Closed
gboor opened this issue Mar 14, 2024 · 2 comments · Fixed by #20161
Closed

Tag retention rules for multiple repos with slashes crashes the backend #20129

gboor opened this issue Mar 14, 2024 · 2 comments · Fixed by #20161
Assignees
Labels
area/tag-retention Issues relating to the tag retention policies features kind/bug

Comments

@gboor
Copy link

gboor commented Mar 14, 2024

I found more references to this issue; #14510 and #14259 and #196, but those tickets are old and closed and it seems this issue was never actually resolved.

I am running Harbor 2.10.0 on Kubernetes and I have some retention policies in place that I want to run on all repos except 2 specific ones.

These repos have names like nsA/nsB/nsC/project1 and nsA/nsB/nsD/nsE/project2. If I add those as an excluding rule (as nsA/nsB/nsC/project1,nsA/nsB/nsD/nsE/project2), it saves just fine, but doing a run (dry or real) of the rule literally crashes the harbor-core container with the following message;

[ERROR] [/jobservice/logger/service.go:99]: failed to launch the retention jobs, err: launcher: syntax error in pattern
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x103b190]

goroutine 9686 [running]:
github.com/goharbor/harbor/src/controller/retention.(*defaultController).TriggerRetentionExec.func1()
	/harbor/src/controller/retention/controller.go:287 +0x570
created by github.com/goharbor/harbor/src/controller/retention.(*defaultController).TriggerRetentionExec in goroutine 230
	/harbor/src/controller/retention/controller.go:261 +0x2e5

It then takes half a minute to restart before things are running again.

I think it's pretty bad that a malformed rule can crash the backend like that, but apart from that, I also have no idea how to exclude these 2 repos from the policy...

Is there a syntax that works here at all? Or a workaround of some sort?

If someone can point me to the relevant function(s) in the source, I also don't mind having a look myself.

@chlins chlins self-assigned this Mar 18, 2024
@chlins chlins added kind/bug area/tag-retention Issues relating to the tag retention policies features labels Mar 18, 2024
@chlins
Copy link
Member

chlins commented Mar 18, 2024

@gboor The syntax error should not cause the backend to crash. This appears to be a bug that is addressed in #19533. We will rectify this issue promptly. Thank you for bringing it to our attention.

@gboor
Copy link
Author

gboor commented Mar 24, 2024

@chlins thanks for following up and good to hear that the crash is being resolved, but that doesn't fix my original problem; how do I phrase these rules so they work properly? Is it possible at all?

stonezdj added a commit to stonezdj/harbor that referenced this issue Mar 25, 2024
stonezdj added a commit to stonezdj/harbor that referenced this issue Mar 25, 2024
stonezdj added a commit to stonezdj/harbor that referenced this issue Mar 25, 2024
stonezdj added a commit to stonezdj/harbor that referenced this issue Mar 25, 2024
fixes goharbor#20129

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Mar 25, 2024
fixes goharbor#20129

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Mar 25, 2024
fixes goharbor#20129

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Mar 25, 2024
fixes goharbor#20129

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Mar 26, 2024
fixes goharbor#20129

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Mar 26, 2024
fixes goharbor#20129

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Mar 26, 2024
fixes goharbor#20129

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Mar 26, 2024
fixes goharbor#20129

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj added a commit that referenced this issue Mar 26, 2024
panic due to mark retention task error

fixes #20129

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj pushed a commit to stonezdj/harbor that referenced this issue Mar 26, 2024
fixes goharbor#20129

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj pushed a commit to stonezdj/harbor that referenced this issue Mar 26, 2024
fixes goharbor#20129

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj added a commit to stonezdj/harbor that referenced this issue Mar 26, 2024
fixes goharbor#20129

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj added a commit that referenced this issue Mar 26, 2024
panic due to mark retention task error

fixes #20129

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj added a commit that referenced this issue Mar 26, 2024
panic due to mark retention task error

fixes #20129

Signed-off-by: stonezdj <daojunz@vmware.com>
Co-authored-by: stonezdj <daojunz@vmware.com>
stonezdj added a commit that referenced this issue Mar 26, 2024
panic due to mark retention task error

fixes #20129

Signed-off-by: stonezdj <daojunz@vmware.com>
Co-authored-by: stonezdj <daojunz@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tag-retention Issues relating to the tag retention policies features kind/bug
Projects
None yet
2 participants