File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # SPDX-License-Identifier: Apache-2.0
4+ #
5+ # http://nexb.com and https://github.com/aboutcode-org/scancode.io
6+ # The ScanCode.io software is licensed under the Apache License version 2.0.
7+ # Data generated with ScanCode.io is provided as-is without warranties.
8+ # ScanCode is a trademark of nexB Inc.
9+
10+ # Usage:
11+ # Scan current directory with default pipeline 'scan_codebase':
12+ # ./run-scan.sh
13+ #
14+ # Scan a specific directory with a custom pipeline:
15+ # ./run-scan.sh /path/to/scan/dir scan_single_package
16+ #
17+ # Scan a specific directory with multiple pipelines:
18+ # ./run-scan.sh /path/to/scan/dir "scan_codebase find_vulnerabilities"
19+
20+ set -e
21+
22+ # Use first argument as scan directory or default to current directory
23+ SCAN_DIR=" ${1:- $(pwd)} "
24+ # Use second argument as pipeline name or default to 'scan_codebase'
25+ PIPELINE=" ${2:- scan_codebase} "
26+ SCIO_DOCKER_IMAGE=" ghcr.io/aboutcode-org/scancode.io:latest"
27+ RESULTS_LOCATION=" results.json"
28+ ABS_RESULTS_PATH=" $( pwd) /$RESULTS_LOCATION "
29+
30+ # Run the pipeline
31+ docker run --rm \
32+ -v " $SCAN_DIR " :/codebase \
33+ " $SCIO_DOCKER_IMAGE " \
34+ run $PIPELINE /codebase \
35+ > " $RESULTS_LOCATION "
36+
37+ # Check if docker run succeeded
38+ if [ $? -eq 0 ]; then
39+ echo " ✅ Scan complete using pipeline '$PIPELINE '. Results saved to $ABS_RESULTS_PATH "
40+ else
41+ echo " ❌ Scan failed. Please check the error messages above."
42+ exit 1
43+ fi
You can’t perform that action at this time.
0 commit comments