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

8614 regex replication filters #18723

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

WilfredAlmeida
Copy link
Contributor

This PR aims to add regular expression based replication rules feature to Harbor.

Issue: 8614
Community Proposal: 221

The filter functions for regex-based filtering are defined in the src/pkg/reg/filter/artifact.go file alongside the existing filtering functions using the double star logic.

Necessary schema properties are added in the policy.go file.

The decision on the finalized approach to add the feature is discussed in the community proposal 221

@codecov
Copy link

codecov bot commented May 23, 2023

Codecov Report

Attention: Patch coverage is 57.14286% with 60 lines in your changes are missing coverage. Please review.

Project coverage is 67.40%. Comparing base (a3e1b1e) to head (97d495e).
Report is 25 commits behind head on main.

❗ Current head 97d495e differs from pull request most recent head 3206245. Consider uploading reports for the commit 3206245 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #18723      +/-   ##
==========================================
- Coverage   67.45%   67.40%   -0.05%     
==========================================
  Files         996      993       -3     
  Lines      109773   109021     -752     
  Branches     2720     2763      +43     
==========================================
- Hits        74044    73490     -554     
+ Misses      31747    31574     -173     
+ Partials     3982     3957      -25     
Flag Coverage Δ
unittests 67.40% <57.14%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/portal/src/app/shared/entities/shared.const.ts 100.00% <ø> (ø)
src/pkg/reg/model/policy.go 38.46% <50.00%> (ø)
src/pkg/reg/filter/artifact.go 67.91% <75.00%> (+5.41%) ⬆️
...ion/create-edit-rule/create-edit-rule.component.ts 33.06% <2.94%> (-2.65%) ⬇️

... and 108 files with indirect coverage changes

@WilfredAlmeida
Copy link
Contributor Author

I am aware that there are print statements in the code. They are there for personal debugging reference and will be removed in the mergeable PR.

@OrlinVasilev OrlinVasilev added the release-note/new-feature New Harbor Feature label May 25, 2023
@WilfredAlmeida WilfredAlmeida marked this pull request as ready for review June 21, 2023 18:21
@WilfredAlmeida WilfredAlmeida requested a review from a team as a code owner June 21, 2023 18:21
@WilfredAlmeida
Copy link
Contributor Author

The latest commit edf8c20 removes some unnecessary and error causing Angular properties from the portal.

The properties are for radio input for choosing filter mode between regex & double star

@OrlinVasilev OrlinVasilev requested review from Vad1mo and wy65701436 July 3, 2023 08:40
@OrlinVasilev
Copy link
Member

@Vad1mo and @wy65701436 can you review this one please :)

@OrlinVasilev
Copy link
Member

@WilfredAlmeida please fix DCO

@WilfredAlmeida
Copy link
Contributor Author

I'll fix the DCO issue and update here.

@WilfredAlmeida WilfredAlmeida force-pushed the 8614-RegexReplicationFilters branch 2 times, most recently from b0294ad to 84630f1 Compare July 8, 2023 17:39
Copy link
Member

@Vad1mo Vad1mo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some tests seem to fail, and you are missing the DCO

@WilfredAlmeida
Copy link
Contributor Author

@Vad1mo @OrlinVasilev In between my commits, I synced my fork with the main repo. Now when I'm trying to fix DCO it's adding it to commits that are not mine.

My first commit was on May 10th and when I do a rebase its rewriting the commits of others as well.

Is there a way I can only add DCO to my commits?

Signed-off-by: Wilfred Almeida <[email protected]>
…lRegex for policy creation

Signed-off-by: Wilfred Almeida <[email protected]>
… creating replication filter rule for the following filter types - Double Star - Regular Expression

Signed-off-by: Wilfred Almeida <[email protected]>
…s. The translations for `zh-cn` and `zh-tw` are done using Google's Bard LLM. Rest all except English are done via Google Translate.

Signed-off-by: Wilfred Almeida <[email protected]>
Added display text translations for
"Filter Type".
Translations for `zh-cn` and `zh-tw` are done
using Google's Bard LLM.
Rest all except English are done via
Google Translate.

Signed-off-by: Wilfred Almeida <[email protected]>
Signed-off-by: Wilfred Almeida <[email protected]>
Signed-off-by: Wilfred Almeida <[email protected]>
…adio button is enabled. If yes then modify the filter type to be regex.

Signed-off-by: Wilfred Almeida <[email protected]>
…ar property tags from replication filters radio input

Signed-off-by: Wilfred Almeida <[email protected]>
@WilfredAlmeida WilfredAlmeida force-pushed the 8614-RegexReplicationFilters branch from 84630f1 to 03f0e55 Compare August 14, 2023 13:23
@WilfredAlmeida
Copy link
Contributor Author

@Vad1mo @OrlinVasilev I've fixed the DCO and other occurring issues. Please let me know if any more actions are required from my side.

@github-actions
Copy link

This PR is being marked stale due to a period of inactivty. If this PR is still relevant, please comment or remove the stale label. Otherwise, this PR will close in 30 days.

@github-actions github-actions bot added the Stale label Oct 18, 2023
@kristianhaukeland
Copy link

Still relevant

@github-actions github-actions bot removed the Stale label Oct 24, 2023
@OrlinVasilev OrlinVasilev added the never-stale Do not stale label Nov 22, 2023
@wy65701436
Copy link
Contributor

@WilfredAlmeida thanks for your contribution.

To support regex in Harbor, I propose creating a shared library of regex patterns, similar to the double star we currently use. This library would apply across all Harbor functionalities, including replication and tag retention, making it easier to enable consistent functionality for tag retention.

If you’re still willing to work on this pull request, @chlins and I will do our best to assist you from a technical perspective.

@WilfredAlmeida
Copy link
Contributor Author

Hello @wy65701436, currently I don't have the bandwidth to work this and won't be able to do so anytime soon

@wy65701436
Copy link
Contributor

Thanks, @WilfredAlmeida, for your response. Given this, I believe we can temporarily close this pull request until we have someone from the community who can assist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants