File tree Expand file tree Collapse file tree 3 files changed +58
-0
lines changed Expand file tree Collapse file tree 3 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 7171 echo "Failed to install chosen syft version"
7272 exit 1
7373 fi
74+ install_grype :
75+ executor : core/node
76+ steps :
77+ - security/install_grype :
78+ version : v0.92.1
79+ - run :
80+ name : Validate installation
81+ command : |
82+ if ! grype --version | grep -q "0.92.1"; then
83+ echo "Failed to install chosen grype version"
84+ exit 1
85+ fi
7486
7587workflows :
7688 test-deploy :
@@ -115,6 +127,8 @@ workflows:
115127 filters : *filters
116128 - install_syft :
117129 filters : *filters
130+ - install_grype :
131+ filters : *filters
118132 - orb-tools/pack :
119133 filters : *release-filters
120134 - orb-tools/publish :
@@ -133,5 +147,6 @@ workflows:
133147 - analyze_code_full
134148 - install_trivy
135149 - install_syft
150+ - install_grype
136151 context : orb-publishing
137152 filters : *release-filters
Original file line number Diff line number Diff line change 1+ description : >
2+ Install Grype (https://github.com/anchore/grype) a vulnerability scanner for
3+ container images and filesystems.
4+
5+ parameters :
6+ version :
7+ type : string
8+ default : " "
9+ description : >
10+ Choose the specific version of Grype from https://github.com/anchore/grype/releases.
11+ By default, the latest version is picked.
12+
13+ steps :
14+ - run :
15+ name : Install Grype
16+ environment :
17+ PARAM_STR_VERSION : <<parameters.version>>
18+ command : <<include(scripts/install-grype.sh)>>
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ BASE_URL=" https://raw.githubusercontent.com/anchore/grype"
4+ INSTALL_SCRIPT_URL=" ${BASE_URL} /main/install.sh"
5+ GRYPE_DEST_DIR=" ${GRYPE_DEST_DIR:-/ usr/ local/ bin} "
6+
7+ function install_grype () {
8+ local script_args=(-b " ${GRYPE_DEST_DIR} " )
9+
10+ if [[ -n " ${PARAM_STR_VERSION} " ]]; then
11+ script_args+=(" ${PARAM_STR_VERSION} " )
12+ fi
13+
14+ set -x
15+ curl -sfL --retry 1 " ${INSTALL_SCRIPT_URL} " | sudo sh -s -- " ${script_args[@]} "
16+ set +x
17+
18+ echo " Installed grype ${PARAM_STR_VERSION:- latest} at ${GRYPE_DEST_DIR} "
19+ }
20+
21+ if ! command -v grype > /dev/null 2>&1 ; then
22+ echo " Failed to detect grype, installing..."
23+
24+ install_grype
25+ fi
You can’t perform that action at this time.
0 commit comments