Skip to content

Commit

Permalink
Add 'snyk-container' hook (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabasoad authored Nov 11, 2021
1 parent 22f220c commit 7a80e15
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
- id: pymarkdown
# Shell
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.7.2.1
rev: v0.8.0.1
hooks:
- id: shellcheck
# Other
Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
---
- id: snyk-container
name: Snyk Container
description: Runs 'snyk container test' command
entry: hooks/snyk-container.sh
language: script
pass_filenames: false

- id: snyk-iac
name: Snyk IaC
description: Runs 'snyk iac test' command
Expand Down
8 changes: 8 additions & 0 deletions hooks/snyk-container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -eu
SCRIPT_DIR="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)"
bash "${SCRIPT_DIR}"/_check-installation.sh
name=$(openssl rand -hex 4)
tag=$(openssl rand -hex 4)
docker build -t "${name}:${tag}" .
snyk container test "${name}:${tag}"

0 comments on commit 7a80e15

Please sign in to comment.