Skip to content

Commit

Permalink
feat: run trivy security scanner during release (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
mefellows authored Feb 8, 2021
1 parent 0189aa2 commit 95cae86
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions script/release-workflow/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fi

${script_dir}/validate.sh
${script_dir}/docker-build.sh
${script_dir}/../scan.sh ${DOCKER_IMAGE_ORG_AND_NAME}:latest

if [ "${GITHUB_ACTIONS:-}" = "true" ]; then
bundle install
Expand Down
6 changes: 6 additions & 0 deletions script/scan-inside-docker-container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
set -eu

apt-get update -y && apt-get install -y wget
wget -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/master/contrib/install.sh | sh -s -- -b /usr/local/bin
trivy filesystem --exit-code 1 --quiet /
14 changes: 14 additions & 0 deletions script/scan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -eu

: "${1?Please provide the image to scan}"

SCRIPT_DIR=$(cd "$(dirname $0)"/.. && pwd)

docker run --rm \
-v ${PWD}/script/scan-inside-docker-container.sh:/pact_broker/scan-inside-docker-container.sh \
-u root \
--entrypoint /bin/sh \
"$1" \
/pact_broker/scan-inside-docker-container.sh

0 comments on commit 95cae86

Please sign in to comment.