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

pipeline-utility-steps unzip cannot handle directories in glob

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • jenkins v2.204.5
      pipeline-utility-steps 2.3.1
      master: WIndowsServer2012
      exeucting agent: linux Ubuntu18

      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

       

       

       

       

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

              Created:
              Updated: