diff --git a/Jenkinsfile b/Jenkinsfile index bb613ae..8dccc31 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -77,7 +77,7 @@ pipeline { dotnet list package --vulnerable || true echo "=== OWASP Dependency-Check ===" - rm -rf depcheck + rm -rf depcheck dependency-check mkdir -p depcheck API="https://api.github.com/repos/jeremylong/DependencyCheck/releases/latest" @@ -85,7 +85,7 @@ pipeline { ASSET_URL=$(curl -fsSL "$API" | jq -r '.assets[]?.browser_download_url | select(test("release\\\\.zip$"))' | head -n1) echo "Downloading: $ASSET_URL" curl -fL --retry 3 --retry-all-errors -o depcheck.zip "$ASSET_URL" - unzip -q depcheck.zip -d dependency-check + unzip -oq depcheck.zip -d dependency-check DC_BIN="dependency-check/dependency-check/bin/dependency-check.sh" @@ -105,14 +105,20 @@ pipeline { always { archiveArtifacts artifacts: 'depcheck/**', allowEmptyArchive: true // ถ้ามี HTML Publisher plugin จะโชว์รายงานสวยขึ้น - publishHTML(target: [ - reportName: 'OWASP Dependency-Check', - reportDir: 'depcheck', - reportFiles: 'dependency-check-report.html', - keepAll: true, - alwaysLinkToLastBuild: true, - allowMissing: true - ]) + script { + try { + publishHTML(target: [ + reportName: 'OWASP Dependency-Check', + reportDir: 'depcheck', + reportFiles: 'dependency-check-report.html', + keepAll: true, + alwaysLinkToLastBuild: true, + allowMissing: true + ]) + } catch (Throwable e) { + echo "Skipping HTML report publish (plugin unavailable?): ${e.getClass().getSimpleName()}" + } + } } } }