-
Notifications
You must be signed in to change notification settings - Fork 63
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
Filter out repositories with .batchignore at root #509
Conversation
This implements https://github.com/sourcegraph/sourcegraph/issues/18330 in the simplest possible way by modifying all `repositoriesMatchingQuery` queries to have `-repohasfile:^.batchignore$` in them. Given my instance has the following repositories: - `github.com/sourcegraph-testing/zap` - `github.com/sourcegraph-testing/titan` - `github.com/sourcegraph-testing/tidb` - `github.com/sourcegraph-testing/etcd` - `github.com/sourcegraph-testing/batch-changes-testing-ignore` And I use the following batch spec: ```yaml on: - repositoriesMatchingQuery: repohasfile:README.md repo:sourcegraph-testing steps: - run: echo "a horse says 'hello'" >> README.md container: alpine:3 ``` with this change the `batch-changes-testing-ignore` repository will be ignored: - no archive will be downloaded - no steps executed It's simply filtered out of the search results. But I can manually add it: ```yaml on: - repositoriesMatchingQuery: repohasfile:README.md repo:sourcegraph-testing - repository: github.com/sourcegraph-testing/batch-changes-testing-ignore ```
Closing this for now, since I discussed this with @malomarrec on a Zoom call right now. Outcome: we don't want to exclude those repositories from the search results, because we want to print which repositories were ignored. See https://github.com/sourcegraph/sourcegraph/issues/18330#issuecomment-815752987 |
Turns out that the functionality we built for monorepo support — a method that returns the locations of a file in a list of repositories — can be used here: instead of adding a screenshot_2021-04-08_15.05.48.mp4 |
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.
This is surprisingly clean! A real testament to your design work when implementing the file matching in the first place, I think.
This would need documentation and a changelog, of course, but otherwise I think this is good to go.
Co-authored-by: Adam Harvey <aharvey@sourcegraph.com>
This implements https://github.com/sourcegraph/sourcegraph/issues/18330 by querying the locations of `.batchignore` files in each repository yielded by the `on` attribute in a batch spec. If locations were found, the repository is ignored. This can be overwritten by using the `-force-override-ignore` flag. Example: given my instance has the following repositories: - `github.com/sourcegraph-testing/zap` - `github.com/sourcegraph-testing/titan` - `github.com/sourcegraph-testing/tidb` - `github.com/sourcegraph-testing/etcd` - `github.com/sourcegraph-testing/batch-changes-testing-ignore` And I use the following batch spec: ```yaml on: - repositoriesMatchingQuery: repohasfile:README.md repo:sourcegraph-testing steps: - run: echo "a horse says 'hello'" >> README.md container: alpine:3 ``` with this change the `batch-changes-testing-ignore` repository will be ignored: - no archive will be downloaded - no steps executed A message is printed that says it's ignored.
This implements https://github.com/sourcegraph/sourcegraph/issues/18330 by querying the locations of
.batchignore
files in each repository yielded by theon
attribute in a batch spec. If locations were found, the repository is ignored.This can be overwritten by using the
-force-override-ignore
flag.Example: given my instance has the following repositories:
github.com/sourcegraph-testing/zap
github.com/sourcegraph-testing/titan
github.com/sourcegraph-testing/tidb
github.com/sourcegraph-testing/etcd
github.com/sourcegraph-testing/batch-changes-testing-ignore
And I use the following batch spec:
with this change the
batch-changes-testing-ignore
repository will be ignored:A message is printed that says it's ignored.