• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • artifactory-plugin
    • None
    • artifactory plugin: 2.9.1-SNAPSHOT (private-01/24/2017 10:44-jenkins)
      jenkins: 2.40

      Yes I am using a snapshot build, due to JENKINS-41227 I was using plugin 2.8.1, which did work.

      pipeline script:

          def artiServer = Artifactory.server('snowball-artifactory')
          def repoDir = "rpms-thirdparty-local/centos/6.6/gs-test-arti-upload/${buildNumber}"
      
          def uploadSpec = """{
            "files": [
              {
                "pattern": "(configur*)",
                "target": "${repoDir}/{1}",
                "props": "${artiProps};build.name=${JOB_NAME};build.number=${BUILD_NUMBER}"
              }
      
           ]
          }"""
          def uploadBuildInfo = artiServer.upload spec: uploadSpec
          if ( uploadBuildInfo == null ){   
              println "buildinfo null"
          }
          else{
              println "buildinfo not null"
          }
          uploadBuildInfo.env.filter.addInclude("*")
          uploadBuildInfo.retention maxBuilds: 10, deleteBuildArtifacts: true
          artiServer.publishBuildInfo uploadBuildInfo
      
      

      neither one of the println statements prints. The file does upload, but no buildinfo is returned. No exception is thrown either.

          [JENKINS-41427] artifactory buildinfo upload fails on upload

          Can you please try and remove the props from your Upload Spec? I noticed you are forcing the build.name and build.number on the uploaded files, which is something that happens automatically. I don't think that this caused the issue though. Are you using the latest release of the Artifactory Plugin now?
          Also, can you check the Artifactory request logs to see if it gets the build-info publish request?

          Eyal Ben Moshe added a comment - Can you please try and remove the props from your Upload Spec? I noticed you are forcing the build.name and build.number on the uploaded files, which is something that happens automatically. I don't think that this caused the issue though. Are you using the latest release of the Artifactory Plugin now? Also, can you check the Artifactory request logs to see if it gets the build-info publish request?

          aflat added a comment -

          Yes I am using the most recent plugin, 2.91. There are no exceptions/errors/warnings in the log on jenkins, or on the artifactory server. It makes sense that the buildinfo isn't being published, since neither of the printlns are being printed, one of them should be. So the

          def uploadBuildInfo = artiServer.upload spec: uploadSpec

          Is the part that is failing, partly. The artifact is showing up in artifactory, but it doesn't appear to be returning correctly?

          aflat added a comment - Yes I am using the most recent plugin, 2.91. There are no exceptions/errors/warnings in the log on jenkins, or on the artifactory server. It makes sense that the buildinfo isn't being published, since neither of the printlns are being printed, one of them should be. So the def uploadBuildInfo = artiServer.upload spec: uploadSpec Is the part that is failing, partly. The artifact is showing up in artifactory, but it doesn't appear to be returning correctly?

          aflat added a comment -

          I upped the logs in the artifactory server, nothing out of the ordinary there either.

          aflat added a comment - I upped the logs in the artifactory server, nothing out of the ordinary there either.

          aflat added a comment -

          I changed the upload, simplified a bit:

          def artiServer = Artifactory.server('snowball-artifactory')
              def repoDir = "rpms-thirdparty-local/centos/6.6/gs-test-arti-upload/5"
          
              def uploadSpec = """{
                "files": [
                  {
                    "pattern": "(configur*)",
                    "target": "${repoDir}/{1}",
                    "props": "aprop=someprop"
                  }
          
               ]
              }"""
              def uploadBuildInfo = artiServer.upload spec: uploadSpec
              println "GOT PAST THE UPLOAD"
          

          And the output:

          [Pipeline] [git clone] getArtifactoryServer
          [Pipeline] [git clone] artifactoryUpload
          [git clone] For pattern: (configur*) 1 artifacts were found.
          [git clone] Deploying artifact: https://snowball/artifactory/rpms-thirdparty-local/centos/6.6/gs-test-arti-upload/5/configure.ac
          [Pipeline] [git clone] }
          [Pipeline] [git clone] // dir
          [Pipeline] [git clone] }
          [Pipeline] // wrap
          [Pipeline] }
          [Pipeline] // timestamps
          [Pipeline] End of Pipeline
          Finished: SUCCESS
          

          Note that the "GOT PAST THE UPLOAD" was never printed

          aflat added a comment - I changed the upload, simplified a bit: def artiServer = Artifactory.server( 'snowball-artifactory' ) def repoDir = "rpms-thirdparty-local/centos/6.6/gs-test-arti-upload/5" def uploadSpec = """{ "files" : [ { "pattern" : "(configur*)" , "target" : "${repoDir}/{1}" , "props" : "aprop=someprop" } ] }""" def uploadBuildInfo = artiServer.upload spec: uploadSpec println "GOT PAST THE UPLOAD" And the output: [Pipeline] [git clone] getArtifactoryServer [Pipeline] [git clone] artifactoryUpload [git clone] For pattern: (configur*) 1 artifacts were found. [git clone] Deploying artifact: https: //snowball/artifactory/rpms-thirdparty-local/centos/6.6/gs-test-arti-upload/5/configure.ac [Pipeline] [git clone] } [Pipeline] [git clone] // dir [Pipeline] [git clone] } [Pipeline] // wrap [Pipeline] } [Pipeline] // timestamps [Pipeline] End of Pipeline Finished: SUCCESS Note that the "GOT PAST THE UPLOAD" was never printed

          aflat added a comment - - edited

          I also noticed that there were some xray lines in the server log. I started to hit this issue once the xray support was added into the plugin(2.9.0), coincidence? I am running server 4.16. No I don't have a xray license, so it is disabled on the server

          aflat added a comment - - edited I also noticed that there were some xray lines in the server log. I started to hit this issue once the xray support was added into the plugin(2.9.0), coincidence? I am running server 4.16. No I don't have a xray license, so it is disabled on the server

          Dima Nevelev added a comment -

          We have tried to reproduce this without success using the partial script you provided.
          Please provide us through Github an example of a Jenkinsfile which reproduces the problem.

          Dima Nevelev added a comment - We have tried to reproduce this without success using the partial script you provided. Please provide us through Github an example of a Jenkinsfile which reproduces the problem.

          aflat added a comment - - edited

          https://bitbucket.org/ghstock/jenkinsfile_arti_upload.git

          It uploads the Jenkinsfile.

          I installed a new jenkins instance, installed the 2.9.1 artifactory plugin, and used this script as the jenkinsfile script in a pipeline job. The file uploads, but no buildinfo uploads. Artifactory server 4.16.

          The "GOT PAST THE UPLOAD" line is never printed in my output either. This should be easier to test now that I have a dedicated jenkins instance just for this issue

          aflat added a comment - - edited https://bitbucket.org/ghstock/jenkinsfile_arti_upload.git It uploads the Jenkinsfile. I installed a new jenkins instance, installed the 2.9.1 artifactory plugin, and used this script as the jenkinsfile script in a pipeline job. The file uploads, but no buildinfo uploads. Artifactory server 4.16. The "GOT PAST THE UPLOAD" line is never printed in my output either. This should be easier to test now that I have a dedicated jenkins instance just for this issue

          Dima Nevelev added a comment -

          It seems that without the NonCPS annotation everything works fine.
          Is there a reason you using NonCPS?

          Dima Nevelev added a comment - It seems that without the NonCPS annotation everything works fine. Is there a reason you using NonCPS?

          aflat added a comment -

          In this case no. I copied/changed a bit from a larger jenkinsfile, which did need the NonCPS when I first wrote it. I may have factored it out, so I can remove the NonCPS now.

          Still would be nice to see an error thrown here, since I have many scripts, and finding them all will take a while, with errors coming back as success it's not ideal

          aflat added a comment - In this case no. I copied/changed a bit from a larger jenkinsfile, which did need the NonCPS when I first wrote it. I may have factored it out, so I can remove the NonCPS now. Still would be nice to see an error thrown here, since I have many scripts, and finding them all will take a while, with errors coming back as success it's not ideal

          I agree. We have never tested the publishBuildInfo API with the NonCPS option, so we were not aware of this behavior.

          Eyal Ben Moshe added a comment - I agree. We have never tested the publishBuildInfo API with the NonCPS option, so we were not aware of this behavior.

            eyalbe Eyal Ben Moshe
            aflat aflat
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: