• 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

          aflat created issue -
          aflat made changes -
          Description Original: Yes I am using a snapshot build, due to JENKINS-41227 I was using plugin 2.8.0, which did work.

          pipeline script:

          {code:java}
              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

          {code}


          neither one of the println statements prints. The file does upload, but no buildinfo is returned. No exception is thrown either.
          New: Yes I am using a snapshot build, due to JENKINS-41227 I was using plugin 2.8.1, which did work.

          pipeline script:

          {code:java}
              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

          {code}


          neither one of the println statements prints. The file does upload, but no buildinfo is returned. No exception is thrown either.
          Summary Original: artifactory upload fails on upload New: 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?

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

              Created:
              Updated: