DataDog / datadog-ci

Use Datadog from your CI.
https://datadoghq.com
Apache License 2.0
129 stars 55 forks source link

412 when submitting sbom #1439

Closed shm-eboks closed 2 months ago

shm-eboks commented 2 months ago

Bug description

./datadog-ci sbom upload --service xxx --env ci --debug sbom.json Processing file sbom.json File is a valid CycloneDX 1.5 file Uploading SBOM report in sbom.json ❌ Failed upload SBOM file [sbom.json]: Request failed with status code 412 API status code: 412

Describe what you expected

DD_API_KEY (is set and valid) DD_APP_KEY (is set valid and has code_analysis_read enabled) DD_SITE = datadoghq.eu

running datadog-ci version 2.42

running it currently locally AND from a non default branch azure devops pipeline

note: ado pipeline is running linux_amd64, locally i'm using darwin_arm64 - both are failing.

Steps to reproduce the issue

running this setup to install osv + ci binaries:

curl -L -o osv-scanner.zip https://github.com/DataDog/osv-scanner/releases/latest/download/osv-scanner_linux_amd64.zip
mkdir osv-scanner
unzip osv-scanner.zip -d ./osv-scanner

osv-scanner/osv-scanner --skip-git -r --experimental-only-packages --format=cyclonedx-1-5 --paths-relative-to-scan-dir  --output=sbom.json ./src

URL="https://github.com/DataDog/datadog-ci/releases/download/v2.42.0/datadog-ci_linux-x64"
OUTPUT="datadog-ci"
curl -L $URL -o $OUTPUT
chmod +x $OUTPUT
./datadog-ci sbom upload --service xxx --env ci --debug sbom.json

Additional context

No response

Command

None

dastrong commented 2 months ago

👋 @shm-eboks, since you're using Azure, your first upload must be from your git default branch. https://docs.datadoghq.com/code_analysis/troubleshooting#results-are-not-being-surfaced-in-the-datadog-ui

shm-eboks commented 2 months ago

i recommend you don't close this ticket yet - but be sure to instead of doing a catch-all error - you handle this error specifically and report that this is indeed the case in the cli.

i will try and do a run from the master branch and verify.