agnos casync script improvements (#32156)

* build agnos

* include path

* cleanup

* rm this

* test it

* all agnos partitions are AB

* fix that

* correct

* build agnos first

* better temp dir

* revert the order

* try it on pc

* test it

* upload and fix

* build

* pass in environemnt variable

* not in jenkins
old-commit-hash: ecb648a68a
pull/32199/head
Justin Newberry 1 year ago committed by GitHub
parent d3af84c43d
commit 933dd500c4
  1. 10
      release/create_casync_agnos_release.py
  2. 19
      release/create_release_manifest.py
  3. 7
      system/version.py

@ -1,3 +1,4 @@
#!/usr/bin/env python3
import argparse import argparse
import json import json
import pathlib import pathlib
@ -5,13 +6,15 @@ import tempfile
from openpilot.common.basedir import BASEDIR from openpilot.common.basedir import BASEDIR
from openpilot.system.hardware.tici.agnos import StreamingDecompressor, unsparsify, noop, AGNOS_MANIFEST_FILE from openpilot.system.hardware.tici.agnos import StreamingDecompressor, unsparsify, noop, AGNOS_MANIFEST_FILE
from openpilot.system.updated.casync.common import create_casync_from_file from openpilot.system.updated.casync.common import create_casync_from_file
from openpilot.system.version import get_agnos_version
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description="creates a casync release") parser = argparse.ArgumentParser(description="creates a casync release")
parser.add_argument("output_dir", type=str, help="output directory for the channel") parser.add_argument("output_dir", type=str, help="output directory for the channel")
parser.add_argument("version", type=str, help="version of agnos this is") parser.add_argument("working_dir", type=str, help="working directory")
parser.add_argument("--version", type=str, help="version of agnos this is", default=get_agnos_version())
parser.add_argument("--manifest", type=str, help="json manifest to create agnos release from", \ parser.add_argument("--manifest", type=str, help="json manifest to create agnos release from", \
default=str(pathlib.Path(BASEDIR) / AGNOS_MANIFEST_FILE)) default=str(pathlib.Path(BASEDIR) / AGNOS_MANIFEST_FILE))
args = parser.parse_args() args = parser.parse_args()
@ -19,9 +22,12 @@ if __name__ == "__main__":
output_dir = pathlib.Path(args.output_dir) output_dir = pathlib.Path(args.output_dir)
output_dir.mkdir(parents=True, exist_ok=True) output_dir.mkdir(parents=True, exist_ok=True)
working_dir = pathlib.Path(args.working_dir)
working_dir.mkdir(parents=True, exist_ok=True)
manifest_file = pathlib.Path(args.manifest) manifest_file = pathlib.Path(args.manifest)
with tempfile.NamedTemporaryFile() as entry_file: with tempfile.NamedTemporaryFile(dir=str(working_dir)) as entry_file:
entry_path = pathlib.Path(entry_file.name) entry_path = pathlib.Path(entry_file.name)
with open(manifest_file) as f: with open(manifest_file) as f:

@ -4,17 +4,16 @@ import dataclasses
import json import json
import pathlib import pathlib
from openpilot.common.run import run_cmd from openpilot.system.hardware.tici.agnos import AGNOS_MANIFEST_FILE, get_partition_path
from openpilot.system.hardware.tici.agnos import AGNOS_MANIFEST_FILE from openpilot.system.version import get_build_metadata, get_agnos_version
from openpilot.system.version import get_build_metadata
BASE_URL = "https://commadist.blob.core.windows.net" BASE_URL = "https://commadist.blob.core.windows.net"
CHANNEL_DATA = pathlib.Path(__file__).parent / "channel_data" / "agnos" CHANNEL_DATA = pathlib.Path(__file__).parent / "channel_data" / "agnos"
OPENPILOT_RELEASES = f"{BASE_URL}/openpilot-releases" OPENPILOT_RELEASES = f"{BASE_URL}/openpilot-releases/openpilot"
AGNOS_RELEASES = f"{BASE_URL}/agnos-releases" AGNOS_RELEASES = f"{BASE_URL}/openpilot-releases/agnos"
def create_partition_manifest(agnos_version, partition): def create_partition_manifest(agnos_version, partition):
@ -23,10 +22,11 @@ def create_partition_manifest(agnos_version, partition):
"casync": { "casync": {
"caibx": f"{AGNOS_RELEASES}/agnos-{agnos_version}-{partition['name']}.caibx" "caibx": f"{AGNOS_RELEASES}/agnos-{agnos_version}-{partition['name']}.caibx"
}, },
"name": partition["name"], "path": get_partition_path(0, partition),
"ab": True,
"size": partition["size"], "size": partition["size"],
"full_check": partition["full_check"], "full_check": partition["full_check"],
"hash_raw": partition["hash_raw"] "hash_raw": partition["hash_raw"],
} }
@ -49,15 +49,12 @@ if __name__ == "__main__":
with open(pathlib.Path(args.target_dir) / AGNOS_MANIFEST_FILE) as f: with open(pathlib.Path(args.target_dir) / AGNOS_MANIFEST_FILE) as f:
agnos_manifest = json.load(f) agnos_manifest = json.load(f)
agnos_version = run_cmd(["bash", "-c", r"unset AGNOS_VERSION && source launch_env.sh && \
echo -n $AGNOS_VERSION"], args.target_dir).strip()
build_metadata = get_build_metadata(args.target_dir) build_metadata = get_build_metadata(args.target_dir)
ret = { ret = {
"build_metadata": dataclasses.asdict(build_metadata), "build_metadata": dataclasses.asdict(build_metadata),
"manifest": [ "manifest": [
*[create_partition_manifest(agnos_version, entry) for entry in agnos_manifest], *[create_partition_manifest(get_agnos_version(args.target_dir), entry) for entry in agnos_manifest],
create_openpilot_manifest(build_metadata) create_openpilot_manifest(build_metadata)
] ]
} }

@ -10,7 +10,7 @@ from openpilot.common.basedir import BASEDIR
from openpilot.common.swaglog import cloudlog from openpilot.common.swaglog import cloudlog
from openpilot.common.utils import cache from openpilot.common.utils import cache
from openpilot.common.git import get_commit, get_origin, get_branch, get_short_branch, get_commit_date from openpilot.common.git import get_commit, get_origin, get_branch, get_short_branch, get_commit_date
from openpilot.common.run import run_cmd
RELEASE_BRANCHES = ['release3-staging', 'release3', 'nightly'] RELEASE_BRANCHES = ['release3-staging', 'release3', 'nightly']
TESTED_BRANCHES = RELEASE_BRANCHES + ['devel', 'devel-staging'] TESTED_BRANCHES = RELEASE_BRANCHES + ['devel', 'devel-staging']
@ -157,6 +157,11 @@ def get_build_metadata(path: str = BASEDIR) -> BuildMetadata:
raise Exception("invalid build metadata") raise Exception("invalid build metadata")
def get_agnos_version(directory: str = BASEDIR) -> str:
return run_cmd(["bash", "-c", r"unset AGNOS_VERSION && source launch_env.sh && \
echo -n $AGNOS_VERSION"], cwd=directory).strip()
if __name__ == "__main__": if __name__ == "__main__":
from openpilot.common.params import Params from openpilot.common.params import Params

Loading…
Cancel
Save