• 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

          Dima Nevelev added a comment -

          aflat, We didn't manage to reproduce the issue according to the configuration you specified and the script below:

          node("a") {
              git url: 'https://github.com/jfrogdev/project-examples.git'
              def artiServer = Artifactory.server('localhost-8081-admin-password')
              def repoDir = "rpms-local/centos/6.6/gs-test-arti-upload/${BUILD_NUMBER}"
          
              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
          }
          

          Please try to remove old Jenkins Artifactory plugin installations from $JENKINS_HOME/plugins and also the cashes from $JENKINS_HOME/cache and install the plugin again.

          Dima Nevelev added a comment - aflat , We didn't manage to reproduce the issue according to the configuration you specified and the script below: node( "a" ) { git url: 'https: //github.com/jfrogdev/project-examples.git' def artiServer = Artifactory.server( 'localhost-8081-admin-password' ) def repoDir = "rpms-local/centos/6.6/gs-test-arti-upload/${BUILD_NUMBER}" 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 } Please try to remove old Jenkins Artifactory plugin installations from $JENKINS_HOME/plugins and also the cashes from $JENKINS_HOME/cache and install the plugin again.

          aflat added a comment -

          I was able to try this, still no build info is uploaded. The artifact is uploaded, but the buildinfo isn't populated. No exception is thrown, and neither of the println statements are printed, so something is failing out on the upload. I can't debug this, since nothing is printed in a log anywhere

          aflat added a comment - I was able to try this, still no build info is uploaded. The artifact is uploaded, but the buildinfo isn't populated. No exception is thrown, and neither of the println statements are printed, so something is failing out on the upload. I can't debug this, since nothing is printed in a log anywhere

          To get a better sense of the issue, does any of the other Artifactory Pipeline examples work for you? If you choose the simplest example from:
          https://github.com/JFrogDev/project-examples/tree/master/jenkins-pipeline-examples
          Do you manage do have build-info deployed to Artifactory?

          Eyal Ben Moshe added a comment - To get a better sense of the issue, does any of the other Artifactory Pipeline examples work for you? If you choose the simplest example from: https://github.com/JFrogDev/project-examples/tree/master/jenkins-pipeline-examples Do you manage do have build-info deployed to Artifactory?

          aflat added a comment -

          aflat added a comment - The snippet I posted is almost an exact copy of https://github.com/JFrogDev/project-examples/blob/master/jenkins-pipeline-examples/props-single-file-example/Jenkinsfile

          aflat added a comment - - edited

          Is there a way for me to enable any kind of verbose/debug logging?

          aflat added a comment - - edited Is there a way for me to enable any kind of verbose/debug logging?

          I'm not sure that turning on debug would help here, because if you do not see anything in the logs, then it may be that the code is not loaded to the JVM. This can happen if more than one version of the plugin's hpi, jpi or an exploded artifactory directory exists in the /plugins directory. I would also suggest wiping out the /caches directory and then starting up Jenkins. After doing that, in order to rule out that your agent includes bad cache, you can try running the job on the master. Please let us know how it goes.

          Eyal Ben Moshe added a comment - I'm not sure that turning on debug would help here, because if you do not see anything in the logs, then it may be that the code is not loaded to the JVM. This can happen if more than one version of the plugin's hpi, jpi or an exploded artifactory directory exists in the /plugins directory. I would also suggest wiping out the /caches directory and then starting up Jenkins. After doing that, in order to rule out that your agent includes bad cache, you can try running the job on the master. Please let us know how it goes.

          aflat added a comment -

          Caches wiped, deleted all artifactory*, still not seeing any printlns, and still no buildinfo. The artifact is still being uploaded correctly, it's just no buildinfo.

          aflat added a comment - Caches wiped, deleted all artifactory*, still not seeing any printlns, and still no buildinfo. The artifact is still being uploaded correctly, it's just no buildinfo.

          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: