Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n3dr doesnt upload a whole version if a custom classifier (e.g.:*-jar-with-dependencies.jar) is present as artifact #661

Open
kaerbr opened this issue Oct 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@kaerbr
Copy link

kaerbr commented Oct 2, 2024

What happened:
I have two local nexus3 instances running using docker/podman:

  • podman run --rm -it -p 8080:8081 --name nexus-old sonatype/nexus3:3.72.0
  • podman run --rm -it -p 8081:8081 --name nexus-new sonatype/nexus3:3.72.0

I have created an simple maven demo project: demo.zip
As distributionManagement in my pom I've added the following:

<distributionManagement>
    <repository>
        <id>releases</id>
        <url>http://localhost:8080/repository/maven-releases/</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <url>http://localhost:8080/repository/maven-snapshots/</url>
    </snapshotRepository>
</distributionManagement>

I have run a mvn clean deploy with 1.0.0 as Version.
For Version 2.0.0 I've added the maven-assembly-plugin to add a artifact which contains all dependencies (custom classifier).

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>3.7.1</version>
      <executions>
        <execution>
          <phase>package</phase>
          <goals>
            <goal>single</goal>
          </goals>
        </execution>
      </executions>
      <configuration>
        <archive>
          <manifest>
            <addClasspath>true</addClasspath>
            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            <mainClass/>
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
    </plugin>
  </plugins>
</build>

This (correctly) resulted in:
grafik

The next step was to backup the nexus-old instance using: n3dr repositoriesV2 --backup --directory-prefix ./backup -n localhost:8080 -u admin -p admin --https=false which (correctly) resulted in:
grafik

The next step was to restore/upload the backupped files/artifatcs to the nexus-new instance using: n3dr repositoriesV2 --upload --directory-prefix ./backup -n localhost:8081 -u admin -p admin --https=false. The command ran without any errors:

Log with --logLevel debug

