-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add filtering by annotations on search #114
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
cmd/hypper/testdata/output/search-hypper-annotation-regexp.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- app_version: "" | ||
description: Chart for hypper | ||
name: testing/hypper | ||
version: 0.2.0 |
4 changes: 4 additions & 0 deletions
4
cmd/hypper/testdata/output/search-hypper-annotation-version-regexp.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- app_version: "" | ||
description: Chart for hypper | ||
name: testing/hypper | ||
version: 0.1.0 |
4 changes: 4 additions & 0 deletions
4
cmd/hypper/testdata/output/search-hypper-annotation-version.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- app_version: "" | ||
description: Chart for hypper | ||
name: testing/hypper | ||
version: 0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- app_version: "" | ||
description: Chart for hypper | ||
name: testing/hypper | ||
version: 0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- app_version: "" | ||
description: Chart for hypper | ||
name: testing/hypper | ||
version: 0.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
## Searching for charts in repos using annotations | ||
|
||
Apart from having the normal [search](docs/user/howto/search.md) in hypper, we support searching for specific annotations in a search. | ||
|
||
Using the `-a` flag in `hypper search repo` allows to filter the returned charts based on the KEY=VALUE values in annotations. | ||
|
||
```shell | ||
$ hypper search repo -a 'hypper.cattle.io/release-name=fleet' | ||
NAME CHART VERSION APP VERSION DESCRIPTION | ||
hypper/fleet 0.3.500 0.3.5 Fleet Manager - GitOps at Scale | ||
|
||
``` | ||
|
||
|
||
We also support the `--regexp` flag when using annotations, so you can search for the VALUE with a regexp | ||
|
||
```shell | ||
$ hypper search repo -a 'hypper.cattle.io/release-name=.*crd.*' --regexp | ||
NAME CHART VERSION APP VERSION DESCRIPTION | ||
hypper/fleet-crd 0.3.500 0.3.5 Fleet Manager CustomResourceDefinitions | ||
hypper/longhorn-crd 1.1.001 Installs the CRDs for longhorn. | ||
hypper/rancher-backup-crd 1.0.400 1.0.4 Installs the CRDs for rancher-backup. | ||
hypper/rancher-cis-benchmark-crd 1.0.301 Installs the CRDs for rancher-cis-benchmark. | ||
hypper/rancher-gatekeeper-crd 3.3.001 Installs the CRDs for rancher-gatekeeper. | ||
hypper/rancher-logging-crd 3.9.002 Installs the CRDs for rancher-logging. | ||
hypper/rancher-monitoring-crd 9.4.204 Installs the CRDs for rancher-monitoring. | ||
hypper/rancher-operator-crd 0.1.300 0.1.3 Rancher Operator CustomResourceDefinitions | ||
|
||
``` | ||
|
||
Of course the usual search flags also work in conjunction with annotations, so you can search for annotations *and* a specific version with he `--version` flag for example. | ||
|
||
|
||
Note: Currently you can pass more than one annotation to search for. This is currently an OR filter, so if any of the given annotation are found in a chart, it will match. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
Copyright Suse LLC. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// Package search | ||
/* Provides client-side repository searching | ||
|
||
Currently the helm search is implemented under the cmd dir which means that most | ||
of its options cant be used in a composite struct to build on top of them | ||
|
||
Our implementation but extracts it into a package so it can be reused and composed over | ||
|
||
|
||
Search supports building an in-memory search index based on the contents of | ||
multiple repositories, and then using string matching or regular expressions | ||
to find matches based on the name, version or annotations. | ||
*/ | ||
package search |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🤣 🤣 🤣 top!