Skip to main content

Integrating A New Hook

In the secureCodeBox we created new Custom Resource Definitions (CRD) for Kubernetes to manage scanners (ScanType) and hooks (see Custom Resource Definitions). To add a new Hook you need to add a new ScanCompletionHook (see ScanCompletionHook).

In the secureCodeBox we use Helm Charts for all our Resources to make the installation of new scanners/hooks as easy as possible and enable us to install only the scanners/hooks we actually need. The directory structure of a hook Helm Chart will look something like this:

โ”œโ”€โ”€ docsโ”‚ย ย  โ”œโ”€โ”€ README.ArtifactHub.mdโ”‚ย ย  โ””โ”€โ”€ README.DockerHub-Hook.mdโ”œโ”€โ”€ hookโ”‚ย ย  โ”œโ”€โ”€ Dockerfileโ”‚ย ย  โ”œโ”€โ”€ hook.jsโ”‚ย ย  โ”œโ”€โ”€ hook.test.jsโ”‚ย ย  โ”œโ”€โ”€ package.jsonโ”‚ย ย  โ”œโ”€โ”€ package-lock.jsonโ”‚ย ย  โ””โ”€โ”€ .dockerignoreโ”œโ”€โ”€ templatesโ”‚ย ย  โ”œโ”€โ”€ finding-post-processing-hook.yamlโ”‚ย ย  โ”œโ”€โ”€ _helpers.tplโ”‚ย ย  โ””โ”€โ”€ NOTES.txtโ”œโ”€โ”€ Chart.yamlโ”œโ”€โ”€ values.yamlโ”œโ”€โ”€ Makefileโ”œโ”€โ”€ README.mdโ”œโ”€โ”€ .helm-docs.gotmplโ”œโ”€โ”€ .helmignoreโ””โ”€โ”€ .gitignore

To create a new Helm Chart for your hook you can use the following command (replace new-hook with the name of the hook):

helm create new-hook

This command will create a new directory named new-hook and some template files provided by helm to simplify the creation of Helm Charts (see Helm | Getting Started).

The following pages describe the purpose of all files and how to configure them.