diff --git a/Jenkinsfile b/Jenkinsfile index 1964028018..bc4079604f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -146,7 +146,7 @@ def build_release(String channel_name) { return parallel ( "${channel_name} (git)": { deviceStage("build git", "tici-needs-can", [], [ - ["build ${channel_name}", "RELEASE=1 OPENPILOT_CHANNEL=${channel_name} BUILD_DIR=/data/openpilot_build $SOURCE_DIR/release/create_git_prebuilt.sh"], + ["build ${channel_name}", "RELEASE=1 OPENPILOT_CHANNEL=${channel_name} BUILD_DIR=/data/openpilot_build $SOURCE_DIR/release/build_release.sh"], ]) }, "${channel_name} (casync)": { diff --git a/release/create_git_prebuilt.sh b/release/build_release.sh similarity index 52% rename from release/create_git_prebuilt.sh rename to release/build_release.sh index def9cf1c37..08f8a5a185 100755 --- a/release/create_git_prebuilt.sh +++ b/release/build_release.sh @@ -6,8 +6,21 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" cd $DIR -SOURCE_DIR="$(git -C $DIR rev-parse --show-toplevel)" -BUILD_DIR="${BUILD_DIR:=$(mktemp -d)}" +BUILD_DIR=/data/openpilot +SOURCE_DIR="$(git rev-parse --show-toplevel)" + +if [ -f /TICI ]; then + FILES_SRC="release/files_tici" +else + echo "no release files set" + exit 1 +fi + +if [ -z "$RELEASE_BRANCH" ]; then + echo "RELEASE_BRANCH is not set" + exit 1 +fi + # set git identity source $DIR/identity.sh @@ -18,14 +31,20 @@ mkdir -p $BUILD_DIR cd $BUILD_DIR git init git remote add origin git@github.com:commaai/openpilot.git -git checkout --orphan $OPENPILOT_CHANNEL +git checkout --orphan $RELEASE_BRANCH # do the files copy echo "[-] copying files T=$SECONDS" cd $SOURCE_DIR -release/copy_build_files.sh $SOURCE_DIR $BUILD_DIR +cp -pR --parents $(cat release/files_common) $BUILD_DIR/ +cp -pR --parents $(cat $FILES_SRC) $BUILD_DIR/ +# in the directory cd $BUILD_DIR + +rm -f panda/board/obj/panda.bin.signed +rm -f panda/board/obj/panda_h7.bin.signed + VERSION=$(cat common/version.h | awk -F[\"-] '{print $2}') echo "#define COMMA_VERSION \"$VERSION-release\"" > common/version.h @@ -33,10 +52,12 @@ echo "[-] committing version $VERSION T=$SECONDS" git add -f . git commit -a -m "openpilot v$VERSION release" -echo "[-] creating prebuilt T=$SECONDS" -release/create_prebuilt.sh $BUILD_DIR +# Build +export PYTHONPATH="$BUILD_DIR" +scons -j$(nproc) -cd $BUILD_DIR +# release panda fw +CERT=/data/pandaextra/certs/release RELEASE=1 scons -j$(nproc) panda/ # Ensure no submodules in release if test "$(git submodule--helper list | wc -l)" -gt "0"; then @@ -46,6 +67,22 @@ if test "$(git submodule--helper list | wc -l)" -gt "0"; then fi git submodule status +# Cleanup +find . -name '*.a' -delete +find . -name '*.o' -delete +find . -name '*.os' -delete +find . -name '*.pyc' -delete +find . -name 'moc_*' -delete +find . -name '__pycache__' -delete +rm -rf .sconsign.dblite Jenkinsfile release/ +rm selfdrive/modeld/models/supercombo.onnx + +# Restore third_party +git checkout third_party/ + +# Mark as prebuilt release +touch prebuilt + # Add built files to git git add -f . git commit --amend -m "openpilot v$VERSION" @@ -55,14 +92,14 @@ TEST_FILES="tools/" cd $SOURCE_DIR cp -pR -n --parents $TEST_FILES $BUILD_DIR/ cd $BUILD_DIR -selfdrive/test/test_onroad.py +RELEASE=1 selfdrive/test/test_onroad.py #selfdrive/manager/test/test_manager.py #selfdrive/car/tests/test_car_interfaces.py rm -rf $TEST_FILES -if [ ! -z "$OPENPILOT_CHANNEL" ]; then +if [ ! -z "$RELEASE_BRANCH" ]; then echo "[-] pushing release T=$SECONDS" - git push -f origin $OPENPILOT_CHANNEL:$OPENPILOT_CHANNEL + git push -f origin $RELEASE_BRANCH:$RELEASE_BRANCH fi echo "[-] done T=$SECONDS"