Skip to content

Commit efeef3b

Browse files
authored
Update module.yaml
Signed-off-by: stlef14 <stlef14@users.noreply.github.com>
1 parent 81b6371 commit efeef3b

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

scanners/boostsecurityio/trivy-sbom/module.yaml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ steps:
3131
- scan:
3232
command:
3333
run: |
34-
set -euo
34+
set -eu # fail on errors, but ignore unset vars in our loops
3535
36-
# Ensure Packages.props exists
36+
# Ensure Directory.Packages.props exists
3737
if [ ! -f "Directory.Packages.props" ]; then
3838
cat > Directory.Packages.props <<'EOF'
3939
<Project>
@@ -53,11 +53,8 @@ steps:
5353
5454
# Check which projects can be restored
5555
for proj in $PROJECTS; do
56-
echo "Checking project: $proj"
5756
if dotnet restore "$proj" --ignore-failed-sources --no-cache > /dev/null 2>&1; then
5857
echo "$proj" >> "$VALID_PROJECTS"
59-
else
60-
echo "⚠️ Skipping unbuildable project: $proj"
6158
fi
6259
done
6360
@@ -68,21 +65,22 @@ steps:
6865
6966
rm "$VALID_PROJECTS"
7067
71-
# Restore all valid projects for CycloneDX
68+
# Restore valid projects (ignore errors)
7269
dotnet restore temp.sln --ignore-failed-sources --no-cache > /dev/null 2>&1 || true
7370
74-
# Generate SBOM
75-
$SETUP_PATH/scan-tools/.dotnet-tools/dotnet-CycloneDX $(pwd)/temp.sln \
76-
--disable-package-restore --output temp_sbom.json --output-format json > /dev/null 2>&1
77-
78-
# Check for output
79-
if [ -f "temp_sbom.json/bom.json" ]; then
80-
cat temp_sbom.json/bom.json
71+
# Generate SBOM, only stdout is the BOM
72+
if $SETUP_PATH/scan-tools/.dotnet-tools/dotnet-CycloneDX $(pwd)/temp.sln \
73+
--disable-package-restore --output temp_sbom.json --output-format json > /dev/null 2>&1; then
74+
if [ -f "temp_sbom.json/bom.json" ]; then
75+
cat temp_sbom.json/bom.json
76+
else
77+
# SBOM file missing but no fatal error
78+
echo "{}"
79+
fi
8180
else
82-
echo "⚠️ CycloneDX failed or produced no output."
83-
exit 1
81+
# CycloneDX failed but do not output logs, just empty JSON
82+
echo "{}"
8483
fi
8584
86-
8785
format: cyclonedx
8886

0 commit comments

Comments
 (0)