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

Loss track uploaded artifacts (parallel)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • artifactory-plugin
    • None

      JFrog build artifact did not report, or track all uploaded artifact, when calling rtUpload multiple times in parallel. Only the last rtUpload in the parallel block would got tracked.

      This cause partially work with retention policy only – There will be leftover un-tracked artifacts of old builds.

       

      There also some other found BUGs that comment in the example code below.

      pipeline
      {
        agent { label 'XYZ1' }
        
        environment
        {
          // BUG??? This decode URI help JFrog Artifactory could be correctly navigate 
          // under `Native Browser` mode. Because the %2F in the path/file name would 
          // be decode URI by JFrog under Native Browser mode which would yield file 
          // not found error.
          JOB_NAME  = "${JOB_NAME.replace('%2F','/')}"
          buildName = "testing"
        }
      
        stages 
        { 
          stage('Art Setup') 
          { 
            steps 
            { 
              rtServer(  
                  id: "ArtSrv",
                  url: "https://artifactory.XYZ2.com/artifactory", 
                  bypassProxy: true,
                  credentialsId: "XYZ3",
              )
              
              rtBuildInfo(
                  captureEnv:true, 
                  deleteBuildArtifacts:true,
                  maxBuilds:1,
                  buildName: env.buildName,
              )
              
              bat """ECHO Art1>art1.txt"""
              bat """ECHO Art2>art2.txt"""
              bat """ECHO Art3>art3.txt"""
              bat """ECHO Art4>art4.txt"""
              bat """ECHO Art5>art5.txt"""
              bat """ECHO Art6>art6.txt"""
              bat """ECHO Art7>art7.txt"""
            }
          }
          
          stage('UploadArt') 
          {
            parallel
            {
                stage("1") { steps {
                  addArt("art1.txt")
                  uploadArt()
                } }
                
                stage("2") { steps {
                  addArt("art2.txt")
                  addArt("art3.txt")
                  uploadArt()
                } }
                
                //// BUG?? This fail event with failNoOp:false
                //// However if run ok in NON parallel block
                //stage("3") { steps {
                //  addArt("art3.txt")
                //  addArt("non.existed.txt")
                //  uploadArt()
                //} }
                
                stage("4") { steps {
                  addArt("art4.txt")
                  addArt("art5.txt")
                  addArt("art6.txt")
                  uploadArt()
                } }
            }
          }
          
          stage("end") 
          {  
            steps 
            {
              addArt("art7.txt")
              uploadArt()
            } 
          }
          
        } /*stages*/ 
        
        post {
          always {
            rtPublishBuildInfo( 
                serverId: "ArtSrv", 
                buildName: env.buildName,
            )
          }
        }
      }
      
      
      def addArt(pattern, target="")
      {
        if (!binding.hasVariable('_art_data')) _art_data=[ files:[] ]
      
        _art_data.files.add("""
          { "pattern"   : "$pattern",
            "exclusions": ["*.md5"],
            "flat"      : "true",  
            "recursive" : "true",
            "target"    : "XYZ4/$env.JOB_NAME/$env.BUILD_NUMBER/$target" 
          }""");
      }
      
      def uploadArt()
      {
          def _files = _art_data.files
          _art_data.files = []
          echo _files.toString()
          rtUpload(
              serverId: "ArtSrv", 
              failNoOp: true,
              spec: """{"files": [""" + _files.join(',') + """]}""",
              buildName: env.buildName,
          )
      }
      

            eyalbe Eyal Ben Moshe
            nhatkhai NhatKhai Nguyen
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: