Skip to content

[HOW] Is it possible to write KiBot variables directly into KiCad project files? #852

@Handkep

Description

@Handkep

I'm using KiBot with the following configuration:

kibot:
  version: 1
global:
  set_text_variables_before_output: true

preflight:
  set_text_variables:
    - name: GIT_VERSION
      command: git describe --tags --always --dirty
    - name: REPOSITORY
      command: echo $CI_PROJECT_PATH
    - name: CURRENT_DATE
      command: date +'%Y-%m-%d'
outputs:
  - name: 'copy_files'
    comment: 'Used to copy files to the output directory.'
    type: 'copy_files'
    dir: '../Exports/kicad'
    options:
      download: false
      files:
          - filter: '.*\.(kicad_pro|kicad_sch|kicad_pcb)$'

Gitlab CI:

[ -f *.kicad_pcb ] && kibot -c ci.kibot.yaml --verbose

My goal is to have the variables defined in preflight (e.g., GIT_VERSION) appear directly within the KiCad project files (.kicad_sch, .kicad_pcb) that are copied to the ../Exports/kicad directory.

However, after running KiBot in an Gitlab CI/CD environment, the original files are simply copied without any modification or variable substitution. The GIT_VERSION placeholder is not replaced with the actual git tag.

Is there a specific KiBot output type or a configuration option that allows for the automatic modification of the source KiCad files with these variables? Or is this functionality not intended for copy_files and is only available for other output types like pdf_sch_print?

Any clarification on this would be greatly appreciated.

Metadata

Metadata

Assignees

Labels

questionThis is just a question, not a problem

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions