Skip to content

Commit

Permalink
Merge pull request #12 from sysdiglabs/dev-registry-repo-ann
Browse files Browse the repository at this point in the history
Add Registry Repository annotation
  • Loading branch information
Jujuyeh committed Jun 19, 2024
2 parents 7b4b95f + 438d3c2 commit 438c518
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
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.2.0",
"version": "1.3.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 @@ -23,6 +23,7 @@ import {
// annotations
SYSDIG_REGISTRY_NAME_ANNOTATION,
SYSDIG_REGISTRY_VENDOR_ANNOTATION,
SYSDIG_REGISTRY_REPOSITORY_ANNOTATION,
SYSDIG_CUSTOM_FILTER_ANNOTATION,

// methods
Expand All @@ -32,8 +33,7 @@ import {
API_PROXY_BASE_PATH,
API_VULN_REGISTRY,
getBacklink
} from '../../lib'

} from '../../lib';

type RegistryScan = {
mainAssetName: string,
Expand Down Expand Up @@ -129,6 +129,11 @@ export const SysdigVMRegistryFetchComponent = () => {
name = annotations[SYSDIG_REGISTRY_VENDOR_ANNOTATION]
filters.push('registry.vendor="' + name + '"');
}

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

if (filters.length == 0) {
return []
Expand Down
3 changes: 3 additions & 0 deletions src/lib/annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ export const SYSDIG_REGISTRY_NAME_ANNOTATION = "sysdigcloud.com/registry-name";
// The registry vendor that will be included in the results. Example: "harbor"
export const SYSDIG_REGISTRY_VENDOR_ANNOTATION = "sysdigcloud.com/registry-vendor";

// The registry repository that will be included in the results. Example: "library/nginx"
export const SYSDIG_REGISTRY_REPOSITORY_ANNOTATION = "sysdigcloud.com/registry-repository";

/*
* Pipeline
*/
Expand Down
3 changes: 2 additions & 1 deletion src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export {
SYSDIG_WORKLOAD_TYPE_ANNOTATION,
SYSDIG_CONTAINER_ANNOTATION,
SYSDIG_REGISTRY_NAME_ANNOTATION,
SYSDIG_REGISTRY_VENDOR_ANNOTATION,
SYSDIG_REGISTRY_VENDOR_ANNOTATION,
SYSDIG_REGISTRY_REPOSITORY_ANNOTATION,
SYSDIG_IMAGE_FREETEXT_ANNOTATION,
SYSDIG_CUSTOM_FILTER_ANNOTATION
} from './annotations'
Expand Down

0 comments on commit 438c518

Please # to comment.