INTI-CMNB / KiBot

KiCad automation utility
GNU Affero General Public License v3.0
554 stars 65 forks source link

[How] Use compress using paths relative to the current working directory #473

Closed MarkusSBS closed 11 months ago

MarkusSBS commented 1 year ago

Describe the bug After the switch to the Kicad7 train compress stops working if you use the source input and it just generates an empty zip file. For a another compress jop it just worked fine if the input is a another job output

This Workes just fine:

  - name: JLCPCB
    comment: ZIP file for JLCPCB
    type: compress
    dir: JLCPCB
    options:
      files:
        - from_output: JLCPCB_gerbers
          dest: /
        - from_output: JLCPCB_drill
          dest: /

This generates an empty file in /Fabrication/

  - name: 'archiv'
    comment: "ZIP archive"
    type: compress
    dir: ../Fabrication
    options:
      files:
        - source: ../Fabrication/dril/*
          dest: /
        - source: ../Fabrication/Gerbers/*
          dest: /
        - source: ../Fabrication/JLCPCB/*
          dest: /
        - source: ../Fabrication/Produktion/*
          dest: /
        - source: ../Docu/report/*.pdf
          dest: /
      output: "EMS_Produktion_%D-%T.%x"

If I execute an ls in the script i can see that it is in the right direktory and its filled with the same data as the resulting job Artefakts. It worked with the K6 dev docker some weeks ago.

Environment (please complete the following information): Where are you running KiBot:

set-soft commented 1 year ago

Hallo @MarkusSBS ! Please check the debug output to determine when is the archiv output generated. Make sure it runs after generating the stuff you want to compress. The debug output will also inform which files are included.

MarkusSBS commented 1 year ago

My pipline looks like this:

image image

my job definition:

release_bundle:
  stage: prepare
  tags:
    - KiBot
  script:
    - 'ls'
    - 'ls ../'
    - 'ls ./Fabrication/'
    - 'ls ./Fabrication/Gerbers/'
    - echo "release"
    - 'kibot  -d Release -vvv -g variant=`echo $CI_COMMIT_TAG | cut -d "_" -f4 | tr -d "\n"` -s run_drc,run_erc archiv'
    - 'ls'
    - 'ls ../'
    - 'ls ./Fabrication/'
    - 'ls ./Fabrication/Gerbers/'
  rules:
     - if: $CI_COMMIT_TAG =~ /^(preview|prerelease|release)_([0-9]{2}.[0-9]{5}.[0-9]{2})_([a-z,A-Z][0-9])_(all|90A)/
  needs: 
    - job: docu_outputs
    - job: fab_outputs
    - job: mech_outputs
    - job: erc
    - job: drc
  artifacts:
    name: "$CI_COMMIT_TAG"
    when: always
    paths:
      - Mechanic/
      - Fabrication/
      - Docu/
      - ERC_DRC/

My kicad Job:

  - name: 'archiv'
    comment: "ZIP archive"
    type: compress
    dir: ../Fabrication
    options:
      files:
        - source: './*'
          dest: /test/
        - source: '../*'
          dest: /test2/
        - source: './Fabrication/Gerbers/*'
          dest: /
        - source: './Fabrication/JLCPCB/*'
          dest: /
        - source: './Fabrication/Produktion/*'
          dest: /
        - source: './Docu/report/*.pdf'
          dest: /
      output: "${blub}_%p-%v_Rev%r-%i_${Doc_status}_%D-${git_hash}.%x"

ls before kicad job:

$ ls ./Fabrication/Gerbers/
-ALL_RevA2-B_Mask_preview_31-07-2023-Git_22133ad.GBS
-ALL_RevA2-B_Paste_preview_31-07-2023-Git_22133ad.GBP
-ALL_RevA2-B_Silkscreen_preview_31-07-2023-Git_22133ad.GBO
-ALL_RevA2-Back_preview_31-07-2023-Git_22133ad.GBL
-ALL_RevA2-Edge_Cuts_preview_31-07-2023-Git_22133ad.GML
-ALL_RevA2-F_Mask_preview_31-07-2023-Git_22133ad.GTS
-ALL_RevA2-F_Paste_preview_31-07-2023-Git_22133ad.GTP
-ALL_RevA2-F_Silkscreen_preview_31-07-2023-Git_22133ad.GTO
-ALL_RevA2-Front_preview_31-07-2023-Git_22133ad.GTL
-ALL_RevA2-In1_Cu_preview_31-07-2023-Git_22133ad.G1
-ALL_RevA2-In2_Cu_preview_31-07-2023-Git_22133ad.G2
-ALL_RevA2-In3_Cu_preview_31-07-2023-Git_22133ad.G3
-ALL_RevA2-In4_Cu_preview_31-07-2023-Git_22133ad.G4

LS after kicad job

$ ls ./Fabrication/Gerbers/
-ALL_RevA2-B_Mask_preview_31-07-2023-Git_22133ad.GBS
-ALL_RevA2-B_Paste_preview_31-07-2023-Git_22133ad.GBP
-ALL_RevA2-B_Silkscreen_preview_31-07-2023-Git_22133ad.GBO
-ALL_RevA2-Back_preview_31-07-2023-Git_22133ad.GBL
-ALL_RevA2-Edge_Cuts_preview_31-07-2023-Git_22133ad.GML
-ALL_RevA2-F_Mask_preview_31-07-2023-Git_22133ad.GTS
-ALL_RevA2-F_Paste_preview_31-07-2023-Git_22133ad.GTP
-ALL_RevA2-F_Silkscreen_preview_31-07-2023-Git_22133ad.GTO
-ALL_RevA2-Front_preview_31-07-2023-Git_22133ad.GTL
-ALL_RevA2-In1_Cu_preview_31-07-2023-Git_22133ad.G1
-ALL_RevA2-In2_Cu_preview_31-07-2023-Git_22133ad.G2
-ALL_RevA2-In3_Cu_preview_31-07-2023-Git_22133ad.G3
-ALL_RevA2-In4_Cu_preview_31-07-2023-Git_22133ad.G4

Deebug output:

DEBUG:- Pattern ./* list of files: [] (kibot - out_compress.py:192)
DEBUG:- Pattern ../* list of files: [] (kibot - out_compress.py:192)
DEBUG:- Pattern ./Fabrication/Gerbers/* list of files: [] (kibot - out_compress.py:192)
DEBUG:- Pattern ./Fabrication/JLCPCB/* list of files: [] (kibot - out_compress.py:192)
DEBUG:- Pattern ./Fabrication/Produktion/* list of files: [] (kibot - out_compress.py:192)
DEBUG:- Pattern ./Docu/report/*.pdf list of files: [] (kibot - out_compress.py:192)
DEBUG:Generating `/builds/hardware/$projekt/Fabrication/$projekt-ALL_RevA2-archiv_preview_31-07-2023-Git_22133ad.zip` archive (kibot - out_compress.py:

This generates an empty zip file

there are 2 warnings

WARNING:Missing KiCad main config file /root/.config/kicad/7.0/kicad_common.json (eeschema_do - misc.py:200) WARNING:(W044) More than one SCH file found in..

but i think they are not related

set-soft commented 1 year ago

Hallo @MarkusSBS ! I think the problem is that you are missing from_cwd: true. Because all your ls commands refer to ./, but then you specify -d Release and the doc says:

set-soft commented 11 months ago

As I don't have more information I'm closing this issue. If @MarkusSBS or other user have doubts about it please open a new issue.