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 '