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 4747 - checkout
4848 - security/scan_dockerfile :
4949 dockerfile_dir : ./sample
50+ install_trivy :
51+ executor : core/node
52+ steps :
53+ - security/install_trivy :
54+ version : v0.59.1
55+ - run :
56+ name : Validate installation
57+ command : |
58+ if ! trivy --version | grep -q "0.59.1"; then
59+ echo "Failed to install chosen trivy version"
60+ exit 1
61+ fi
5062
5163workflows :
5264 test-deploy :
@@ -87,6 +99,8 @@ workflows:
8799 name : analyze_code_full
88100 rules : p/cwe-top-25
89101 filters : *filters
102+ - install_trivy :
103+ filters : *filters
90104 - orb-tools/pack :
91105 filters : *release-filters
92106 - orb-tools/publish :
@@ -103,5 +117,6 @@ workflows:
103117 - detect_secrets_git_base_revision
104118 - analyze_code_diff
105119 - analyze_code_full
120+ - install_trivy
106121 context : orb-publishing
107122 filters : *release-filters
Original file line number Diff line number Diff line change 1+ description : >
2+ Install Trivy (https://github.com/aquasecurity/trivy) all-in-one open source
3+ security scanner, optionally selecting the specific version.
4+
5+ parameters :
6+ version :
7+ type : string
8+ default : " "
9+ description : >
10+ Choose the specific version of Trivy from https://github.com/aquasecurity/trivy/releases.
11+ By default, the latest version is picked.
12+
13+ steps :
14+ - run :
15+ name : Install Trivy
16+ environment :
17+ PARAM_STR_VERSION : <<parameters.version>>
18+ command : <<include(scripts/install-trivy.sh)>>
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ BASE_URL=" https://raw.githubusercontent.com/aquasecurity/trivy"
4+ INSTALL_SCRIPT_URL=" ${BASE_URL} /main/contrib/install.sh"
5+ TRIVY_DEST_DIR=" ${TRIVY_DEST_DIR:-/ usr/ local/ bin} "
6+
7+ function install_trivy () {
8+ local script_args=(-b " ${TRIVY_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 trivy ${PARAM_STR_VERSION:- latest} at ${TRIVY_DEST_DIR} "
19+ }
20+
21+ if ! command -v trivy > /dev/null 2>&1 ; then
22+ echo " Failed to detect trivy, installing..."
23+
24+ install_trivy
25+ fi
You can’t perform that action at this time.
0 commit comments