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

pipeline-utility-steps unzip cannot handle directories in glob

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
      jenkins v2.204.5
      pipeline-utility-steps 2.3.1
      master: WIndowsServer2012
      exeucting agent: linux Ubuntu18
    • Similar Issues:

      Description

      I am using two jobs in which:

      • job 1 builds some firmware code , adds into a ZIP, and stores it in a tag under subversion. In the same ZIP, some log files and other files are added.
      • job 2 takes a tag, exports the ZIP to the workarea and needs to extract a few specific files from it. I do that using a glob pattern.

      When I have the files in the ZIP in a subdir, the unzip does not work. No files are extracted.
      When I have the files in the ZIP at the root directory, the extract works.

      Some code extracts:

      — job 1: ZIP the files

      inclFilesGlob = "firmware_/.mtc , firmware_/.so , */buildFW_.log, */buildFW.trx , */buildFW.html"
      println( " including files: ${inclFilesGlob}")
      zip ( zipFile: "hsm_fw_${bldConfigID}.zip", archive: false, glob: inclFilesGlob )

      — job 2: EXTRACT specific files

      utils.nscm.do_svn_export(svnFWzip, svn_url, '.')
      sh 'ls -alFR'
      println( " ZIP contents:")
      sh "unzip -vl ${fwZipFile}"
      unzip ( zipFile: fwZipFile, glob: ‘*/firmware/kis.mtc , **/kis.so’)

      I have tried many different glob patterns, and none work when having the files in a subdir. The SH list I added then shows eg:

      Length Method Size Cmpr Date Time CRC-32 Name
      -------- ------ ------- ---- ---------- ----- -------- —
      13820 Defl:N 1696 88% 2020-07-01 09:31 6146d5eb firmware_SDK430_R2768_2.0.10.208/FW_modbuild_ksi_430.log
      11994 Defl:N 1698 86% 2020-07-01 09:31 f71d94d3 firmware_SDK430_R2768_2.0.10.208/FW_modbuild_kis_421.log
      268968 Defl:N 120091 55% 2020-07-01 09:31 d595dddb firmware_SDK430_R2768_2.0.10.208/kis430_linux.mtc
      268556 Defl:N 119699 55% 2020-07-01 09:31 9c7c5471 firmware_SDK430_R2768_2.0.10.208/kis421_linux.so

      So I know the files are there. But the unzip:

      extract files: */firmware/kis.mtc , **/kis.so
      Extracting from PATH/linux/firmware/fw_4.30_linux.zip
      Extracted: 0 files

      Then, when I create a 'flat' ZIP file, the unzip works using a simple glob pattern '*.mtc, *.so' :

      Extracting from PATH/linux/firmware/fw_4.30_linux_flat.zip
      Extracting: kis430_linux.mtc -> PATH/linux/firmware/kis430_linux.mtc
      Extracting: kis421_linux.so -> PATH/linux/firmware/kis421_linux.so
      Extracted: 2 files

       

      I hope this is enough to reproduce. I am running in an air-gapped system, so not easy to provide full data. If not enough, please let me know and I will try to create a reproducer.

       

      Thx, David

       

       

       

       

        Attachments

          Activity

          Hide
          monger39 David Riemens added a comment -

          I created a reproducer. See attached groovy script.

          Finally found that the issue is not in the subdirs , but in using a multi-set pattern with a ',' like

             '*/.log,*/.txt'

          Maybe I (still) do not understand the pattern syntax, but similar patterns do work correctly for the ZIP step.
          I hope someone will be able to tell me whether this is now my misunderstanding or still abug.

          gr, David

          Show
          monger39 David Riemens added a comment - I created a reproducer. See attached groovy script. Finally found that the issue is not in the subdirs , but in using a multi-set pattern with a ',' like    '* / .log,* / .txt' Maybe I (still) do not understand the pattern syntax, but similar patterns do work correctly for the ZIP step. I hope someone will be able to tell me whether this is now my misunderstanding or still abug. gr, David

            People

            Assignee:
            rsandell rsandell
            Reporter:
            monger39 David Riemens
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: