Skip to content

Conversation

ritankarsaha
Copy link
Contributor

Summary

This PR is only approx 1500+ lines long. The branch has been made from the phase 2 branch, will rebase from main once it's merged properly.

This PR is the phase 3 of the GSoC Project - "Improving Integration with Fossology"
Added Configurable Scan Options via the REST API

How To Test?

  • create a new release in a component and add an attachment to be sent to fossology for scanning from sw360
  • test via swagger the new api endpoints or via curl
curl -X 'POST' \
    'http://127.0.0.1:8080/resource/api/releases/efa697573244cd09746c38df6400bc19/triggerFossologyProcessWithOptions?markFossologyProcessOutdated=true' \
    -H 'accept: application/hal+json' \
    -H 'Authorization: Basic YWRtaW5Ac3czNjAub3JnOjEyMzQ1' \
    -H 'Content-Type: application/json' \
    -d '{
      "analysis": {
        "bucket": true,
        "copyrightEmailAuthor": true,
        "ecc": false,
        "ipra": false,
        "keyword": true,
        "mime": true,
        "monk": true,
        "nomos": true,
        "ojo": true,
        "pkgagent": false,
        "reso": false
      },
      "decider": {
        "nomosMonk": true,
        "bulkReused": true,
        "newScanner": false,
    }'} "reuseCopyright": true,
{
  "_links" : {
    "self" : {
      "href" : "http://127.0.0.1:8080/resource/api/releases/efa697573244cd09746c38df6400bc19/checkFossologyProcessStatus"
    }
  },
  "message" : "FOSSology Process with custom options for Release Id : efa697573244cd09746c38df6400bc19 has been triggered."
}
image
curl -X POST \
    'http://127.0.0.1:8080/resource/api/releases/efa697573244cd09746c38df64017d30/triggerFossologyProcessWithOptions?markFossologyProcessOutdated=true' \
    -H 'accept: application/hal+json' \
    -H 'Authorization: Basic YWRtaW5Ac3czNjAub3JnOjEyMzQ1' \
    -H 'Content-Type: application/json' \
    -d '{
      "analysis": {
        "monk": true,
        "nomos": true
      },
      "decider": {
        "nomosMonk": true
      },
      "reuse": {
        "reuseMain": true
      }
    }'
{
  "_links" : {
    "self" : {
      "href" : "http://127.0.0.1:8080/resource/api/releases/efa697573244cd09746c38df64017d30/checkFossologyProcessStatus"
    }
  },
  "message" : "FOSSology Process with custom options for Release Id : efa697573244cd09746c38df64017d30 has been triggered."
}
image
curl -X POST 'http://127.0.0.1:8080/resource/api/releases/efa697573244cd09746c38df6403d06e/triggerFossologyProcessWithOptions' \
    -H 'accept: application/hal+json' \
    -H 'Authorization: Basic YWRtaW5Ac3czNjAub3JnOjEyMzQ1' \
    -H 'Content-Type: application/json' \
    -d '{
      "analysis": {
        "bucket": true,
        "copyrightEmailAuthor": true,
        "ecc": true,
        "ipra": true,
        "keyword": true,
        "mime": true,
        "monk": true,
        "nomos": true,
        "ojo": true,
        "pkgagent": true,
        "reso": true
      },
      "decider": {
        "nomosMonk": true,
        "bulkReused": true,
        "newScanner": true,
    }'} "reuseCopyright": true
{
  "_links" : {
    "self" : {
      "href" : "http://127.0.0.1:8080/resource/api/releases/efa697573244cd09746c38df6403d06e/checkFossologyProcessStatus"
    }
  },
  "message" : "FOSSology Process with custom options for Release Id : efa697573244cd09746c38df6403d06e has been triggered."
}
image

The files get scanned only with the selected agents and then the report is getting generated as shown in the screenshots after firing the respective APIs.

Changelog

REST API Enhancements

  • New Endpoint: /api/releases/{id}/triggerFossologyProcessWithOptions - POST endpoint for triggering FOSSology scans with custom agent
    configurations
  • Request Model: ScanOptionsRequest class with comprehensive validation and default option management
  • Validation Framework: ScanOptionsValidator with comprehensive validation logic and meaningful error messages

Configurable Scan Options

  • Analysis Agents: Support for bucket, copyrightEmailAuthor, ecc, ipra, keyword, mime, monk, nomos, ojo, pkgagent, reso
  • Decider Agents: Support for nomosMonk, bulkReused, newScanner, ojoDecider
  • Reuse Options: Support for reuseMain, reuseEnhanced, reuseReport, reuseCopyright

Backend Integration

  • Thrift Interface: New ScanOptions struct and processWithScanOptions() service method
  • FOSSology Handler: Enhanced with custom scan options support throughout the workflow
  • REST Client: JSON payload construction for FOSSology v2 API with proper option mapping

Service Layer

  • Release Service: New executeFossologyProcessWithOptions() method with async processing
  • Option Conversion: Automatic conversion between REST and Thrift data models
  • Workflow Integration: Seamless integration with existing FOSSology process management

Issue:

Suggest Reviewer

@GMishx @amritkv @rudra-superrr

Checklist

Must:

  • All related issues are referenced in commit messages and in PR

@ritankarsaha
Copy link
Contributor Author

@GMishx The Phase 3 PR adds the Configurable Scan Options via REST API.

The build for this PR is correct and passing locally. However, since this branch was created from the Phase 2 branch, and Phase 2 currently has a failing build due to a test error, this PR’s build will also show as failing.
Once the Phase 2 test issue is resolved and this branch is rebased, the build status here will be corrected as well.

@ritankarsaha ritankarsaha force-pushed the feat/integration-with-fossology/phase-3/updates branch from 9daa1d5 to a4ef0b7 Compare August 29, 2025 16:59
@ritankarsaha ritankarsaha force-pushed the feat/integration-with-fossology/phase-3/updates branch from a4ef0b7 to a69da6e Compare August 29, 2025 19:25
@ritankarsaha
Copy link
Contributor Author

@GMishx this PR is ready to go in, properly tested and rebased from main.

@GMishx GMishx added needs code review needs special test Opposed to general testing, this requires dedicated check at some party's deployment labels Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs code review needs special test Opposed to general testing, this requires dedicated check at some party's deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants