Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-31130

Reconcile component database from blob store task against Nuget hosted repo generates java.lang.IllegalArgumentException

Details

    Description

      SYMPTOM:

      Running the "Repair - Reconcile component database from blob store" task against New DB (PostgreSQL) and against a blob store which is used by Nuget hosted repositories generated the following ERROR:

      2022-02-07 21:29:35,391+1000 ERROR [quartz-11-thread-5] *SYSTEM com.sonatype.nexus.blobstore.restore.nuget.internal.NugetRestoreBlobStrategy - Error while restoring asset: blob store: default, repository: nuget-v3-hosted, path: /Test-2.0.1.1.nupkg, blob name: /Test-2.0.1.1.nupkg, blob id: 65a45bff-4035-4fd8-b9c2-94ff12e2956f
      java.lang.IllegalArgumentException: /Test-2.0.1.1.nupkg
       at com.sonatype.nexus.blobstore.restore.nuget.internal.NugetRestoreBlobStrategy.getPackageIdAndVersionFromPath(NugetRestoreBlobStrategy.java:156)
       at com.sonatype.nexus.blobstore.restore.nuget.internal.NugetRestoreBlobStrategy.createAssetFromBlob(NugetRestoreBlobStrategy.java:95)
       at org.sonatype.nexus.blobstore.restore.datastore.BaseRestoreBlobStrategy.restore(BaseRestoreBlobStrategy.java:115)
       at org.sonatype.nexus.blobstore.restore.datastore.RestoreMetadataTask.restore(RestoreMetadataTask.java:156)
       at org.sonatype.nexus.blobstore.restore.datastore.RestoreMetadataTask.execute(RestoreMetadataTask.java:115)
       at org.sonatype.nexus.blobstore.restore.datastore.RestoreMetadataTask.execute(RestoreMetadataTask.java:1)
       at org.sonatype.nexus.scheduling.TaskSupport.call(TaskSupport.java:100)
      ...
      

      REPRODUCE STEPS:

      1. Install NXRM 3.37.3 with OrientDB
      2. (optional) Create a Nuget hosted repository (nuget-hosted should be already existed)
      3. Upload a nuget file
        _NEXUS_BASE_URL="http://localhost:8081/"
        _REPO_NAME="nuget-hosted"
        curl -O -L 'https://globalcdn.nuget.org/packages/test.2.0.1.1.nupkg';
        curl -D- -u admin:admin123 "${_NEXUS_BASE_URL%/}/service/rest/v1/components?repository=${_REPO_NAME}" -F "nuget.asset=@./test.2.0.1.1.nupkg" -H "accept: application/json" -H "Content-Type: multipart/form-data";
        
      4. Run the DB migrator to migrate to PostgreSQL
      5. Disable " Cleanup unused nuget blobs from nexus"
      6. Delete the uploaded nupkg file from the Nuget Hosted repo
      7. Run the reconcile task against the correct blob store with "Restore blob metadata" option (only)

      Shortcut way:

      1. Instead of installing NXRM 3 with OrientDB, install NXRM 3 with PostgreSQL then
        mkdir -p ${workingDirectory%/}/blobs/default/content/vol-25/chap-05;
        cp -v 6db614c6-0307-46bd-b56a-00d2c8c12893.properties ${workingDirectory%/}/blobs/default/content/vol-25/chap-05/6db614c6-0307-46bd-b56a-00d2c8c12893.properties
        curl -o ${workingDirectory%/}/blobs/default/content/vol-25/chap-05/6db614c6-0307-46bd-b56a-00d2c8c12893.bytes -L 'https://globalcdn.nuget.org/packages/test.2.0.1.1.nupkg';
        
      2. Run the reconcile task

      EXPECTED BEHAVIOUR:

      I understand New DB does not support Nuget V2, however, as per NEXUS-30109, I expect restoring Nuget hosted (V2) from OrientDB to PostgreSQL should be supported.

      Reconcile component database from blob store task against Nuget hosted repo generates java.lang.IllegalArgumentException probably because NXRM3 + PostgreSQL does not support Nuget V2 type path (eg: either Test-2.0.1.1.nupkg or /Test-2.0.1.1.nupkg) but it expects "/{id}/{version}".

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              hosako Hajime Osako
              Vijay Swaminathan Vijay Swaminathan
              NXRM - Sentinels
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                tigCommentSecurity.panel-title