Skip to main content


To test your hook locally, you may use the following makefile.

#!/usr/bin/make -f
include_guard = sethook = finding-post-processing
include ../../

See Local Deployment for examples how to use the Makefiles.

Available makefile targets#

clean-integration-testsResets the integration-tests namespace
unit-testsRun your hook unit tests
docker-buildBuilds your hook
docker-exportExports your hook into a .tar file
kind-importLoads your hook .tar files into your local kind cluster
deployDeploys your hook helm chart into your local kind cluster
deploy-test-depsDeploys your hook's test dependencies (demo-targets) into your local kind cluster
integration-testsDeletes all scans and runs your integration test scanners/SCANNER_NAME.test.js

Configuring your makefile (examples)#

Adding test dependencies (demo-targets)#

#!/usr/bin/make -f
include_guard = sethook = generic-webhook
include ../../

deploy-test-deps: deploy-test-dep-http-webhook deploy-test-dep-test-scan
deploy:    @echo ".: ๐Ÿ’พ Deploying '$(name)' $(hook-prefix) HelmChart with the docker tag '$(IMG_TAG)' into kind namespace 'integration-tests'."    helm -n integration-tests upgrade --install ro-hook . \        --set="$(IMG_NS)/$(hook-prefix)-$(name)" \        --set="hook.image.tag=$(IMG_TAG)" \        --set="webhookUrl=http://http-webhook/hallo-welt"
integration-tests:    @echo ".: ๐Ÿฉบ Starting integration test in kind namespace 'integration-tests'."    kubectl -n integration-tests delete scans --all    cd ../../tests/integration/ && npm ci &&    npx --yes --package jest@$(JEST_VERSION) jest --verbose --ci --colors --coverage --passWithNoTests generic/read-only-write-hook.test.js

This adds the http-webhook demo-target to your integration tests. deploy-test-dep-test-scan is a sample scanner used in most hook integration tests.

The above makefile also overrides the integration-test target such that it references the generic folder as a test suite.

Changing the unit test language#

#!/usr/bin/make -f
include_guard = sethook = persistence-defectdojo
include ../../
unit-tests:    @$(MAKE) -s unit-test-java

You can choose from: unit-test-js unit-test-py unit-test-java.