build: use switch_to.sh for config generation
What changed, and why it matters
This commit is a routine build-system cleanup. It changes how GitLab CI jobs select firmware configuration files, replacing inline shell commands with calls to a helper script called switch_to.sh. There is no indication this fixes or introduces a security vulnerability.
No security action required. Treat as normal build hygiene; verify CI still produces expected sdkconfig.defaults for each target.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors GitLab CI definitions in four files (dev_fw.yml, prod_fw.yml, test_fw.yml, test_libjade.yml). Previously, CI jobs copied sdkconfig.defaults files based on job names using sed. Now they invoke tools/switch_to.sh with explicit device and option flags (e.g., jade, jade_v1_1, jade_v2, –dev, –noradio, –ci, –log, –jtag). The qemu test jobs retain the old manual method with a TODO noting qemu support is not yet added to switch_to.sh. This is a maintainability change, not a code or cryptographic change.
Changed components
GitLab CI/CD configuration filestools/switch_to.sh (invoked, not modified)Inspect captured patch +64 / −27
diff --git a/gitlab/dev_fw.yml b/gitlab/dev_fw.yml
index e0dcd98..3c6e21b 100644
--- a/gitlab/dev_fw.yml
+++ b/gitlab/dev_fw.yml
@@ -4,23 +4,33 @@
.build_dev_template:
extends: .build_template
stage: build_dev
- before_script:
- - cp configs/sdkconfig_dev$(echo $CI_JOB_NAME | sed "s/^${CI_JOB_STAGE}//").defaults sdkconfig.defaults
build_dev_jade:
extends: .build_dev_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh && ./tools/switch_to.sh jade --dev
-build_dev_jade_v1_1:
+build_dev_jade_noradio:
extends: .build_dev_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh &&./tools/switch_to.sh jade --dev --noradio
-build_dev_jade_v2:
+build_dev_jade_v1_1:
extends: .build_dev_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh &&./tools/switch_to.sh jade_v1_1 --dev
-build_dev_jade_noradio:
+build_dev_jade_v1_1_noradio:
extends: .build_dev_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh &&./tools/switch_to.sh jade_v1_1 --dev --noradio
-build_dev_jade_v1_1_noradio:
+build_dev_jade_v2:
extends: .build_dev_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh &&./tools/switch_to.sh jade_v2 --dev
build_dev_jade_v2_noradio:
extends: .build_dev_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh &&./tools/switch_to.sh jade_v2 --dev --noradio
diff --git a/gitlab/prod_fw.yml b/gitlab/prod_fw.yml
index 797fb02..1afd81b 100644
--- a/gitlab/prod_fw.yml
+++ b/gitlab/prod_fw.yml
@@ -4,23 +4,33 @@
.build_prod_template:
extends: .build_template
stage: build_prod
- before_script:
- - cp production/sdkconfig$(echo $CI_JOB_NAME | sed "s/^${CI_JOB_STAGE}//")_prod.defaults sdkconfig.defaults
build_prod_jade:
extends: .build_prod_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh && ./tools/switch_to.sh jade
build_prod_jade_noradio:
extends: .build_prod_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh && ./tools/switch_to.sh jade --noradio
build_prod_jade_v1_1:
extends: .build_prod_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh && ./tools/switch_to.sh jade_v1_1
build_prod_jade_v1_1_noradio:
extends: .build_prod_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh && ./tools/switch_to.sh jade_v1_1 --noradio
build_prod_jade_v2:
extends: .build_prod_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh && ./tools/switch_to.sh jade_v2
build_prod_jade_v2_noradio:
extends: .build_prod_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh && ./tools/switch_to.sh jade_v2 --noradio
diff --git a/gitlab/test_fw.yml b/gitlab/test_fw.yml
index 32a0f50..191dd79 100644
--- a/gitlab/test_fw.yml
+++ b/gitlab/test_fw.yml
@@ -12,37 +12,54 @@
stage: build_test
artifacts:
expire_in: 2 days
- before_script:
- # Create CI config from the default developer device config
- - echo $CI_JOB_NAME | sed "s/^${CI_JOB_STAGE}//" | sed "s/_ci$//" >device_name
- - cp configs/sdkconfig$(cat device_name).defaults sdkconfig.defaults
- - echo "CONFIG_DEBUG_UNATTENDED_CI=y" >>sdkconfig.defaults
- - echo "CONFIG_HEAP_POISONING_COMPREHENSIVE=y" >>sdkconfig.defaults
- - echo "CONFIG_LOG_DEFAULT_LEVEL_NONE=y" >>sdkconfig.defaults
-build_test_qemu:
- extends: .build_test_template
-
-build_test_qemu_psram:
+build_test_jade_ci:
extends: .build_test_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh && ./tools/switch_to.sh jade --dev --debug --ci --log
-build_test_qemu_psram_unamalgamated:
+build_test_jade_noradio_ci:
extends: .build_test_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh && ./tools/switch_to.sh jade --dev --debug --ci --log --noradio
-build_test_jade_ci:
+build_test_jade_v1_1_ci:
extends: .build_test_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh && ./tools/switch_to.sh jade_v1_1 --dev --debug --ci --log
-build_test_jade_v1_1_ci:
+build_test_jade_v1_1_noradio_ci:
extends: .build_test_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh && ./tools/switch_to.sh jade_v1_1 --dev --debug --ci --log --noradio
build_test_jade_v2_ci:
extends: .build_test_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh && ./tools/switch_to.sh jade_v2 --dev --debug --ci --log --jtag
-build_test_jade_noradio_ci:
+build_test_jade_v2_noradio_ci:
extends: .build_test_template
+ before_script:
+ - . $HOME/esp/esp-idf/export.sh && ./tools/switch_to.sh jade_v2 --dev --debug --ci --log --jtag --noradio
-build_test_jade_v1_1_noradio_ci:
- extends: .build_test_template
-build_test_jade_v2_noradio_ci:
+.build_test_qemu_template:
extends: .build_test_template
+ before_script:
+ # Create CI config from the default developer device config
+ # TODO: Add qemu to tools/switch_to.sh
+ - echo $CI_JOB_NAME | sed "s/^${CI_JOB_STAGE}//" | sed "s/_ci$//" >device_name
+ - cp configs/sdkconfig$(cat device_name).defaults sdkconfig.defaults
+ - echo "CONFIG_DEBUG_UNATTENDED_CI=y" >>sdkconfig.defaults
+ - echo "CONFIG_HEAP_POISONING_COMPREHENSIVE=y" >>sdkconfig.defaults
+ - echo "CONFIG_LOG_DEFAULT_LEVEL_NONE=y" >>sdkconfig.defaults
+
+build_test_qemu:
+ extends: .build_test_qemu_template
+
+build_test_qemu_psram:
+ extends: .build_test_qemu_template
+
+build_test_qemu_psram_unamalgamated:
+ extends: .build_test_qemu_template
diff --git a/gitlab/test_libjade.yml b/gitlab/test_libjade.yml
index 178c347..a7f72bf 100644
--- a/gitlab/test_libjade.yml
+++ b/gitlab/test_libjade.yml
@@ -2,7 +2,7 @@
tags: [ ga ]
before_script:
- . $HOME/esp/esp-idf/export.sh
- - ./tools/switch_to.sh jadedev --noradio
+ - ./tools/switch_to.sh jade --dev --noradio
- source /venv/bin/activate
- pip install -r requirements.txt
- pip install -r pinserver/requirements.txt
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.