Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ jobs:
echo "Failed to install chosen syft version"
exit 1
fi
install_grype:
executor: core/node
steps:
- security/install_grype:
version: v0.92.1
- run:
name: Validate installation
command: |
if ! grype --version | grep -q "0.92.1"; then
echo "Failed to install chosen grype version"
exit 1
fi

workflows:
test-deploy:
Expand Down Expand Up @@ -115,6 +127,8 @@ workflows:
filters: *filters
- install_syft:
filters: *filters
- install_grype:
filters: *filters
- orb-tools/pack:
filters: *release-filters
- orb-tools/publish:
Expand All @@ -133,5 +147,6 @@ workflows:
- analyze_code_full
- install_trivy
- install_syft
- install_grype
context: orb-publishing
filters: *release-filters
18 changes: 18 additions & 0 deletions src/commands/install_grype.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
description: >
Install Grype (https://github.com/anchore/grype) a vulnerability scanner for
container images and filesystems.

parameters:
version:
type: string
default: ""
description: >
Choose the specific version of Grype from https://github.com/anchore/grype/releases.
By default, the latest version is picked.

steps:
- run:
name: Install Grype
environment:
PARAM_STR_VERSION: <<parameters.version>>
command: <<include(scripts/install-grype.sh)>>
25 changes: 25 additions & 0 deletions src/scripts/install-grype.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

BASE_URL="https://raw.githubusercontent.com/anchore/grype"
INSTALL_SCRIPT_URL="${BASE_URL}/main/install.sh"
GRYPE_DEST_DIR="${GRYPE_DEST_DIR:-/usr/local/bin}"

function install_grype () {
local script_args=(-b "${GRYPE_DEST_DIR}")

if [[ -n "${PARAM_STR_VERSION}" ]]; then
script_args+=("${PARAM_STR_VERSION}")
fi

set -x
curl -sfL --retry 1 "${INSTALL_SCRIPT_URL}" | sudo sh -s -- "${script_args[@]}"
set +x

echo "Installed grype ${PARAM_STR_VERSION:-latest} at ${GRYPE_DEST_DIR}"
}

if ! command -v grype >/dev/null 2>&1; then
echo "Failed to detect grype, installing..."

install_grype
fi