From e497a0456b02701ae88734cd3d118ee11e05de3d Mon Sep 17 00:00:00 2001 From: rusefillc <48498823+rusefillc@users.noreply.github.com> Date: Sat, 28 Jan 2023 23:21:55 +0530 Subject: [PATCH] Issue 4992 (#5009) * change bundle name (cherry picked from commit c3dea808adee1588e2cabc2019df0d383a4ba580) * set primary bundle name (cherry picked from commit 4fd1e86657b82ca975dfa34387b7ab2c4b5d92f6) * autoupdate subdir (cherry picked from commit 1a817285b5e20f7264432a7e9145b1e35d4e95fe) * try passing empty strings (cherry picked from commit 2efcafef6b439aa300c49e4e1bfe036a2a8d6b07) * fix folder logic (cherry picked from commit e38ce6221f1e21e0f6496c1b1f21505c1c7559b3) * don't need empty strings duh (cherry picked from commit c20585cbc26dd03bda87905494c573680ca7a6be) * encapsulate ini file --------- Co-authored-by: David Holdeman --- .github/workflows/build-firmware.yaml | 4 ++-- misc/jenkins/build_working_folder.sh | 10 ++++++++-- misc/jenkins/compile_other_versions/prepare_bundle.sh | 6 +++++- .../build_current_bundle.sh | 8 ++++++-- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-firmware.yaml b/.github/workflows/build-firmware.yaml index 75f897986f..68fbae8f82 100644 --- a/.github/workflows/build-firmware.yaml +++ b/.github/workflows/build-firmware.yaml @@ -390,7 +390,7 @@ jobs: - name: Package Bundle if: ${{( github.event_name == 'push' && github.ref == 'refs/heads/master' && env.skip != 'true' ) || inputs.lts }} - run: bash misc/jenkins/compile_other_versions/prepare_bundle.sh ${{matrix.build-target}} ${{matrix.ini-file}} ${{ github.ref_name }} ${{ toJSON(inputs.lts) }} + run: bash misc/jenkins/compile_other_versions/prepare_bundle.sh ${{matrix.build-target}} "${{matrix.ini-file}}" ${{ github.ref_name }} ${{ toJSON(inputs.lts) }} - name: Upload .ini files if: ${{( github.event_name == 'push' && github.ref == 'refs/heads/master' && env.skip != 'true' ) || inputs.lts }} @@ -494,7 +494,7 @@ jobs: - name: Build Primary Bundle # 'OS="Windows_NT"' allows us to build Windows executable on unix - run: OS="Windows_NT" bash misc/jenkins/functional_test_and_build_bundle/build_current_bundle.sh + run: OS="Windows_NT" bash misc/jenkins/functional_test_and_build_bundle/build_current_bundle.sh ${{ github.ref_name }} ${{ toJSON(inputs.lts) }} - name: Package Bundle if: ${{( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || inputs.lts }} diff --git a/misc/jenkins/build_working_folder.sh b/misc/jenkins/build_working_folder.sh index 6c8feee6cb..c82342cc6c 100755 --- a/misc/jenkins/build_working_folder.sh +++ b/misc/jenkins/build_working_folder.sh @@ -149,8 +149,14 @@ zip -r ../$UPDATE_BUNDLE_FILE * cd .. ls -l $UPDATE_BUNDLE_FILE if [ -n "$RUSEFI_SSH_USER" ]; then - tar -czf - $UPDATE_BUNDLE_FILE | sshpass -p $RUSEFI_SSH_PASS ssh -o StrictHostKeyChecking=no $RUSEFI_SSH_USER@$RUSEFI_SSH_SERVER "tar -xzf - -C build_server/autoupdate" - retVal=$? + retVal=0 + if [ "$2" = "true" ]; then + tar -czf - $UPDATE_BUNDLE_FILE | sshpass -p $RUSEFI_SSH_PASS ssh -o StrictHostKeyChecking=no $RUSEFI_SSH_USER@$RUSEFI_SSH_SERVER "mkdir -p build_server/lts/$1/autoupdate; tar -xzf - -C build_server/lts/$1/autoupdate" + retVal=$? + else + tar -czf - $UPDATE_BUNDLE_FILE | sshpass -p $RUSEFI_SSH_PASS ssh -o StrictHostKeyChecking=no $RUSEFI_SSH_USER@$RUSEFI_SSH_SERVER "mkdir -p build_server/autoupdate; tar -xzf - -C build_server/autoupdate" + retVal=$? + fi if [ $retVal -ne 0 ]; then echo "autoupdate upload failed" exit 1 diff --git a/misc/jenkins/compile_other_versions/prepare_bundle.sh b/misc/jenkins/compile_other_versions/prepare_bundle.sh index 73678e7244..db2e9f457a 100644 --- a/misc/jenkins/compile_other_versions/prepare_bundle.sh +++ b/misc/jenkins/compile_other_versions/prepare_bundle.sh @@ -8,7 +8,11 @@ echo "RUSEFI_BUILD_FTP_USER=$RUSEFI_BUILD_FTP_USER" TIMESTAMP=$(date "+%Y%m%d_%H%M%S") -export FOLDER="temp/snapshot_${TIMESTAMP}_${BUNDLE_NAME}_rusefi" +if [ "$4" = "true" ]; then + export FOLDER="temp/rusefi.${3}.${BUNDLE_NAME}" +else + export FOLDER="temp/rusefi.snapshot.${BUNDLE_NAME}" +fi export BUNDLE_FULL_NAME="rusefi_bundle_${BUNDLE_NAME}" diff --git a/misc/jenkins/functional_test_and_build_bundle/build_current_bundle.sh b/misc/jenkins/functional_test_and_build_bundle/build_current_bundle.sh index 6e6194f4c2..f5a988df6c 100755 --- a/misc/jenkins/functional_test_and_build_bundle/build_current_bundle.sh +++ b/misc/jenkins/functional_test_and_build_bundle/build_current_bundle.sh @@ -66,7 +66,11 @@ bash misc/jenkins/build_simulator.sh || { echo "rusefi_simulator.exe build FAILE STM_ARCH="stm32f407" TIMESTAMP=$(date "+%Y%m%d_%H%M%S") -FOLDER="snapshot_${TIMESTAMP}_${STM_ARCH}_rusefi" +if [ "$2" = "true" ]; then + FOLDER="rusefi.${1}.${STM_ARCH}" +else + FOLDER="rusefi.snapshot.${STM_ARCH}" +fi echo "$SCRIPT_NAME: folder variable1=$FOLDER" export FOLDER="temp/$FOLDER" echo "$SCRIPT_NAME: folder variable3=$FOLDER" @@ -74,7 +78,7 @@ echo "$SCRIPT_NAME: folder variable3=$FOLDER" pwd # DfuFlasher.java validates this prefix export BUNDLE_FULL_NAME="rusefi_bundle" -bash misc/jenkins/build_working_folder.sh +bash misc/jenkins/build_working_folder.sh "$1" "$2" [ $? -eq 0 ] || { echo "$SCRIPT_NAME: ERROR: invoking build_working_folder.sh"; exit 1; } echo "$SCRIPT_NAME: Going back to root folder"