From eba1c3d1e277de7bd16fdbd84d5411aee73f5c48 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 23 Oct 2026 02:35:23 -0700 Subject: [PATCH] adding check to jenkinsfile for repo existence --- api/Jenkinsfile.ble_test | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/api/Jenkinsfile.ble_test b/api/Jenkinsfile.ble_test index 0920afc..0d4a99d 100644 --- a/api/Jenkinsfile.ble_test +++ b/api/Jenkinsfile.ble_test @@ -82,10 +82,20 @@ pipeline { sh """ ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF echo ==MC== Initiating BLE test in Screen session ble_test_${env.TEST_HASH} - sleep 5 - echo ==MC== Pulling code changes from Gitea... - cd /opt/ble-test/ble_api - git pull + + if [ ! -d /opt/ble-test/ble_api/.git ]; then + echo ==MC== Directory /opt/ble-test/ble_api missing - creating & cloning repo... + # Create parent folder if necessary + mkdir -p /opt/ble-test + # Pull the latest copy of the repo + git clone https://gitea.matt-cloud.com/matt/ble_api.git /opt/ble-test/ble_api + else + echo ==MC== Pulling code changes from Gitea... + cd /opt/ble-test/ble_api + git pull + fi + sleep 2 + cd /opt/ble-test/ble_api/api screen -dmS ble_test_${env.TEST_HASH} bash -c "cd /opt/ble-test/ble_api/api && python3 -u ./ble.py ${params.test_count} | tee /tmp/ble_test_${env.TEST_HASH}.log" echo ==MC== BLE Test running...