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

Ability to pull in rules from remote repos #122

Merged

Conversation

mkcomer
Copy link
Contributor

@mkcomer mkcomer commented Aug 5, 2021

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature & Docs Update w/ feature

What is the current behavior? (You can also link to an open issue here)
This PR adds functionality to pull in remote rules from urls - https.

To test this PR locally:
go build
go run main.go -c "https://raw.githubusercontent.com/get-woke/woke/main/example.yaml" --debug

To test a 404 URL:
go run main.go -c "https://raw.githubusercontent.com/get-woke/woke/main/example" --debug

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change? (What changes might users need to make due to this PR?)

Other information:

@codecov
Copy link

codecov bot commented Aug 5, 2021

Codecov Report

Merging #122 (09ec3e0) into main (953cec1) will decrease coverage by 0.63%.
The diff coverage is 81.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #122      +/-   ##
==========================================
- Coverage   95.90%   95.27%   -0.64%     
==========================================
  Files          21       22       +1     
  Lines         708      740      +32     
==========================================
+ Hits          679      705      +26     
- Misses         18       21       +3     
- Partials       11       14       +3     
Impacted Files Coverage Δ
pkg/config/config.go 91.11% <75.00%> (-5.91%) ⬇️
pkg/config/remote.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fadace1...09ec3e0. Read the comment docs.

pkg/config/config.go Outdated Show resolved Hide resolved
pkg/config/config.go Outdated Show resolved Hide resolved
pkg/config/config.go Outdated Show resolved Hide resolved
pkg/config/config.go Outdated Show resolved Hide resolved
pkg/config/config.go Outdated Show resolved Hide resolved
pkg/config/config_test.go Outdated Show resolved Hide resolved
pkg/config/config_test.go Show resolved Hide resolved
pkg/config/config_test.go Outdated Show resolved Hide resolved
pkg/config/config.go Outdated Show resolved Hide resolved
pkg/config/config.go Outdated Show resolved Hide resolved
@mkcomer
Copy link
Contributor Author

mkcomer commented Aug 10, 2021

I am merging in some updates which should resolve most of your above comments:

  • Moved isValidURL to remote.go and updated unit tests for specific naming
  • removed download functionality, rather a LoadRemoteConfig function that takes the body and unmarshalls the body to the config object
  • updated client := &http.Client{} and req, err := http.NewRequest(http.MethodGet, url, nil)

I would suggest an add on feature which allows you to set multiple remote configs, as I noticed that setting multiple local configs is not supported yet either.

Open to more feedback on this round of updates :)

pkg/config/config.go Outdated Show resolved Hide resolved
pkg/config/config.go Outdated Show resolved Hide resolved
pkg/config/config_test.go Outdated Show resolved Hide resolved
@caitlinelfring
Copy link
Member

I know there was a GitHub actions outage earlier today, which is probably why the PR checks didnt run. They should run the next time you push but I'll be on the lookout.

I'm hoping the codecov report is just out of date, but it looks like there's a dip in the coverage of pkg/config/config.go, I'd like to get that back up, if you can check if there are any uncovered lines once the PR check runs again.

@mkcomer mkcomer requested a review from caitlinelfring October 7, 2021 21:46
Copy link
Member

@caitlinelfring caitlinelfring left a comment

Choose a reason for hiding this comment

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

You also committed the compiled binary woke, it should be removed.

README.md Outdated Show resolved Hide resolved
docs/snippets/woke.md Outdated Show resolved Hide resolved
pkg/config/coverage.out Outdated Show resolved Hide resolved
pkg/config/config_test.go Show resolved Hide resolved
@mkcomer mkcomer requested a review from caitlinelfring October 8, 2021 14:39
@caitlinelfring caitlinelfring merged commit c5a39fe into get-woke:main Nov 4, 2021
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.

2 participants