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

Use regular expressions in the blacklist for more convenient matching. #13

Closed
wants to merge 3 commits into from

Conversation

pieterlange
Copy link
Contributor

Resolves #10

Comments welcome.

@pieterlange
Copy link
Contributor Author

Currently lacks tests, but i'm happy to add those if you agree with this approach.

@ahakanbaba
Copy link
Contributor

The idea looks good to me.

Next time you rebase, you will see some merge conflicts.
We have added a whitelist option. We should have regex support on both file types.

I could see these tests cases in addition to many others you can add.

  1. regex is not valid,
  2. regex does not match any file.
  3. Regex has trailing whitespace ( we trim the whitespace )

The PR should also include documentation. Please extend the Readme accordingly.

Thanks for the hard work.

@pieterlange
Copy link
Contributor Author

Thanks for the feedback. I'll cleanup the PR, add support for regex'ing the whitelist and add test cases.

@pieterlange pieterlange force-pushed the feature/regexp-blacklist branch from 4191333 to e3d0cca Compare May 11, 2017 15:29
@pieterlange
Copy link
Contributor Author

Updated. This can probably be refactored but i'm not a big golang whiz. 😬

Tests will follow soon.

@pieterlange
Copy link
Contributor Author

pieterlange commented May 12, 2017

I don't have the time to figure out how to properly write tests for this feature. Would appreciate some help here. 😬 Sorry. But i also don't want to keep people waiting for this feature.

@ahakanbaba
Copy link
Contributor

HI @pieterlange,
tests are the most important aspect of adding new features.
Without working tests, a reviewer cannot eyeball the new implementation to ensure that it is working.

Golang has enormous amount of resources about unit test frameworks. This can be a starting point. https://golang.org/pkg/testing/

We would appreciate test coverage of the new added feature. I mentioned a starter list of tests here #13 (comment)

Copy link
Contributor

@ahakanbaba ahakanbaba left a comment

Choose a reason for hiding this comment

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

Please add unit tests.

}

// filter iterates through the list of all files in the repo and filters it
// down to a list of those that should be applied.
func filter(rawApplyList, blacklist, whitelist []string) []string {
blacklistMap := stringSliceToMap(blacklist)
whitelistMap := stringSliceToMap(whitelist)
//whitelistMap := stringSliceToMap(whitelist)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not leave commented out code in the commit.

@@ -28,28 +28,28 @@ func TestPurgeComments(t *testing.T) {
}{
// No comment
{
[]string{"/repo/a/b.json", "/repo/b/c", "/repo/a/b/c.yaml", "/repo/a/b/c", "/repo/c.json"},
[]string{"/repo/a/b.json", "/repo/b/c", "/repo/a/b/c.yaml", "/repo/a/b/c", "/repo/c.json"},
[]string{"a/b.json", "b/c", "a/b/c.yaml", "a/b/c", "c.json"},
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you change the repo prefix ?
What was the problem with it ?

@gregory-lyons gregory-lyons self-assigned this Mar 19, 2018
@jaxxstorm
Copy link

Is there any chance this will ever get merged?

@pieterlange
Copy link
Contributor Author

I moved away from apply workflows (in part due to https://www.youtube.com/watch?v=CW3ZuQy_YZw). And other reasons, like the RBAC management for kube-applier is a little bit hard to manage.

So i dont use this anymore.

brengarajalu pushed a commit to brengarajalu/kube-applier that referenced this pull request Mar 8, 2019
Start using a new kube-applier that can be executed by a non-root user
@claassistantio
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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

Successfully merging this pull request may close these issues.

Blacklist entire directories
5 participants