Add env var fallback for KiBot text variables

- rev/rev_pcb: Use KIBOT_VAR_rev if set, else git describe
- name: Use KIBOT_VAR_name if set, else extract from filename

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
timmyhadwen
2026-01-16 23:24:13 +10:00
parent 8f5ce0453f
commit 1cae44ffdc
8 changed files with 87 additions and 9 deletions

View File

@@ -11,15 +11,15 @@ preflight:
# drc: true
set_text_variables:
- name: 'rev'
command: 'if [ $(git describe --tags | wc -w) -gt 0 ]; then git describe --tags | sed -e "s/\([r,R][0-9]\+\)*$//g"; else echo $CI_COMMIT_SHORT_SHA; fi'
command: 'if [ -n "$KIBOT_VAR_rev" ]; then echo $KIBOT_VAR_rev; else git describe --tags 2>/dev/null || echo $CI_COMMIT_SHORT_SHA; fi'
- name: 'rev_pcb'
command: if [ $(git describe --tags | wc -w) -gt 0 ]; then git describe --tags | awk -F- 'BEGIN {ORS=""} {split($1,a,"."); print a[1]"."a[2]; if ($2) print "-"$2}' ; else echo $CI_COMMIT_SHORT_SHA; fi
command: 'if [ -n "$KIBOT_VAR_rev_pcb" ]; then echo $KIBOT_VAR_rev_pcb; else git describe --tags 2>/dev/null || echo $CI_COMMIT_SHORT_SHA; fi'
- name: 'date'
expand_kibot_patterns: true
text: '%D'
- name: 'name'
expand_kibot_patterns: true
command: 'echo $KIBOT_PCB_NAME | rev | cut -d"/" -f1 | rev | cut -d"-" -f1'
command: 'if [ -n "$KIBOT_VAR_name" ]; then echo $KIBOT_VAR_name; else echo $KIBOT_PCB_NAME | rev | cut -d"/" -f1 | rev | cut -d"-" -f1; fi'
- name: 'title'
expand_kibot_patterns: true
command: 'echo $KIBOT_PCB_NAME | rev | cut -d"/" -f1 | rev | cut -d"." -f1 '

View File

@@ -4,9 +4,14 @@ kibot:
import:
- file: default.kibot.yaml
outputs: ['export_3d', 'pcb_render', 'pcba_render']
outputs: ['step', 'pcb_render', 'pcba_render']
preflight:
erc: false
update_xml: false
drc: false
set_text_variables:
- name: 'rev'
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'
- name: 'rev_pcb'
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'

View File

@@ -4,9 +4,9 @@ kibot:
import:
- file: default.kibot.yaml
outputs: [JLCPCB_compress, neo_position, print_pcb, step, interactive_bom]
outputs: [JLCPCB_gerbers, JLCPCB_drill, JLCPCB_compress, neo_position, print_pcb, panel_step, interactive_bom]
preflight:
erc: false
update_xml: false
drc: true
drc: false

View File

@@ -4,9 +4,14 @@ kibot:
import:
- file: default.kibot.yaml
outputs: [JLCPCB_gerbers, JLCPCB_drill, JLCPCB_compress, print_pcb, stencil]
outputs: [JLCPCB_gerbers, JLCPCB_drill, JLCPCB_compress, print_pcb, stencil, interactive_bom]
preflight:
erc: false
update_xml: false
drc: true
drc: false
set_text_variables:
- name: 'rev'
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'
- name: 'rev_pcb'
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'

View File

@@ -10,3 +10,8 @@ preflight:
erc: false
update_xml: false
drc: false
set_text_variables:
- name: 'rev'
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'
- name: 'rev_pcb'
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'

View File

@@ -9,3 +9,8 @@ preflight:
erc: true
update_xml: true
drc: false
set_text_variables:
- name: 'rev'
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'
- name: 'rev_pcb'
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'