mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-06 08:46:11 +08:00
On-device CI framework (#1784)
* let's see if this works * fix build_release actions job * does jenkins like this config * separate jenkinsfile for release build * fix devel build * devel build should work * always pass that for now * run modeld replay * release2 build will be a separate PR * pass env to phone shell * force checkout * run on real jenkins eons * add timeout * rsync * more timeout * trailing slash * fix branch detection * debug * not sure why paramiko doesn't pass it through * newline * CI_PUSH * still not passing it * test branch * should be good now
This commit is contained in:
@@ -37,7 +37,7 @@ echo "[-] bringing master-ci and devel in sync T=$SECONDS"
|
||||
git fetch origin master-ci
|
||||
git fetch origin devel
|
||||
|
||||
git checkout --track origin/master-ci || true
|
||||
git checkout -f --track origin/master-ci
|
||||
git reset --hard master-ci
|
||||
git checkout master-ci
|
||||
git reset --hard origin/devel
|
||||
@@ -93,9 +93,9 @@ pushd panda/board/pedal
|
||||
make obj/comma.bin
|
||||
popd
|
||||
|
||||
if [ ! -z "$PUSH" ]; then
|
||||
echo "[-] Pushing to $PUSH T=$SECONDS"
|
||||
git push -f origin master-ci:$PUSH
|
||||
if [ ! -z "$CI_PUSH" ]; then
|
||||
echo "[-] Pushing to $CI_PUSH T=$SECONDS"
|
||||
git push -f origin master-ci:$CI_PUSH
|
||||
fi
|
||||
|
||||
echo "[-] done pushing T=$SECONDS"
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
README.md
|
||||
SAFETY.md
|
||||
|
||||
.gitignore
|
||||
LICENSE
|
||||
launch_chffrplus.sh
|
||||
launch_openpilot.sh
|
||||
|
||||
CONTRIBUTING.md
|
||||
RELEASES.md
|
||||
|
||||
Jenkinsfile
|
||||
SConstruct
|
||||
|
||||
CONTRIBUTING.md
|
||||
README.md
|
||||
RELEASES.md
|
||||
SAFETY.md
|
||||
|
||||
apk/ai.comma*.apk
|
||||
|
||||
common/.gitignore
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/usr/bin/env python2
|
||||
import paramiko # pylint: disable=import-error
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import time
|
||||
import socket
|
||||
|
||||
|
||||
def start_build(name):
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
|
||||
key_file = open(os.path.join(os.path.dirname(__file__), "../tools/ssh/key/id_rsa"))
|
||||
key = paramiko.RSAKey.from_private_key(key_file)
|
||||
|
||||
print("SSH to phone {}".format(name))
|
||||
|
||||
# Try connecting for one minute
|
||||
t_start = time.time()
|
||||
while True:
|
||||
try:
|
||||
ssh.connect(hostname=name, port=8022, pkey=key, timeout=10)
|
||||
except (paramiko.ssh_exception.SSHException, socket.timeout, paramiko.ssh_exception.NoValidConnectionsError):
|
||||
print("Connection failed")
|
||||
if time.time() - t_start > 60:
|
||||
raise
|
||||
else:
|
||||
break
|
||||
time.sleep(1)
|
||||
|
||||
conn = ssh.invoke_shell()
|
||||
branch = os.environ['GIT_BRANCH']
|
||||
commit = os.environ.get('GIT_COMMIT', branch)
|
||||
|
||||
conn.send('uname -a\n')
|
||||
|
||||
conn.send('cd /data/openpilot_source\n')
|
||||
conn.send("git reset --hard\n")
|
||||
conn.send("git fetch origin\n")
|
||||
conn.send("git checkout %s\n" % commit)
|
||||
conn.send("git clean -xdf\n")
|
||||
conn.send("git submodule update --init\n")
|
||||
conn.send("git submodule foreach --recursive git reset --hard\n")
|
||||
conn.send("git submodule foreach --recursive git clean -xdf\n")
|
||||
conn.send("echo \"git took $SECONDS seconds\"\n")
|
||||
|
||||
push = "PUSH=master-ci" if branch == "master" else ""
|
||||
|
||||
conn.send("%s /data/openpilot_source/release/build_devel.sh\n" % push)
|
||||
conn.send('echo "RESULT:" $?\n')
|
||||
conn.send("exit\n")
|
||||
return conn
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
eon_name = os.environ.get('eon_name', None)
|
||||
|
||||
conn = start_build(eon_name)
|
||||
|
||||
dat = b""
|
||||
|
||||
while True:
|
||||
recvd = conn.recv(4096)
|
||||
if len(recvd) == 0:
|
||||
break
|
||||
|
||||
dat += recvd
|
||||
sys.stdout.buffer.write(recvd)
|
||||
sys.stdout.flush()
|
||||
|
||||
returns = re.findall(rb'^RESULT: (\d+)', dat[-1024:], flags=re.MULTILINE)
|
||||
sys.exit(int(returns[0]))
|
||||
Reference in New Issue
Block a user