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
old-commit-hash: 32f03ec8a5
commatwo_master
parent
73c800a16c
commit
de457fddc2
6 changed files with 67 additions and 115 deletions
@ -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])) |
Loading…
Reference in new issue