Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-38918

nexus-artifact-uploader-plugin does not fail in pipeline on failed upload

    • 2.14

      I am trying to upload a

      nexus artefact in a pipeline:

      node () {
          stage("nexus snapshot checkin") {
              nexusArtifactUploader artifactId: 'my-model',
              classifier: '',
              credentialsId: '<id>',
              file: '<path-to-file>-SNAPSHOT-20.zip',
              groupId: 'org.somegroup',
              nexusUrl: '<nexus-url>',
              nexusVersion: 'nexus3',
              protocol: 'http',
              repository: 'maven-snapshots',
              type: 'zip',
              version: '1.6.7-SNAPSHOT'
          }
      }
      

      In the log output I see:

      Failed to deploy artifacts: Could not transfer artifact<my-artifact> from/to maven-releases (<url>): Failed to transfer <url>. Error code 400, Repository does not allow updating assets: maven-releases
      

      Which is of course a configuration error on the nexus.

      But the job does not fail! In my opinion the plugin should throw an error when it fails.

          [JENKINS-38918] nexus-artifact-uploader-plugin does not fail in pipeline on failed upload

          Suresh Kumar added a comment -

          Fixed and Committed to the repository.
          Find the below commit id of the fix submitted.
          https://github.com/jenkinsci/nexus-artifact-uploader-plugin/commit/301e21cccb54930ee03a3d06bb12989d7879fd10

          Will be released as hotfix this weekend.
          Let me know if this is blocker for you, we release this fix as minor release.

          -Suresh

          Suresh Kumar added a comment - Fixed and Committed to the repository. Find the below commit id of the fix submitted. https://github.com/jenkinsci/nexus-artifact-uploader-plugin/commit/301e21cccb54930ee03a3d06bb12989d7879fd10 Will be released as hotfix this weekend. Let me know if this is blocker for you, we release this fix as minor release. -Suresh

          Thanks for the fast response.
          If it is released this weekend it is not a blocker for me.

          Nathan Hüsken added a comment - Thanks for the fast response. If it is released this weekend it is not a blocker for me.

          Ilia Shakitko added a comment -

          Issue appears again: Jenkins 2.7.4

          Jenkins pipeline code:

           

          nexusArtifactUploader artifacts: [[artifactId: 'my-artifact', classifier: '', file: 'test.zip', type: 'zip']], credentialsId: 'some-credentials-id', groupId: 'some.group.id', nexusUrl: 'nexus-url', nexusVersion: 'nexus2', protocol: 'https', repository: 'Snapshots', version: '1.0.0-SNAPSHOT'

           

           

          Ilia Shakitko added a comment - Issue appears again: Jenkins 2.7.4 Jenkins pipeline code:   nexusArtifactUploader artifacts: [ [artifactId: 'my-artifact', classifier: '', file: 'test.zip', type: 'zip'] ], credentialsId: 'some-credentials-id', groupId: 'some.group.id', nexusUrl: 'nexus-url', nexusVersion: 'nexus2', protocol: 'https', repository: 'Snapshots', version: '1.0.0-SNAPSHOT'    

          Suresh Kumar added a comment -

          svscorp
          Pls share the log of the build.

          -Suresh

          Suresh Kumar added a comment - svscorp Pls share the log of the build. -Suresh

          daiwulong added a comment - - edited

          I had the same problem.

          when nexus repository config deployment policy as "Disable redeploy",then upload a artifact which its version is already exist, the problem appear.

          Jenkins 2.235.1
          Nexus Artifact Uploader 2.13

           

          log:
          [Pipeline] nexusArtifactUploader*17:32:16* Uploading artifact my-app-1.0.0.jar started....17:32:16 GroupId: com.mycompany.app*17:32:16* ArtifactId: com.mycompany.app*17:32:16* Classifier: 17:32:16 Type: jar*17:32:16* Version: 1.0.0*17:32:16* File: my-app-1.0.0.jar*17:32:16* Repository:Test*17:32:20* Uploading:
           17:32:20 100 % completed (2.6 kB / 2.6 kB).[Pipeline] sleep*17:32:22* Sleeping for 10 sec*17:32:21* Failed to deploy artifacts: Could not transfer artifact com.mycompany.app:my-app:jar:1.0.0 from/to Test : Failed to transfer file. Return code is: 400, ReasonPhrase:Bad Request.[Pipeline] }[Pipeline] // script[Pipeline] }[Pipeline] // container[Pipeline] }[Pipeline] // stage[Pipeline] stage[Pipeline] { (Declarative: Post Actions)[Pipeline] script[Pipeline] {[Pipeline] echo*17:32:32* always[Pipeline] ansiColor[Pipeline] {17:32:33 [Pipeline] echo*17:32:33* >>>>>>>>>>false>>>>>>>>>>[Pipeline] }17:32:33 [Pipeline] // ansiColor[Pipeline] }[Pipeline] // script[Pipeline] script[Pipeline]

          {[Pipeline] echo*17:32:34* success[Pipeline] }

          [Pipeline] // script[Pipeline] }[Pipeline] // stage[Pipeline] }[Pipeline] // timestamps[Pipeline] }[Pipeline] // node[Pipeline] }[Pipeline] // podTemplate[Pipeline] End of PipelineFinished: SUCCESS

           

          daiwulong added a comment - - edited I had the same problem. when nexus repository config deployment policy as "Disable redeploy",then upload a artifact which its version is already exist, the problem appear. Jenkins 2.235.1 Nexus Artifact Uploader 2.13   log: [Pipeline] nexusArtifactUploader*17:32:16* Uploading artifact my-app-1.0.0.jar started.... 17:32:16 GroupId: com.mycompany.app*17:32:16* ArtifactId: com.mycompany.app*17:32:16* Classifier: 17:32:16 Type: jar*17:32:16* Version: 1.0.0*17:32:16* File: my-app-1.0.0.jar*17:32:16* Repository:Test*17:32:20* Uploading:   17:32:20 100 % completed (2.6 kB / 2.6 kB). [Pipeline] sleep*17:32:22* Sleeping for 10 sec*17:32:21* Failed to deploy artifacts: Could not transfer artifact com.mycompany.app:my-app:jar:1.0.0 from/to Test : Failed to transfer file. Return code is: 400, ReasonPhrase:Bad Request. [Pipeline] } [Pipeline] // script [Pipeline] } [Pipeline] // container [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Declarative: Post Actions) [Pipeline] script [Pipeline] { [Pipeline] echo*17:32:32* always [Pipeline] ansiColor [Pipeline] { 17:32:33 [Pipeline] echo*17:32:33* >>>>>>>>>>false>>>>>>>>>> [Pipeline] } 17:32:33 [Pipeline] // ansiColor [Pipeline] } [Pipeline] // script [Pipeline] script [Pipeline] {[Pipeline] echo*17:32:34* success[Pipeline] } [Pipeline] // script [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // timestamps [Pipeline] } [Pipeline] // node [Pipeline] } [Pipeline] // podTemplate [Pipeline] End of PipelineFinished: SUCCESS  

          Divyank added a comment -

          Facing same issue, while uploading snapshot jar to nexus release repo. When i try to upload snapshot jar to nexus release repo, it show failed to upload, ideally pipeline should also fail, but it shows build successful.

          If anyone found any workaround to resolve this. Please let me know.

           
          Failed to deploy artifacts: Could not find artifact com.cable:core:jar:8.6.1-20210526.125338-1 in snapshot (https://nexus.in-eon.com/repository/snapshot)
          Finished: SUCCESS

          Divyank added a comment - Facing same issue, while uploading snapshot jar to nexus release repo. When i try to upload snapshot jar to nexus release repo, it show failed to upload, ideally pipeline should also fail, but it shows build successful. If anyone found any workaround to resolve this. Please let me know.   Failed to deploy artifacts: Could not find artifact com.cable:core:jar:8.6.1-20210526.125338-1 in snapshot ( https://nexus.in-eon.com/repository/snapshot ) Finished: SUCCESS

          Hi pskumar448 divyank,
          I created PR that fix that issue for all cases. tested on our jenkins.
          https://github.com/jenkinsci/nexus-artifact-uploader-plugin/pull/23

          Izek Greenfield added a comment - Hi  pskumar448 divyank , I created PR that fix that issue for all cases. tested on our jenkins. https://github.com/jenkinsci/nexus-artifact-uploader-plugin/pull/23

          This got merged, but no release created for it yet.  Can it be released?

          Jeffrey Bennett added a comment - This got merged, but no release created for it yet.  Can it be released?

          Can it be released?

          Marco Monducci added a comment - Can it be released?

          Basil Crow added a comment -

          Basil Crow added a comment - Fixed in jenkinsci/nexus-artifact-uploader-plugin#23 . Released in 2.14 .

            pskumar448 Suresh Kumar
            nathanhuesken Nathan Hüsken
            Votes:
            3 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: