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

[feat] Add VM Registry's freetext filter #28

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sysdig/backstage-plugin-sysdig",
"version": "1.3.2",
"version": "1.4.0",
"main": "dist/index.esm.js",
"types": "dist/index.d.ts",
"license": "Apache-2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
SYSDIG_REGISTRY_NAME_ANNOTATION,
SYSDIG_REGISTRY_VENDOR_ANNOTATION,
SYSDIG_REGISTRY_REPOSITORY_ANNOTATION,
SYSDIG_REGISTRY_FREETEXT_ANNOTATION,
SYSDIG_CUSTOM_FILTER_ANNOTATION,

// methods
Expand Down Expand Up @@ -131,6 +132,11 @@ export const SysdigVMRegistryFetchComponent = () => {
name = annotations[SYSDIG_REGISTRY_REPOSITORY_ANNOTATION]
filters.push('repository.name="' + name + '"');
}

if (SYSDIG_REGISTRY_FREETEXT_ANNOTATION in annotations) {
name = annotations[SYSDIG_REGISTRY_REPOSITORY_ANNOTATION]
filters.push('freeText in ("' + name + '")');
}

if (filters.length == 0) {
return []
Expand Down
10 changes: 10 additions & 0 deletions src/lib/annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,25 @@ export const SYSDIG_CONTAINER_ANNOTATION = "sysdigcloud.com/kubernetes-container
* Registry
*/

// DEPRECATION NOTICE: The following annotation is deprecated and will be removed in a future release.
// - Use SYSDIG_REGISTRY_FREETEXT_ANNOTATION instead.
// The registry name that will be included in the results. Example: "registry-harbor-registry.registry.svc.cluster.local:5443"
export const SYSDIG_REGISTRY_NAME_ANNOTATION = "sysdigcloud.com/registry-name";

// DEPRECATION NOTICE: The following annotation is deprecated and will be removed in a future release.
// - Use SYSDIG_REGISTRY_FREETEXT_ANNOTATION instead.
// The registry vendor that will be included in the results. Example: "harbor"
export const SYSDIG_REGISTRY_VENDOR_ANNOTATION = "sysdigcloud.com/registry-vendor";

// DEPRECATION NOTICE: The following annotation is deprecated and will be removed in a future release.
// - Use SYSDIG_REGISTRY_FREETEXT_ANNOTATION instead.
// The registry repository that will be included in the results. Example: "library/nginx"
export const SYSDIG_REGISTRY_REPOSITORY_ANNOTATION = "sysdigcloud.com/registry-repository";

// Free text search to match an image or set of images.
// Examples: "quay.io", "library/nginx", ":latest"
export const SYSDIG_REGISTRY_FREETEXT_ANNOTATION = "sysdigcloud.com/registry-freetext";

/*
* Pipeline
*/
Expand Down
1 change: 1 addition & 0 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export {
SYSDIG_REGISTRY_NAME_ANNOTATION,
SYSDIG_REGISTRY_VENDOR_ANNOTATION,
SYSDIG_REGISTRY_REPOSITORY_ANNOTATION,
SYSDIG_REGISTRY_FREETEXT_ANNOTATION,
SYSDIG_IMAGE_FREETEXT_ANNOTATION,
SYSDIG_CUSTOM_FILTER_ANNOTATION
} from './annotations'
Expand Down