upload ini from firmware build (#4456)

This commit is contained in:
Matthew Kennedy 2022-08-17 15:29:07 -07:00 committed by GitHub
parent 423f69a842
commit 3e09a6cf35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 34 deletions

View File

@ -354,6 +354,10 @@ jobs:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && env.skip != 'true' }}
run: bash misc/jenkins/compile_other_versions/prepare_bundle.sh ${{matrix.build-target}} ${{matrix.ini-file}}
- name: Upload .ini files
working-directory: ./firmware/tunerstudio/generated
run: ../upload_ini.sh ${{matrix.ini-file}} ${{ secrets.RUSEFI_ONLINE_FTP_USER }} ${{ secrets.RUSEFI_ONLINE_FTP_PASS }} ${{ secrets.RUSEFI_FTP_SERVER }}
- name: Upload build elf
if: ${{ github.event_name != 'push' || github.ref != 'refs/heads/master' && env.skip != 'true' }}
uses: actions/upload-artifact@v3

View File

@ -80,10 +80,6 @@ jobs:
github_token: ${{ github.token }}
branch: ${{ steps.extract_branch.outputs.branch }}
- name: Upload .ini files
working-directory: ./firmware/tunerstudio/generated
run: ../upload_ini.sh ${{ secrets.RUSEFI_ONLINE_FTP_USER }} ${{ secrets.RUSEFI_ONLINE_FTP_PASS }} ${{ secrets.RUSEFI_FTP_SERVER }}
- name: Print Compiler version
# NOTE: on mac, this is actually symlink'd to clang, not gcc, but that's ok - we want to build on both
working-directory: .

View File

@ -1,10 +1,16 @@
#!/bin/bash
# user=$1
# pass=$2
# host=$3
# file=$1
# user=$2
# pass=$3
# host=$4
if [ ! "$1" ] || [ ! "$2" ] || [ ! "$3" ]; then
if [ ! "$1" ]; then
echo "No file"
exit 1
fi
if [ ! "$2" ] || [ ! "$3" ] || [ ! "$4" ]; then
echo "No Secrets"
exit 0
fi
@ -13,37 +19,35 @@ pwd
echo -e "\nUploading .ini files"
ls -l .
for f in *.ini; do if [[ -f "$f" ]]; then
echo "Processing file $f:"
sig=$(grep "^ *signature *=" $f | cut -f2 -d "=")
if [ ! -z "$sig" -a "$sig" != " " ]; then
echo "* found signature: $sig"
if [[ "$sig" =~ rusEFI.*([0-9]{4})\.([0-9]{2})\.([0-9]{2})\.([a-zA-Z0-9_-]+)\.([0-9]+) ]]; then
year=${BASH_REMATCH[1]}
month=${BASH_REMATCH[2]}
day=${BASH_REMATCH[3]}
board=${BASH_REMATCH[4]}
hash=${BASH_REMATCH[5]}
path="$year/$month/$day/$board/$hash.ini"
echo "* found path: $path"
# we do not have ssh for this user
# sftp does not support -p flag on mkdir :(
sshpass -p $2 sftp -o StrictHostKeyChecking=no $1@$3 <<SSHCMD
echo "Processing file $1:"
sig=$(grep "^ *signature *=" $1 | cut -f2 -d "=")
if [ ! -z "$sig" -a "$sig" != " " ]; then
echo "* found signature: $sig"
if [[ "$sig" =~ rusEFI.*([0-9]{4})\.([0-9]{2})\.([0-9]{2})\.([a-zA-Z0-9_-]+)\.([0-9]+) ]]; then
year=${BASH_REMATCH[1]}
month=${BASH_REMATCH[2]}
day=${BASH_REMATCH[3]}
board=${BASH_REMATCH[4]}
hash=${BASH_REMATCH[5]}
path="$year/$month/$day/$board/$hash.ini"
echo "* found path: $path"
# we do not have ssh for this user
# sftp does not support -p flag on mkdir :(
sshpass -p $3 sftp -o StrictHostKeyChecking=no $2@$4 <<SSHCMD
cd rusefi
mkdir $year
mkdir $year/$month
mkdir $year/$month/$day
mkdir $year/$month/$day/$board
put $f $path
put $1 $path
SSHCMD
retVal=$?
if [ $retVal -ne 0 ]; then
echo "Upload failed"
exit 1
fi
echo "* upload done!"
else
echo "Unexpected $sig"
retVal=$?
if [ $retVal -ne 0 ]; then
echo "Upload failed"
exit 1
fi
echo "* upload done!"
else
echo "Unexpected $sig"
fi
fi; done
fi