INFO[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:84 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).reposOnDisk() found the following localDiskRepos: '[maven-central maven-releases maven-snapshots nuget-hosted nuget.org-proxy]'
INFO[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:717 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadArtifactsSingleDir() Uploading files to Nexus: 'localhost:8081' repository: 'maven-snapshots'...
INFO[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:717 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadArtifactsSingleDir() Uploading files to Nexus: 'localhost:8081' repository: 'nuget-hosted'...
INFO[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:717 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadArtifactsSingleDir() Uploading files to Nexus: 'localhost:8081' repository: 'nuget.org-proxy'...
INFO[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:717 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadArtifactsSingleDir() Uploading files to Nexus: 'localhost:8081' repository: 'maven-releases'...
INFO[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:717 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadArtifactsSingleDir() Uploading files to Nexus: 'localhost:8081' repository: 'maven-central'...
INFO[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:113 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).repoFormatLocalDiskRepo() format of repo: 'nuget-hosted' is: 'nuget' and repoType: 'hosted'
WARN[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:737 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadArtifactsSingleDir() only uploads to 'hosted' repositories are supported. Current: '{nuget hosted}'
INFO[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:113 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).repoFormatLocalDiskRepo() format of repo: 'maven-releases' is: 'maven2' and repoType: 'hosted'
WARN[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:737 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadArtifactsSingleDir() only uploads to 'hosted' repositories are supported. Current: '{maven2 hosted}'
INFO[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:740 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadArtifactsSingleDir() upload to snapshot repo
INFO[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:113 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).repoFormatLocalDiskRepo() format of repo: 'maven-central' is: 'maven2' and repoType: 'proxy'

WARN[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:737 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadArtifactsSingleDir() only uploads to 'hosted' repositories are supported. Current: '{maven2 proxy}'
INFO[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:113 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).repoFormatLocalDiskRepo() format of repo: 'nuget.org-proxy' is: 'nuget' and repoType: 'proxy'
WARN[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:737 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadArtifactsSingleDir() only uploads to 'hosted' repositories are supported. Current: '{nuget proxy}'
INFO[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:113 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).repoFormatLocalDiskRepo() format of repo: 'maven-snapshots' is: 'maven2' and repoType: 'hosted'
WARN[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:737 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadArtifactsSingleDir() only uploads to 'hosted' repositories are supported. Current: '{maven2 hosted}'
INFO[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:740 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadArtifactsSingleDir() upload to snapshot repo
DEBU[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:314 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() checksum of file: 'backup/maven-releases/com/example/demo/1.0.0/demo-1.0.0.jar' is '89ee6db729e6254fb06264ae6f1bfab3a7ae3bf66a8e5811d7aa21cdac3a294f2607fcfdbf461dc97e861bf1970b3e66b275f77463240d7bf7f55a7b71e5e3aa'
DEBU[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:330 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() checksumOfArtifactInNexus3Sha512URL: 'http://localhost:8081/repository/maven-releases/com/example/demo/1.0.0/demo-1.0.0.jar.sha512'
DEBU[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:352 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() checksum of artifact in nexus3: '

<title>404 - Sonatype Nexus Repository</title>
Exclamation point Error 404 Not Found
com/example/demo/1.0.0/demo-1.0.0.jar.sha512

'
DEBU[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:394 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).UploadSingleArtifact() folder: 'backup/maven-releases/com/example/demo/1.0.0' contains a pom file: 'backup/maven-releases/com/example/demo/1.0.0/demo-1.0.0.pom'
DEBU[0000]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:449 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).UploadSingleArtifact() Maven2 asset upload 1=backup/maven-releases/com/example/demo/1.0.0/demo-1.0.0.pom 2=empty 3=backup/maven-releases/com/example/demo/1.0.0/demo-1.0.0.jar 4=empty 5=empty
6=empty 7=empty
DEBU[0001]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:595 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.upload() artifact: 'backup/maven-releases/com/example/demo/1.0.0/demo-1.0.0.jar' has been uploaded
+DEBU[0001]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:314 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() checksum of file: 'backup/maven-releases/com/example/demo/1.0.0/demo-1.0.0.pom' is '6ab300e301350160bb3858ae13abb240e88ab3752aa122a35b7fc048c19e4385145bb5e6f6eb12faaefbe907a443ae703c80c89e6d3b00815d6b0957f77bbe07'
DEBU[0001]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:330 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() checksumOfArtifactInNexus3Sha512URL: 'http://localhost:8081/repository/maven-releases/com/example/demo/1.0.0/demo-1.0.0.pom.sha512'
DEBU[0001]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:352 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() checksum of artifact in nexus3: '6ab300e301350160bb3858ae13abb240e88ab3752aa122a35b7fc048c19e4385145bb5e6f6eb12faaefbe907a443ae703c80c89e6d3b00815d6b0957f77bbe07'
INFO[0001]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:356 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() the checksum of the filesystem: '6ab300e301350160bb3858ae13abb240e88ab3752aa122a35b7fc048c19e4385145bb5e6f6eb12faaefbe907a443ae703c80c89e6d3b00815d6b0957f77bbe07' is identical to the one in Nexus3: '6ab300e301350160bb3858ae13abb240e88ab3752aa122a35b7fc048c19e4385145bb5e6f6eb12faaefbe907a443ae703c80c89e6d3b00815d6b0957f77bbe07'. Outcome: 'true'
DEBU[0001]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:370 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).UploadSingleArtifact() artifact: 'demo-1.0.0.pom' has already been uploaded
+DEBU[0001]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:633 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadAndPrintRepoFormat() checksum file: 'backup/maven-releases/com/example/demo/1.0.0/demo-1.0.0.pom' locally is identical compared to one in nexus
DEBU[0001]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:314 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() checksum of file: 'backup/maven-releases/com/example/demo/2.0.0/demo-2.0.0-jar-with-dependencies.jar' is 'a182aa4fc1f9980678727ecc7ee8e8d0b88f4701ae8114ae2c147c4fd9471dcf2dbe82aa688d8697e22ff0849325b19d34febaf565a13132fa384fc6cd19e876'
DEBU[0001]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:330 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() checksumOfArtifactInNexus3Sha512URL: 'http://localhost:8081/repository/maven-releases/com/example/demo/2.0.0/demo-2.0.0-jar-with-dependencies.jar.sha512'
DEBU[0001]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:352 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() checksum of artifact in nexus3: '

<title>404 - Sonatype Nexus Repository</title>
Exclamation point Error 404 Not Found
com/example/demo/2.0.0/demo-2.0.0-jar-with-dependencies.jar.sha512

'
DEBU[0001]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:451 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).UploadSingleArtifact() folder: 'backup/maven-releases/com/example/demo/2.0.0' does not contain a pom file: 'backup/maven-releases/com/example/demo/2.0.0/demo-2.0.0-jar-with.pom'
DEBU[0001]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:479 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).UploadSingleArtifact() the following groupID has been found: 'com/example/demo/2.0.0'
DEBU[0001]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:521 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).UploadSingleArtifact() Maven2 asset upload 1=empty 2=empty 3=empty
4=empty 5=empty 6=empty 7=empty
DEBU[0001]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:619 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadAndPrintRepoFormat() artifact: 'backup/maven-releases/com/example/demo/2.0.0/demo-2.0.0-jar-with-dependencies.jar' has already been uploaded
DEBU[0002]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:314 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() checksum of file: 'backup/maven-releases/com/example/demo/2.0.0/demo-2.0.0.jar' is 'e5ab57d81c475c6f79f207133f1c59c264e2791ccd532d26c50096fb77b93ef714c3c79553c0fa17f79ac194f00d176ec6c99784d18703fca5f2f82dab62c06b'
DEBU[0002]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:330 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() checksumOfArtifactInNexus3Sha512URL: 'http://localhost:8081/repository/maven-releases/com/example/demo/2.0.0/demo-2.0.0.jar.sha512'
DEBU[0002]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:352 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() checksum of artifact in nexus3: '

<title>404 - Sonatype Nexus Repository</title>
Exclamation point Error 404 Not Found
com/example/demo/2.0.0/demo-2.0.0.jar.sha512

'
+DEBU[0002]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:314 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() checksum of file: 'backup/maven-releases/com/example/demo/2.0.0/demo-2.0.0.pom' is 'fceeba6ac1209eba04ae20197dffabe318cc70e62ce98aa266423a1f4eae9fc91429c55cb7285ef6e7adf4432c86e81027c5422a7a7bb3136be3c7590a13498b'
DEBU[0002]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:330 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() checksumOfArtifactInNexus3Sha512URL: 'http://localhost:8081/repository/maven-releases/com/example/demo/2.0.0/demo-2.0.0.pom.sha512'
DEBU[0002]/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:352 github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).checkLocalChecksumAndCompareWithOneInRemote() checksum of artifact in nexus3: '

<title>404 - Sonatype Nexus Repository</title>
Exclamation point Error 404 Not Found
com/example/demo/2.0.0/demo-2.0.0.pom.sha512

'
+DEBU[0002]/home/runner/work/n3dr/n3dr/cmd/n3dr/root.go:64 main.execute.func1() n3dr was running for: '1.971639703s'

Unfortunately the demo-2.0.0-jar-with-dependencies.jar is not being uploaded to nexus-new. Even more the whole version 2.0.0 has not been uploaded to nexus-new:
grafik

What you expected to happen:
I would expect n3dr to upload both versions with all artifacts.

Environment:

  • nexus version: 3.72.0

  • n3dr version (use n3dr -v): n3dr version refs/tags/7.5.2

  • OS (e.g: cat /etc/os-release): Ubuntu 24.04 LTS

  • Kernel (e.g. uname -a): Linux Zephyrus 5.15.153.1-microsoft-standard-WSL2

  • Others:

@kaerbr kaerbr added the bug Something isn't working label Oct 2, 2024
@kaerbr kaerbr changed the title n3dr doesnt upload a whole version if a *-jar-with-dependencies.jar is present as artifact n3dr doesnt upload a whole version if a custom classifier (e.g.:*-jar-with-dependencies.jar) is present as artifact Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant