From 301eb3f673f1baaa46af0b0d35806d74009c3b53 Mon Sep 17 00:00:00 2001 From: Erik Jaegervall Date: Thu, 7 Mar 2024 18:02:43 +0100 Subject: [PATCH] Test 3 --- .github/workflows/hvac_integration_test.yml | 2 +- .github/workflows/seat_integration_test.yml | 2 +- .../workflows/seat_service_debug_build.yml | 2 +- .github/workflows/seat_service_docu_build.yml | 2 +- .../workflows/seat_service_release_build.yml | 2 +- .../workflows/seat_service_seatctrl_test.yml | 2 +- .vscode/README.md | 35 -- .vscode/scripts/clean-binaries.sh | 33 -- .vscode/scripts/ensure-dapr.sh | 46 -- .vscode/scripts/k3d-uninstall.sh | 28 -- .vscode/scripts/run-databroker-cli.sh | 44 -- .vscode/scripts/run-databroker.sh | 100 ----- .vscode/scripts/run-feedercan.sh | 125 ------ .vscode/scripts/run-hvac-cli.sh | 61 --- .vscode/scripts/run-hvacservice.sh | 67 --- .vscode/scripts/run-integrationtest.sh | 95 ---- .vscode/scripts/run-kuksa-cli.sh | 46 -- .vscode/scripts/run-mockservice.sh | 68 --- .vscode/scripts/run-seatservice-cli.sh | 48 -- .vscode/scripts/run-seatservice.sh | 102 ----- .vscode/scripts/task-common.sh | 160 ------- .vscode/tasks.json | 423 ------------------ seat_service/.devcontainer/Dockerfile | 3 +- seat_service/Dockerfile | 4 +- seat_service/README.md | 17 +- seat_service/build-debug.sh | 4 + seat_service/build-release.sh | 4 +- seat_service/docker-build.sh | 8 +- seat_service/toolchains/target_aarch64_Debug | 2 +- .../toolchains/target_aarch64_Release | 2 +- seat_service/toolchains/target_x86_64_Debug | 2 +- seat_service/toolchains/target_x86_64_Release | 2 +- 32 files changed, 38 insertions(+), 1503 deletions(-) delete mode 100644 .vscode/README.md delete mode 100755 .vscode/scripts/clean-binaries.sh delete mode 100755 .vscode/scripts/ensure-dapr.sh delete mode 100755 .vscode/scripts/k3d-uninstall.sh delete mode 100755 .vscode/scripts/run-databroker-cli.sh delete mode 100755 .vscode/scripts/run-databroker.sh delete mode 100755 .vscode/scripts/run-feedercan.sh delete mode 100755 .vscode/scripts/run-hvac-cli.sh delete mode 100755 .vscode/scripts/run-hvacservice.sh delete mode 100755 .vscode/scripts/run-integrationtest.sh delete mode 100755 .vscode/scripts/run-kuksa-cli.sh delete mode 100755 .vscode/scripts/run-mockservice.sh delete mode 100755 .vscode/scripts/run-seatservice-cli.sh delete mode 100755 .vscode/scripts/run-seatservice.sh delete mode 100755 .vscode/scripts/task-common.sh delete mode 100644 .vscode/tasks.json diff --git a/.github/workflows/hvac_integration_test.yml b/.github/workflows/hvac_integration_test.yml index 05796ee..45f54e9 100644 --- a/.github/workflows/hvac_integration_test.yml +++ b/.github/workflows/hvac_integration_test.yml @@ -31,7 +31,7 @@ concurrency: jobs: integration-test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Adding github workspace as safe directory diff --git a/.github/workflows/seat_integration_test.yml b/.github/workflows/seat_integration_test.yml index df0b7f9..ec256ae 100644 --- a/.github/workflows/seat_integration_test.yml +++ b/.github/workflows/seat_integration_test.yml @@ -32,7 +32,7 @@ concurrency: jobs: integration-test: # reduce runtime requirements from libc/libc++ - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest # container: # image: ghcr.io/${{ github.repository }}/oci_kuksa-val-services-ci:v0.1.0 # credentials: diff --git a/.github/workflows/seat_service_debug_build.yml b/.github/workflows/seat_service_debug_build.yml index 153d482..22b805b 100644 --- a/.github/workflows/seat_service_debug_build.yml +++ b/.github/workflows/seat_service_debug_build.yml @@ -28,7 +28,7 @@ concurrency: jobs: build: # reduce runtime requirements from libc/libc++ - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 name: Build strategy: matrix: diff --git a/.github/workflows/seat_service_docu_build.yml b/.github/workflows/seat_service_docu_build.yml index 1474204..d24c96c 100644 --- a/.github/workflows/seat_service_docu_build.yml +++ b/.github/workflows/seat_service_docu_build.yml @@ -28,7 +28,7 @@ concurrency: jobs: build: # reduce runtime requirements from libc/libc++ - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest name: Build docu steps: diff --git a/.github/workflows/seat_service_release_build.yml b/.github/workflows/seat_service_release_build.yml index c89f6c5..8354bda 100644 --- a/.github/workflows/seat_service_release_build.yml +++ b/.github/workflows/seat_service_release_build.yml @@ -21,7 +21,7 @@ on: jobs: build: # reduce runtime requirements from libc/libc++ - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 name: Build strategy: matrix: diff --git a/.github/workflows/seat_service_seatctrl_test.yml b/.github/workflows/seat_service_seatctrl_test.yml index 0c1c2fc..1bb9fc9 100644 --- a/.github/workflows/seat_service_seatctrl_test.yml +++ b/.github/workflows/seat_service_seatctrl_test.yml @@ -37,7 +37,7 @@ jobs: build: # reduce runtime requirements from libc/libc++ - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 name: Build steps: - name: adding github workspace as safe directory diff --git a/.vscode/README.md b/.vscode/README.md deleted file mode 100644 index eaf00b1..0000000 --- a/.vscode/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# VS Code Tasks - -VS Code tasks are used to execute the VAL components (using similar setup as in [`vehicle-app-python-template`](https://github.com/eclipse-velocitas/vehicle-app-python-template)). - -To execute a task, press `F1` (or `Ctrl+Shift+P`), `"Tasks: Run Task"`, select a task to run... - -List of VAL core component tasks: - -- `ensure-dapr` - make sure dapr is locally installed. All dapr related tasks depend on this. -- `run-databroker` - runs databroker via dapr (downloads configured binary release). Depends on "ensure-dapr". -- `run-hvacservice` - runs the HVAC service via dapr. Depends on "run-databroker". -- `run-seatservice` - runs seat service via dapr (building amd64 binary if missing). Depends on "run-databroker". -- `run-feedercan` - runs dbc2val(feedercan) from sources (git checkout configured branch). Depends on "run-databroker". - -List of VAL client tasks: - -- `run-databroker-cli` - runs databroker command line interface client -- `run-seat-cli` - runs seat service client. Asks user for following inputs: - - "Seat Position": Desired seat position [0..1000]. Default: 500. - - "Wait": client prints seat position, until desired position is reached. Default: "Wait". -- `run-hvac-cli` - runs the HVAC test client allowing to enable/disable the AC and setting the desired cabin temperature. - -Helper tasks: - -- `Terminate Tasks` - Stops all running vs code tasks -- `Start VAL` - Terminates all tasks and restarts VAL components. Could be useful after rebuilding binaries. -- `Clean VAL binaries` - removes SeatService binaries from target install to force rebuilding. Depends on "Terminate Tasks" -- `integration-test (local)` - Runs local integration tests in `USE_DAPR=1` mode using pytest. Depends on core VAL service tasks -- `integration-test (containers)` - Runs integration tests in val containers (`USE_DAPR=0` mode) using pytest. - -**NOTES:** - -- Tasks are defined in `.vscode/tasks.json` and mostly wrap scripts in `.vscode/scripts`, but also have extras like dependencies and terminal integration. -- VAL component versions/tags are defined in `./prerequisite_settings.json` -- Docker container configuration (e.g. log levels, custom volume mapping) can be changed in `./integration_test/it-config` diff --git a/.vscode/scripts/clean-binaries.sh b/.vscode/scripts/clean-binaries.sh deleted file mode 100755 index aedef6c..0000000 --- a/.vscode/scripts/clean-binaries.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -#******************************************************************************** -# Copyright (c) 2022 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License 2.0 which is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -#*******************************************************************************/ -# shellcheck disable=SC2086 - -echo "#######################################################" -echo "### Clean binaries ###" -echo "#######################################################" - -set -e - -ROOT_DIRECTORY=$(git rev-parse --show-toplevel) -# shellcheck source=/dev/null -source "$ROOT_DIRECTORY/.vscode/scripts/task-common.sh" "$@" - -CLEAN_FILES="$ROOT_DIRECTORY/seat_service/target/x86_64/release/install" -CLEAN_FILES="$ROOT_DIRECTORY/seat_service/target/aarch64/release/install $CLEAN_FILES" - -#CLEAN_FILES="$ROOT_DIRECTORY/target/release/vehicle-data-* $CLEAN_FILES" -#CLEAN_FILES="$ROOT_DIRECTORY/target/aarch64-unknown-linux-gnu/release/vehicle-data-* $CLEAN_FILES" - -set -x -rm -rfv $CLEAN_FILES diff --git a/.vscode/scripts/ensure-dapr.sh b/.vscode/scripts/ensure-dapr.sh deleted file mode 100755 index beb9748..0000000 --- a/.vscode/scripts/ensure-dapr.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -#******************************************************************************** -# Copyright (c) 2022 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License 2.0 which is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -#*******************************************************************************/ -# shellcheck disable=SC2046 -# shellcheck disable=SC2086 - -echo "#######################################################" -echo "### Ensure dapr ###" -echo "#######################################################" - -ROOT_DIRECTORY="$(git rev-parse --show-toplevel)" -# shellcheck source=/dev/null -source "$ROOT_DIRECTORY/.vscode/scripts/task-common.sh" "$@" - -version=$(dapr --version | grep "Runtime version: " | sed 's/^.*: //') - -if ! [[ $version =~ ^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{1,2}) ]]; then - daprReleaseUrl="https://api.github.com/repos/dapr/cli/releases" - latest_release=$(curl -s $daprReleaseUrl | grep \"tag_name\" | grep -v rc | awk 'NR==1{print $2}' | sed -n 's/\"\(.*\)\",/\1/p') - # NOTE: 1.6.0 requires too old protobuf, better upgrade it - daprVersion="1.8.1" - if [ -z "$latest_release" ]; then - echo "Installing dapr pre-defined version: ${daprVersion}" - wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash -s "$daprVersion" - else - echo "Installing dapr latest version: $latest_release" - wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash - fi - - dapr uninstall - dapr init -else - echo "Dapr is already installed and initialized, skipping setup." -fi - -dapr --version diff --git a/.vscode/scripts/k3d-uninstall.sh b/.vscode/scripts/k3d-uninstall.sh deleted file mode 100755 index be911cf..0000000 --- a/.vscode/scripts/k3d-uninstall.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -#******************************************************************************** -# Copyright (c) 2022 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License 2.0 which is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -#*******************************************************************************/ - -echo "#######################################################" -echo "### k3s uninstall ###" -echo "#######################################################" - -ROOT_DIRECTORY=$(git rev-parse --show-toplevel) -# shellcheck source=/dev/null -source "$ROOT_DIRECTORY/.vscode/scripts/task-common.sh" "$@" - -k3d cluster delete dev-cluster -k3d node delete k3d-devregistry.localhost - -kubectl delete --all pods -kubectl delete --all deployments -kubectl delete --all namespaces diff --git a/.vscode/scripts/run-databroker-cli.sh b/.vscode/scripts/run-databroker-cli.sh deleted file mode 100755 index b341ec7..0000000 --- a/.vscode/scripts/run-databroker-cli.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -#******************************************************************************** -# Copyright (c) 2022 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License 2.0 which is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -#*******************************************************************************/ -# shellcheck disable=SC2002 - -echo "#######################################################" -echo "### Running DataBroker CLI ###" -echo "#######################################################" - -ROOT_DIRECTORY=$(git rev-parse --show-toplevel) -# shellcheck source=/dev/null -source "$ROOT_DIRECTORY/.vscode/scripts/task-common.sh" "$@" - -DATABROKER_VERSION=$(jq -r '.databroker.version // empty' "$CONFIG_JSON") -if [ -z "$DATABROKER_VERSION" ]; then - echo "Coudln't find databroker version from $CONFIG_JSON" - exit 1 -fi - -# https://github.com/eclipse/kuksa.val/releases/download/0.3.0/databroker-cli-amd64.tar.gz - -DATABROKER_BINARY_ZIP="databroker-cli-$PROCESSOR_ALT.zip" -DATABROKER_BINARY_NAME="databroker-cli-$PROCESSOR_ALT.tar.gz" - -DOWNLOAD_URL="https://github.com/eclipse/kuksa.val/releases/download/$DATABROKER_VERSION/$DATABROKER_BINARY_ZIP" -#DOWNLOAD_URL="https://github.com/eclipse/kuksa.val/releases/download/$DATABROKER_VERSION/$DATABROKER_BINARY_NAME" - -DATABROKER_BINARY_NAME="databroker-cli-$PROCESSOR_ALT.tar.gz" -DATABROKER_BINARY_PATH="$ROOT_DIRECTORY/.vscode/scripts/assets/databroker/$DATABROKER_VERSION/$PROCESSOR_ALT" -DATABROKERCLI_EXECUTABLE="$DATABROKER_BINARY_PATH/databroker-cli/databroker-cli" - -download_zip_release "$DATABROKERCLI_EXECUTABLE" "$DOWNLOAD_URL" "$DATABROKER_BINARY_PATH" "$DATABROKER_BINARY_ZIP" "$DATABROKER_BINARY_NAME" || exit 1 - -"$DATABROKERCLI_EXECUTABLE" \ No newline at end of file diff --git a/.vscode/scripts/run-databroker.sh b/.vscode/scripts/run-databroker.sh deleted file mode 100755 index 893cfa5..0000000 --- a/.vscode/scripts/run-databroker.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/bash -#******************************************************************************** -# Copyright (c) 2022 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License 2.0 which is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -#*******************************************************************************/ -# shellcheck disable=SC2086 -# shellcheck disable=SC2181 - -echo "#######################################################" -echo "### Running Databroker ###" -echo "#######################################################" - -set -e - -ROOT_DIRECTORY=$(git rev-parse --show-toplevel) -# shellcheck source=/dev/null -source "$ROOT_DIRECTORY/.vscode/scripts/task-common.sh" "$@" - -### NOTE: DATABROKER_* variables are defined in task-common.sh -# # Databroker App port -# DATABROKER_PORT='55555' -# # Databroker Dapr Sidecar gRPC port -# DATABROKER_GRPC_PORT='52001' -# # Dapr app id for databroker -# VEHICLEDATABROKER_DAPR_APP_ID='vehicledatabroker' - -export DAPR_GRPC_PORT=$DATABROKER_GRPC_PORT - -DATABROKER_VERSION=$(jq -r '.databroker.version // empty' "$CONFIG_JSON") -if [ -z "$DATABROKER_VERSION" ]; then - echo "Coudln't find databroker version from $CONFIG_JSON" - exit 1 -fi - -# https://github.com/eclipse/kuksa.val/releases/download/0.3.0/databroker-amd64.tar.gz - -### change introduced since databroker 0.3.0 release, zip file containing tar.gz -# https://github.com/eclipse/kuksa.val/releases/download/0.4.0/databroker-amd64.zip - -DATABROKER_BINARY_ZIP="databroker-$PROCESSOR_ALT.zip" -DATABROKER_BINARY_NAME="databroker-$PROCESSOR_ALT.tar.gz" -DATABROKER_BINARY_PATH="$ROOT_DIRECTORY/.vscode/scripts/assets/databroker/$DATABROKER_VERSION/$PROCESSOR_ALT" -DATABROKER_EXECUTABLE="$DATABROKER_BINARY_PATH/databroker/databroker" -DOWNLOAD_URL="https://github.com/eclipse/kuksa.val/releases/download/$DATABROKER_VERSION/$DATABROKER_BINARY_ZIP" - -download_zip_release "$DATABROKER_EXECUTABLE" "$DOWNLOAD_URL" "$DATABROKER_BINARY_PATH" "$DATABROKER_BINARY_ZIP" "$DATABROKER_BINARY_NAME" || exit 1 - -### Data Broker environment setup ### - -## Uncomment for feed values debug -export RUST_LOG="debug,databroker=debug,vehicle_data_broker=debug,h2=info" -##export GRPC_TRACE=all,-timer,-timer_check -##export GRPC_VERBOSITY=DEBUG - -### pre-load vss json versions -if [ ! -f $DATABROKER_BINARY_PATH/vss3.json ] || [ ! -f $DATABROKER_BINARY_PATH/vss4.json ]; then - echo "# Downloading $DATABROKER_BINARY_PATH/vss*.json ..." - wget -q "https://raw.githubusercontent.com/eclipse/kuksa.val/master/data/vss-core/vss_release_3.0.json" -O "$DATABROKER_BINARY_PATH/vss3.json" - wget -q "https://raw.githubusercontent.com/eclipse/kuksa.val/master/data/vss-core/vss_release_4.0.json" -O "$DATABROKER_BINARY_PATH/vss4.json" -fi - -if [ "$USE_VSS3" = "1" ]; then - DATABROKER_METADATA="--metadata $DATABROKER_BINARY_PATH/vss3.json" -else - DATABROKER_METADATA="--metadata $DATABROKER_BINARY_PATH/vss4.json" -fi - -echo -echo "*******************************************" -echo "* Kuksa Data Broker app-id: $VEHICLEDATABROKER_DAPR_APP_ID" -echo "* Kuksa Data Broker APP port: $DATABROKER_PORT" -echo "* Kuksa Data Broker Dapr sidecar port: $DATABROKER_GRPC_PORT" -echo "* DAPR_GRPC_PORT=$DAPR_GRPC_PORT" -echo "* Dapr metadata: [ VEHICLEDATABROKER_DAPR_APP_ID=$VEHICLEDATABROKER_DAPR_APP_ID ]" -[ -n "$DATABROKER_METADATA" ] && echo "* Kuksa Data Broker Metadata: $DATABROKER_METADATA" -echo "*******************************************" -echo - -## Uncomment for dapr debug logs -# DAPR_OPT="--enable-api-logging --log-level debug" - -DAPR_OPT="--log-level warn" -dapr run \ - --app-id "$VEHICLEDATABROKER_DAPR_APP_ID" \ - --app-protocol grpc \ - --app-port $DATABROKER_PORT \ - --dapr-grpc-port $DATABROKER_GRPC_PORT \ - $DAPR_OPT \ - --components-path "$ROOT_DIRECTORY/.dapr/components" \ - --config "$ROOT_DIRECTORY/.dapr/config.yaml" \ - & # -- \ -$DATABROKER_EXECUTABLE --address 0.0.0.0 $DATABROKER_METADATA diff --git a/.vscode/scripts/run-feedercan.sh b/.vscode/scripts/run-feedercan.sh deleted file mode 100755 index 2f6020f..0000000 --- a/.vscode/scripts/run-feedercan.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/bash -#******************************************************************************** -# Copyright (c) 2022 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License 2.0 which is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -#*******************************************************************************/ -# shellcheck disable=SC2002 -# shellcheck disable=SC2086 - -echo "#######################################################" -echo "### Running FeederCan ###" -echo "#######################################################" - -set -e - -ROOT_DIRECTORY=$(git rev-parse --show-toplevel) - -# shellcheck source=/dev/null -source "$ROOT_DIRECTORY/.vscode/scripts/task-common.sh" "$@" - -### NOTE: FEEDERCAN_* variables are defined in task-common.sh -# -# FEEDERCAN_GRPC_PORT='52008' -# FEEDERCAN_DAPR_APP_ID="feedercan" - -# NOTE: use dapr sidecar's grpc port, don't connect directly to sidecar of kdb (DATABROKER_GRPC_PORT) -export DAPR_GRPC_PORT="$FEEDERCAN_GRPC_PORT" - -# NOTE: [config] feedercan.version is git tag for standalone tests, feedercan.imageVersion is for container tests -FEEDERCAN_VERSION=$(jq -r '.feedercan.version // empty' "$CONFIG_JSON") - -### Default feedercan settings (repo, tag are optional in json) -FEEDERCAN_REPO="https://github.com/eclipse-kuksa/kuksa-can-provider.git" -if [ -z "$FEEDERCAN_VERSION" ]; then - echo "Coudln't find feedercan version from $CONFIG_JSON" - exit 1 -fi - -# feedercan local asset path (with path-safe tag name) -FEEDERCAN_DIR="$ROOT_DIRECTORY/.vscode/scripts/assets/feedercan/${FEEDERCAN_VERSION//[^a-zA-Z0-9._-]/#}" -# path to dbcfeeder within the project -FEEDERCAN_EXEC_PATH="$FEEDERCAN_DIR/dbc2val" - -echo "### Starting from: $FEEDERCAN_EXEC_PATH" - -if [ ! -f "$FEEDERCAN_EXEC_PATH/dbcfeeder.py" ]; then - [ -d "$FEEDERCAN_DIR" ] || mkdir -p "$FEEDERCAN_DIR" - # decide if we want to checkout a branch, or download release sources - git_checkout "$FEEDERCAN_REPO" "$FEEDERCAN_DIR" "$FEEDERCAN_VERSION" -fi - -cd "$FEEDERCAN_EXEC_PATH" || exit 1 - -PYTHON_BIN="python3.9" -PIP3_BIN="pip3.9" - -if [ -z "$(which python3.9)" ]; then - echo "### WARNING! dbc2val requires python3.9" 1>&2 - echo "You may install 3.9 in pyenv. Check: https://github.com/pyenv/pyenv#installation" - echo "Or using apt:" - echo " sudo apt-get install -y python3.9" - echo " curl https://bootstrap.pypa.io/get-pip.py | python3.9" - echo " python3.9 --version" - echo " pip3.9 --version" - echo - # fallback to default python (e.g. it may be 3.10) - PYTHON_BIN="python3" - PIP3_BIN="pip3" -fi - -# PIP_OPT="--upgrade --retries 1 --timeout 3" -### IMPORTANT: dbc2val now requires python 3.9, does not work on python 3.8 -"$PIP3_BIN" install $PIP_OPT -q -r requirements.txt -r requirements-dev.txt - -#################################### -### feedercan environment setup #### -#################################### - -# Dir with integration test specific config and data for feedercan -CONFIG_DIR="$ROOT_DIRECTORY/integration_test/volumes/dbc2val" - -### Override default files for feedercan to be consistent with tests -export DBC_FILE="$CONFIG_DIR/it-can.dbc" -export MAPPING_FILE="$CONFIG_DIR/it-vss_4.0.json" -# uncomment if you need to test with DogMode datapoints (requires custom vss config for databroker) -#export MAPPING_FILE="$CONFIG_DIR/it-vss_4.0-dogmode.json" -export CANDUMP_FILE="$CONFIG_DIR/it-candump0.log" - -# export USECASE="databroker" -export USE_DBC2VAL=1 -export NO_USE_VAL2DBC=1 - -export LOG_LEVEL="info" #,dbcfeeder=debug" -## Uncomment to enable most of the debug modules -#export LOG_LEVEL="debug,dbcfeeder=debug,kuksa_client.grpc=debug,dbcfeederlib.canplayer=debug,dbcfeederlib.canreader=debug,dbcfeederlib.dbc2vssmapper=debug" - -echo -echo "*******************************************" -echo "* dbc2val Dapr app-id: $FEEDERCAN_DAPR_APP_ID" -echo "* dbc2val APP port: $FEEDERCAN_GRPC_PORT" -echo "* dbc2val Dapr sidecar port: $FEEDERCAN_GRPC_PORT" -echo "* DAPR_GRPC_PORT=$DAPR_GRPC_PORT" -echo "* Dapr metadata: [ VEHICLEDATABROKER_DAPR_APP_ID=$VEHICLEDATABROKER_DAPR_APP_ID ]" -echo "*******************************************" -echo - -## Uncomment for dapr debug logs -# DAPR_OPT="--enable-api-logging --log-level debug" -DAPR_OPT="--log-level warn" -dapr run \ - --app-id "$FEEDERCAN_DAPR_APP_ID" \ - --app-protocol grpc \ - --dapr-grpc-port $FEEDERCAN_GRPC_PORT \ - $DAPR_OPT \ - --resources-path "$ROOT_DIRECTORY/.dapr/components" \ - --config "$ROOT_DIRECTORY/.dapr/config.yaml" & -#-- -"$PYTHON_BIN" -u ./dbcfeeder.py diff --git a/.vscode/scripts/run-hvac-cli.sh b/.vscode/scripts/run-hvac-cli.sh deleted file mode 100755 index 890423b..0000000 --- a/.vscode/scripts/run-hvac-cli.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -#******************************************************************************** -# Copyright (c) 2022 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License 2.0 which is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -#*******************************************************************************/ -# shellcheck disable=SC2034 -# shellcheck disable=SC2086 - -echo "#######################################################" -echo "### Running HVAC Client ###" -echo "#######################################################" - -set -e - -ROOT_DIRECTORY=$(git rev-parse --show-toplevel) -# shellcheck source=/dev/null -source "$ROOT_DIRECTORY/.vscode/scripts/task-common.sh" "$@" - -TEMP="$1" -STATUS_MODE="$2" - -# sanity checks for invalid user input -if [ -z "$TEMP" ] || [ "$STATUS_MODE" != "ON" ] && [ "$STATUS_MODE" != "OFF" ]; then - echo "Invalid arguments!" - echo - echo "Usage: $0 AC_TEMP [ON | OFF]" - echo - exit 1 -fi - -# replace [ON/OFF] with [1/0] for AC_STATUS -if [ "$STATUS_MODE" = "ON" ]; then - STATUS="1" -else - STATUS="0" -fi - -# gRPC port of hvac service (no dapr!) -HVACSERVICE_PORT='50052' -HVACSERVICE_EXEC_PATH="$ROOT_DIRECTORY/hvac_service" -if [ ! -f "$HVACSERVICE_EXEC_PATH/testclient.py" ]; then - echo "Can't find $HVACSERVICE_EXEC_PATH/testclient.py" - exit 1 -fi - -cd "$HVACSERVICE_EXEC_PATH" || exit 1 -pip3 install -q -r requirements.txt - -## Uncomment to reduce logs from client -# export CLI_LOG_LEVEL="WARNING" - -# set -x -python3 -u testclient.py --addr=localhost:$HVACSERVICE_PORT --temp=$TEMP --status=$STATUS diff --git a/.vscode/scripts/run-hvacservice.sh b/.vscode/scripts/run-hvacservice.sh deleted file mode 100755 index 9b7235f..0000000 --- a/.vscode/scripts/run-hvacservice.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -#******************************************************************************** -# Copyright (c) 2022 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License 2.0 which is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -#*******************************************************************************/ -# shellcheck disable=SC2034 -# shellcheck disable=SC2086 - -echo "#######################################################" -echo "### Running HVAC Service ###" -echo "#######################################################" - -set -e - -ROOT_DIRECTORY=$(git rev-parse --show-toplevel) -# shellcheck source=/dev/null -source "$ROOT_DIRECTORY/.vscode/scripts/task-common.sh" "$@" - -### NOTE: HVACSERVICE_* variables are defined in task-common.sh -# HVACSERVICE_PORT='50052' -# HVACSERVICE_GRPC_PORT='52005' -# HVACSERVICE_DAPR_APP_ID='hvacservice' -# VEHICLEDATABROKER_DAPR_APP_ID='vehicledatabroker' - -# NOTE: use curent sidecar's grpc port, don't connect directly to sidecar of kdb (DATABROKER_GRPC_PORT) -export DAPR_GRPC_PORT=$HVACSERVICE_GRPC_PORT - -HVACSERVICE_EXEC_PATH="$ROOT_DIRECTORY/hvac_service" -if [ ! -f "$HVACSERVICE_EXEC_PATH/hvacservice.py" ]; then - echo "Can't find $HVACSERVICE_EXEC_PATH/hvacservice.py" - exit 1 -fi - -cd "$HVACSERVICE_EXEC_PATH" || exit 1 -pip3 install -q -r requirements.txt - -echo -echo "*******************************************" -echo "* Hvac Service app-id: $HVACSERVICE_DAPR_APP_ID" -echo "* Hvac Service APP port: $HVACSERVICE_PORT" -echo "* Hvac Service Dapr sidecar port: $HVACSERVICE_GRPC_PORT" -echo "* DAPR_GRPC_PORT=$DAPR_GRPC_PORT" -echo "* metadata: [ VEHICLEDATABROKER_DAPR_APP_ID=$VEHICLEDATABROKER_DAPR_APP_ID ]" -echo "*******************************************" -echo - -## uncomment for dapr debug logs -# DAPR_OPT="--enable-api-logging --log-level debug"1 -DAPR_OPT="--log-level warn" -dapr run \ - --app-id $HVACSERVICE_DAPR_APP_ID \ - --app-protocol grpc \ - --app-port $HVACSERVICE_PORT \ - --dapr-grpc-port $HVACSERVICE_GRPC_PORT \ - $DAPR_OPT \ - --components-path $ROOT_DIRECTORY/.dapr/components \ - --config $ROOT_DIRECTORY/.dapr/config.yaml \ - -- \ - python3 -u ./hvacservice.py diff --git a/.vscode/scripts/run-integrationtest.sh b/.vscode/scripts/run-integrationtest.sh deleted file mode 100755 index 8026f88..0000000 --- a/.vscode/scripts/run-integrationtest.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -#******************************************************************************** -# Copyright (c) 2022 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License 2.0 which is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -#*******************************************************************************/ -# shellcheck disable=SC2002 -# shellcheck disable=SC2086 - -echo "#######################################################" -echo "### Running Integration Tests ###" -echo "#######################################################" - -set -e - -ROOT_DIRECTORY=$(git rev-parse --show-toplevel) -# shellcheck source=/dev/null -source "$ROOT_DIRECTORY/.vscode/scripts/task-common.sh" "$@" - -if [ "$USE_DAPR" = "0" ]; then - echo - echo "##### Integration test in Container mode (it-setup.sh)" - echo -else - echo - echo "##### Integration test in Dapr mode (standalone)" - echo -fi - -pip3 install -q -r "${ROOT_DIRECTORY}/integration_test/requirements-dev.txt" -pip3 install -q -r "${ROOT_DIRECTORY}/integration_test/requirements.txt" -pip3 install -q -e "${ROOT_DIRECTORY}/integration_test/" -pip3 install -q -e "${ROOT_DIRECTORY}/hvac_service/" - -set +e - -REBUILD=1 - -if [ "$USE_DAPR" = "0" ]; then - if [ "$REBUILD" = "1" ]; then - echo "Rebuilding pre-release tags for seat and hvac services..." - export SEAT_TAG="prerelease" - export HVAC_TAG="prerelease" - "${ROOT_DIRECTORY}/seat_service/docker-build.sh" -l x86_64 - "${ROOT_DIRECTORY}/hvac_service/docker-build.sh" -l x86_64 - fi - "${ROOT_DIRECTORY}/integration_test/it-setup.sh" init - - # ensure containers are re-created before test - "${ROOT_DIRECTORY}/integration_test/it-setup.sh" cleanup - "${ROOT_DIRECTORY}/integration_test/it-setup.sh" start - echo - # sleep is needed as sometimes feedercan was not able to register datapoints in time and integration test fails - sleep 1 - "${ROOT_DIRECTORY}/integration_test/it-setup.sh" status --logs - echo -fi - -# prevents dumping "E0617: Fork support is only compatible with the epoll1 and poll polling strategies" -export GRPC_ENABLE_FORK_SUPPORT="false" - -# export GRPC_TRACE=all -# export GRPC_VERBOSITY=DEBUG -# export PYTHONVERBOSE=1 -# PYTEST_DEBUG="-v -s --log-cli-level=DEBUG" - -cd "${ROOT_DIRECTORY}/integration_test" || exit 1 -pytest -v $PYTEST_DEBUG \ - --log-file="${ROOT_DIRECTORY}/results/IntegrationTest/integration.log" --log-file-level=DEBUG \ - --asyncio-mode=auto "$@" \ - --override-ini junit_family=xunit1 --junit-xml="${ROOT_DIRECTORY}/results/IntegrationTest/junit.xml" \ - . - -rc=$? - -if [ "$USE_DAPR" = "0" ]; then - echo - if [ $rc -eq 0 ]; then - "${ROOT_DIRECTORY}/integration_test/it-setup.sh" status - else - "${ROOT_DIRECTORY}/integration_test/it-setup.sh" status --logs - fi - echo - # cleanup it containers and images - "${ROOT_DIRECTORY}/integration_test/it-setup.sh" cleanup -fi - -exit $rc diff --git a/.vscode/scripts/run-kuksa-cli.sh b/.vscode/scripts/run-kuksa-cli.sh deleted file mode 100755 index 4f6ea7b..0000000 --- a/.vscode/scripts/run-kuksa-cli.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -#******************************************************************************** -# Copyright (c) 2022 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License 2.0 which is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -#*******************************************************************************/ -# shellcheck disable=SC2002 - -echo "#######################################################" -echo "### Running KUKSA CLI ###" -echo "#######################################################" - -ROOT_DIRECTORY=$(git rev-parse --show-toplevel) -# shellcheck source=/dev/null -source "$ROOT_DIRECTORY/.vscode/scripts/task-common.sh" "$@" - -KUKSACLIENT_VERSION=$(jq -r '.kuksa_client.version // empty' "$CONFIG_JSON") -if [ -z "$KUKSACLIENT_VERSION" ]; then - echo "Coudln't find kuksa-client version from $CONFIG_JSON" - exit 1 -fi - -echo -echo "Seat Service examples [VSS4]:" -echo " getMetaData Vehicle.Cabin.Seat.Row1.DriverSide.Position" -echo " setTargetValue Vehicle.Cabin.Seat.Row1.DriverSide.Position 200" -echo - -# set to 1 to use pypy kuksa-val package -STANDALONE=0 -if [ "$STANDALONE" = "1" ]; then - echo "# Installing kuksa-client..." - pip3 install -U kuksa-client - - # prevent warning dumps - GRPC_ENABLE_FORK_SUPPORT=true kuksa-client --ip 127.0.0.1 --port "$DATABROKER_PORT" --protocol grpc --insecure -else - docker run -it --rm -e GRPC_ENABLE_FORK_SUPPORT=true --net=host "ghcr.io/eclipse/kuksa.val/kuksa-client:$KUKSACLIENT_VERSION" # get--ip 127.0.0.1 --port "$DATABROKER_PORT" --protocol grpc #--insecure -fi \ No newline at end of file diff --git a/.vscode/scripts/run-mockservice.sh b/.vscode/scripts/run-mockservice.sh deleted file mode 100755 index 48ee164..0000000 --- a/.vscode/scripts/run-mockservice.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -#******************************************************************************** -# Copyright (c) 2022 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License 2.0 which is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -#*******************************************************************************/ -# shellcheck disable=SC2034 -# shellcheck disable=SC2086 - -echo "#######################################################" -echo "### Running Mock Service ###" -echo "#######################################################" - -set -e - -ROOT_DIRECTORY=$(git rev-parse --show-toplevel) -# shellcheck source=/dev/null -source "$ROOT_DIRECTORY/.vscode/scripts/task-common.sh" "$@" - -### NOTE: MOCKSERVICE_* variables are defined in task-common.sh -# MOCKSERVICE_PORT='50052' -# MOCKSERVICE_GRPC_PORT='52005' -# MOCKSERVICE_DAPR_APP_ID='mockservice' -# VEHICLEDATABROKER_DAPR_APP_ID='vehicledatabroker' - -# NOTE: use curent sidecar's grpc port, don't connect directly to sidecar of kdb (DATABROKER_GRPC_PORT) -export DAPR_GRPC_PORT=$MOCKSERVICE_GRPC_PORT - -MOCKSERVICE_EXEC_PATH="$ROOT_DIRECTORY/mock_service/mock" -if [ ! -f "$MOCKSERVICE_EXEC_PATH/mockservice.py" ]; then - echo "Can't find $MOCKSERVICE_EXEC_PATH/mockservice.py" - exit 1 -fi - -cd "$MOCKSERVICE_EXEC_PATH" || exit 1 -pip3 install -q -r ../requirements.txt -pip3 install -e ../. - -echo -echo "*******************************************" -echo "* Mock Service app-id: $MOCKSERVICE_DAPR_APP_ID" -echo "* Mock Service APP port: $MOCKSERVICE_PORT" -echo "* Mock Service Dapr sidecar port: $MOCKSERVICE_GRPC_PORT" -echo "* DAPR_GRPC_PORT=$DAPR_GRPC_PORT" -echo "* metadata: [ VEHICLEDATABROKER_DAPR_APP_ID=$VEHICLEDATABROKER_DAPR_APP_ID ]" -echo "*******************************************" -echo - -## uncomment for dapr debug logs -# DAPR_OPT="--enable-api-logging --log-level debug"1 -DAPR_OPT="--log-level warn" -dapr run \ - --app-id $MOCKSERVICE_DAPR_APP_ID \ - --app-protocol grpc \ - --app-port $MOCKSERVICE_PORT \ - --dapr-grpc-port $MOCKSERVICE_GRPC_PORT \ - $DAPR_OPT \ - --components-path $ROOT_DIRECTORY/.dapr/components \ - --config $ROOT_DIRECTORY/.dapr/config.yaml \ - -- \ - python3 mockservice.py diff --git a/.vscode/scripts/run-seatservice-cli.sh b/.vscode/scripts/run-seatservice-cli.sh deleted file mode 100755 index bd15de8..0000000 --- a/.vscode/scripts/run-seatservice-cli.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -#******************************************************************************** -# Copyright (c) 2022 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License 2.0 which is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -#*******************************************************************************/ -# shellcheck disable=SC2034 -# shellcheck disable=SC2086 - -echo "#######################################################" -echo "### Running Seatservice Client ###" -echo "#######################################################" - -set -e - -ROOT_DIRECTORY=$(git rev-parse --show-toplevel) -# shellcheck source=/dev/null -source "$ROOT_DIRECTORY/.vscode/scripts/task-common.sh" "$@" - -POS="$1" -shift -ARGS="$*" - -# handle environment sync flag from vs task -if [ "$SEAT_WAIT" = "wait" ] && ! echo "$ARGS" | grep -q "\-\-wait"; then - ARGS="--wait $ARGS" -fi - -# gRPC port of hvac service (no dapr!) -SEATSERVICE_PORT='50051' - -SEATSERVICE_EXEC_PATH="$ROOT_DIRECTORY/seat_service/target/$PROCESSOR/release/install/bin" - -if [ ! -x "$SEATSERVICE_EXEC_PATH/seat_svc_client" ]; then - echo "seat_svc_client binary is missing: $SEATSERVICE_EXEC_PATH" - exit 1 -fi - -#export DAPR_GRPC_PORT=$SEATSERVICE_GRPC_PORT -echo "$ $SEATSERVICE_EXEC_PATH/seat_svc_client $POS $ARGS" -"$SEATSERVICE_EXEC_PATH/seat_svc_client" "$POS" $ARGS # --target "127.0.0.1:$SEATSERVICE_PORT" diff --git a/.vscode/scripts/run-seatservice.sh b/.vscode/scripts/run-seatservice.sh deleted file mode 100755 index bea659a..0000000 --- a/.vscode/scripts/run-seatservice.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash -#******************************************************************************** -# Copyright (c) 2022 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License 2.0 which is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -#*******************************************************************************/ -# shellcheck disable=SC2086 - -echo "#######################################################" -echo "### Running Seatservice ###" -echo "#######################################################" - -set -e - -ROOT_DIRECTORY=$(git rev-parse --show-toplevel) -# shellcheck source=/dev/null -source "$ROOT_DIRECTORY/.vscode/scripts/task-common.sh" "$@" - -### NOTE: SEATSERVICE_* variables are defined in task-common.sh# -# -# export SEATSERVICE_PORT='50051' -# export SEATSERVICE_GRPC_PORT='52002' -# export SEATSERVICE_DAPR_APP_ID="seatservice" -# export VEHICLEDATABROKER_DAPR_APP_ID="vehicledatabroker" - -# NOTE: use dapr sidecar's grpc port, don't connect directly to sidecar of vdb (DATABROKER_GRPC_PORT) - -export DAPR_GRPC_PORT=$SEATSERVICE_GRPC_PORT - -build_seatservice() { - local arch="$1" - echo "-- Building databroker for [$PROCESSOR]..." - cd "$ROOT_DIRECTORY/seat_service" || exit 1 - if [ "$arch" = "aarch64" ] || [ "$arch" = "arm64" ]; then - ./build-release.sh "aarch64" # only aarch64 is supported - fi - if [ "$arch" = "x86_64" ]; then - ./build-release.sh "x86_64" - fi -} - -SEATSERVICE_EXEC_PATH="$ROOT_DIRECTORY/seat_service/target/$PROCESSOR/release/install/bin" -if [ ! -x "$SEATSERVICE_EXEC_PATH/seat_service" ]; then - echo "seat_service binary is missing: $SEATSERVICE_EXEC_PATH" - build_seatservice "$PROCESSOR" - file "$SEATSERVICE_EXEC_PATH/seat_service" || exit 1 -fi - -############################################### -### SeatService specific environment config ### -############################################### - -export CAN="cansim" -# export SA_DEBUG=1 -export SC_CTL=0 -export SAE_STOP=0 -# DataBrokerFeeder Debug level (0, 1, 2) -export DBF_DEBUG=0 - -### Uncomment for DEBUG -export SA_DEBUG=2 -export DBF_DEBUG=3 -export SEAT_DEBUG=1 - -# needed to override vdb address -export BROKER_ADDR="127.0.0.1:$DAPR_GRPC_PORT" - -### Uncomment for direct connection to databroker -# export GRPC_TRACE=all,-timer,-timer_check -# export GRPC_VERBOSITY=DEBUG - -echo -echo "*******************************************" -echo "* Seat Service app-id: $SEATSERVICE_DAPR_APP_ID" -echo "* Seat Service APP port: $SEATSERVICE_PORT" -echo "* Seat Service Dapr sidecar port: $SEATSERVICE_GRPC_PORT" -echo "* DAPR_GRPC_PORT=$DAPR_GRPC_PORT" -echo "* BROKER_ADDR=$BROKER_ADDR" -echo "* metadata: [ VEHICLEDATABROKER_DAPR_APP_ID=$VEHICLEDATABROKER_DAPR_APP_ID ]" -echo "*******************************************" -echo - -## Uncomment for dapr debug logs -# DAPR_OPT="--enable-api-logging --log-level debug" -DAPR_OPT="--log-level warn" -dapr run \ - --app-id "$SEATSERVICE_DAPR_APP_ID" \ - --app-protocol grpc \ - --app-port $SEATSERVICE_PORT \ - --dapr-grpc-port $SEATSERVICE_GRPC_PORT \ - $DAPR_OPT \ - --components-path "$ROOT_DIRECTORY/.dapr/components" \ - --config "$ROOT_DIRECTORY/.dapr/config.yaml" \ - & # -- \ -"$SEATSERVICE_EXEC_PATH/val_start.sh" diff --git a/.vscode/scripts/task-common.sh b/.vscode/scripts/task-common.sh deleted file mode 100755 index acde5c8..0000000 --- a/.vscode/scripts/task-common.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/bash -#******************************************************************************** -# Copyright (c) 2022 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License 2.0 which is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -#*******************************************************************************/ -# shellcheck disable=SC2086 - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -# path to json config with val component versions -export CONFIG_JSON="$SCRIPT_DIR/../../prerequisite_settings.json" - -### -### Common dapr GRPC setups -### - -# Databroker App port -export DATABROKER_PORT='55555' -# Databroker Dapr Sidecar gRPC port -export DATABROKER_GRPC_PORT='52001' -# databroker dapr app id -export VEHICLEDATABROKER_DAPR_APP_ID="vehicledatabroker" - -# SeatService App port -export SEATSERVICE_PORT='50051' -# SeatService Dapr Sidecar gRPC port -export SEATSERVICE_GRPC_PORT='52002' -# SeatService dapr app id -export SEATSERVICE_DAPR_APP_ID="seatservice" - -# HvacService App port -export HVACSERVICE_PORT='50052' -# HvacService Dapr Sidecar gRPC port -export HVACSERVICE_GRPC_PORT='52005' -# HvacService dapr app id -export HVACSERVICE_DAPR_APP_ID="hvacservice" - -# feedercan Dapr Sidecar gRPC port -export FEEDERCAN_GRPC_PORT='52008' -# feedercan dapr app id -export FEEDERCAN_DAPR_APP_ID="feedercan" - -export MOCKSERVICE_PORT='50053' -export MOCKSERVICE_GRPC_PORT='59009' -export MOCKSERVICE_DAPR_APP_ID="mockservice" - -_check_prerequisite() { - local MISSING_PKG="" - if [ -z "$(which jq)" ]; then - MISSING_PKG="$MISSING_PKG jq" - fi - if [ -z "$(which git)" ]; then - MISSING_PKG="$MISSING_PKG git" - fi - if [ -z "$(which curl)" ]; then - MISSING_PKG="$MISSING_PKG curl" - fi - if [ -z "$(which tar)" ]; then - MISSING_PKG="$MISSING_PKG tar" - fi - if [ -z "$(which python3)" ]; then - MISSING_PKG="$MISSING_PKG python3 python3-pip" - fi - if [ -n "$MISSING_PKG" ]; then - echo "### Installing prerequisites: $MISSING_PKG" - sudo apt-get -y update && sudo apt-get -qqy $MISSING_PKG - fi - - if [ -z "$(which pytest)" ]; then - pip3 install pytest - fi -} - -download_release() { - local executable="$1" - local download_url="$2" - local binary_path="$3" - local binary_name="$4" - - if [ -f "$executable" ]; then - echo " found: $executable" - return 0 - fi - echo "- Downloading from: $download_url" - curl -s -o "$binary_path/$binary_name" --create-dirs -L -H "Accept: application/octet-stream" "$download_url" - echo - echo "- downloaded: $(file $binary_path/$binary_name)" - - tar -xf "$binary_path/$binary_name" -C "$binary_path" - if [ ! -x "$executable" ]; then - echo "$executable not found in $binary_path/$binary_name" - return 1 - fi - return 0 -} - -download_zip_release() { - local executable="$1" - local download_url="$2" - local binary_path="$3" - local archive_name="$4" - local binary_name="$5" - - if [ -f "$executable" ]; then - echo " found: $executable" - return 0 - fi - echo "- Downloading from: $download_url" - curl -s -o "$binary_path/$archive_name" --create-dirs -L -H "Accept: application/octet-stream" "$download_url" - echo "- Downloaded file : $(file $binary_path/$archive_name)" - echo "- Unzipping : $binary_path/$binary_name" - ( cd "$binary_path" && unzip -o -q "$archive_name" ) - echo "- Extracting : $binary_path/$binary_name" - tar xzf "$binary_path/$binary_name" -C "$binary_path" - if [ ! -x "$executable" ]; then - echo "$executable not found in $binary_path/$binary_name" - return 1 - fi - return 0 -} - -# helper for checking out git branch -git_checkout() { - local repo="$1" - local dir="$2" - local branch="$3" # optional branch - - echo "### Checkout: $repo, branch: \"$branch\"" - - local branch_opt="" - if [ -n "$branch" ]; then - branch_opt="-c advice.detachedHead=false --single-branch --branch $branch" - fi - - git clone --quiet $branch_opt "$repo" "$dir" -} - -# init on sourcing -_check_prerequisite - -if [ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "arm64" ]; then - echo "- Detected AArch64 architecture" - PROCESSOR="aarch64" - PROCESSOR_ALT="arm64" -else - echo "- Detected x86_64 architecture" - PROCESSOR="x86_64" - PROCESSOR_ALT="amd64" -fi -echo -export PROCESSOR -export PROCESSOR_ALT diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index bc9d03d..0000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,423 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License 2.0 which is available at - * http://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "2.0.0", - "tasks": [ - { - "label": "ensure-dapr", - "type": "shell", - "command": "./.vscode/scripts/ensure-dapr.sh", - "presentation": { - "close": true - }, - "problemMatcher": [] - }, - { - "label": "run-databroker", - "dependsOn": ["ensure-dapr"], - "dependsOrder": "sequence", - "type": "shell", - "command": "./.vscode/scripts/run-databroker.sh", - "group": "test", - "presentation": { - "reveal": "always", - "panel": "dedicated", - "showReuseMessage": false - }, - "isBackground": true, - "runOptions": { - "instanceLimit": 1, - "reevaluateOnRerun": true - }, - "problemMatcher": { - "pattern": [ - { - "regexp": ".", - "file": 1, - "location": 2, - "message": 3 - } - ], - "background": { - "activeOnStart": true, - "beginsPattern": "(?!)", // Negative Lookahead (match nothing) - "endsPattern": "You're up and running! .* logs will appear here.$" - } - } - }, - { - "label": "run-databroker-cli", - "type": "shell", - "command": "./.vscode/scripts/run-databroker-cli.sh", - "group": "test", - "isBackground": false, - "presentation": { - "reveal": "always", - "panel": "dedicated", - "showReuseMessage": false - }, - "runOptions": { - "instanceLimit": 1, - "reevaluateOnRerun": true - } - }, - { - "label": "run-seatservice", - "dependsOn": ["ensure-dapr", "run-databroker"], - "dependsOrder": "sequence", - "type": "shell", - "command": "./.vscode/scripts/run-seatservice.sh", - "group": "test", - "presentation": { - "reveal": "always", - "panel": "dedicated", - "showReuseMessage": false - }, - "isBackground": true, - "runOptions": { - "instanceLimit": 1, - "reevaluateOnRerun": true - }, - "problemMatcher": { - "pattern": [ - { - "regexp": ".", - "file": 1, - "location": 2, - "message": 3 - } - ], - "background": { - "activeOnStart": true, - "beginsPattern": "(?!)", // Negative Lookahead (match nothing) - "endsPattern": "You're up and running! .* logs will appear here.$" - } - } - }, - { - "label": "run-seat-cli", - "dependsOn": ["ensure-dapr"], - "dependsOrder": "sequence", - "type": "shell", - "command": "./.vscode/scripts/run-seatservice-cli.sh", - "args": ["${input:SEAT_POS}"], - "options": { - "env": { - "SEAT_WAIT": "${input:SEAT_WAIT}" - } - }, - "group": "test", - "isBackground": false, - "runOptions": { - "instanceLimit": 1 - }, - "problemMatcher": [], - "presentation": { - "clear": true, - // "close": true, - "showReuseMessage": false - } - }, - { - "label": "run-hvacservice", - "dependsOn": ["ensure-dapr", "run-databroker"], - "dependsOrder": "sequence", - "type": "shell", - "command": "./.vscode/scripts/run-hvacservice.sh", - "group": "test", - "presentation": { - "reveal": "always", - "panel": "dedicated", - "showReuseMessage": false - }, - "isBackground": true, - "runOptions": { - "instanceLimit": 1, - "reevaluateOnRerun": true - }, - "problemMatcher": { - "pattern": [ - { - "regexp": ".", - "file": 1, - "location": 2, - "message": 3 - } - ], - "background": { - "activeOnStart": true, - "beginsPattern": "(?!)", // Negative Lookahead (match nothing) - "endsPattern": "You're up and running! .* logs will appear here.$" - } - } - }, - { - "label": "run-hvac-cli", - // "detail": "Runs HVAC Client", - "dependsOn": ["ensure-dapr", "run-hvacservice"], - "dependsOrder": "sequence", - "type": "shell", - "command": "./.vscode/scripts/run-hvac-cli.sh", - "args": ["${input:AC_TEMP}", "${input:AC_STATUS}"], - "group": "test", - "isBackground": false, - "runOptions": { - "instanceLimit": 1 - }, - "presentation": { - "reveal": "always", - "panel": "shared", - "showReuseMessage": false - } - }, - { - "label": "run-mockservice", - "dependsOn": ["ensure-dapr", "run-databroker"], - "dependsOrder": "sequence", - "type": "shell", - "command": "./.vscode/scripts/run-mockservice.sh", - "group": "test", - "presentation": { - "reveal": "always", - "panel": "dedicated", - "showReuseMessage": false - }, - "isBackground": true, - "runOptions": { - "instanceLimit": 1, - "reevaluateOnRerun": true - }, - "problemMatcher": { - "pattern": [ - { - "regexp": ".", - "file": 1, - "location": 2, - "message": 3 - } - ], - "background": { - "activeOnStart": true, - "beginsPattern": "(?!)", // Negative Lookahead (match nothing) - "endsPattern": "You're up and running! .* logs will appear here.$" - } - } - }, - { - "label": "run-feedercan", - // "detail": "Starts Generic CAN Feeder", - "dependsOn": ["run-databroker"], - "dependsOrder": "sequence", - "type": "shell", - "command": "./.vscode/scripts/run-feedercan.sh", - "group": "test", - "presentation": { - "reveal": "always", - "panel": "dedicated", - "showReuseMessage": false - }, - "isBackground": true, - "runOptions": { - "instanceLimit": 1, - "reevaluateOnRerun": true - }, - "problemMatcher": { - "pattern": [ - { - "regexp": ".", - "file": 1, - "location": 2, - "message": 3 - } - ], - "background": { - "activeOnStart": true, - "beginsPattern": "(?!)", // Negative Lookahead (match nothing) - "endsPattern": "You're up and running! .* logs will appear here.$" - } - } - }, - { - "label": "run-kuksa-cli", - // "detail": "Runs Kuksa Client", - "dependsOrder": "sequence", - "type": "shell", - "command": "./.vscode/scripts/run-kuksa-cli.sh", - "group": "test", - "isBackground": false, - "runOptions": { - "instanceLimit": 1 - }, - "presentation": { - "reveal": "always", - "panel": "shared", - "showReuseMessage": false - } - }, - { - "label": "Start VAL", - "dependsOn": [ - // "Clean VAL binaries", - "Terminate Tasks", - "ensure-dapr", - "run-databroker", - "run-hvacservice", - "run-seatservice", - "run-feedercan" - ], - "dependsOrder": "sequence", - "runOptions": { - "runOn": "folderOpen", - "instanceLimit": 1 - }, - "problemMatcher": [] - }, - { - "label": "integration-test (local)", - "type": "shell", - "command": "./.vscode/scripts/run-integrationtest.sh", - "options": { - "env": { - "USE_DAPR": "1" - } - }, - "group": "test", - "dependsOn": [ - "ensure-dapr", - "run-databroker", - "run-seatservice", - "run-hvacservice", - "run-feedercan" - ], - "dependsOrder": "sequence", - "presentation": { - "reveal": "always", - "panel": "dedicated", - "clear": true, - "showReuseMessage": false - }, - "isBackground": false, - "runOptions": { - "instanceLimit": 1, - "reevaluateOnRerun": true - }, - "problemMatcher": { - "pattern": [ - { - "regexp": "^FAILED|failed", - "file": 1, - "location": 2, - "message": 3 - } - ], - "background": { - "activeOnStart": true, - "beginsPattern": "^========================================================================================= ", - "endsPattern": "." - } - } - }, - { - "label": "integration-test (containers)", - "type": "shell", - "command": "./.vscode/scripts/run-integrationtest.sh", - "group": "test", - "options": { - "env": { - "USE_DAPR": "0" - } - }, - "presentation": { - "reveal": "always", - "panel": "dedicated", - "showReuseMessage": false, - "clear": true - }, - "isBackground": false, - "runOptions": { - "instanceLimit": 1, - "reevaluateOnRerun": true - }, - "problemMatcher": { - "pattern": [ - { - "regexp": "^FAILED|failed", - "file": 1, - "location": 2, - "message": 3 - } - ], - "background": { - "activeOnStart": true, - "beginsPattern": "^========================================================================================= ", - "endsPattern": "." - } - } - }, - { - "label": "Clean VAL binaries", - "type": "shell", - "dependsOn": ["Terminate Tasks"], - "dependsOrder": "sequence", - "command": "./.vscode/scripts/clean-binaries.sh", - "isBackground": false, - "presentation": { - "close": true - }, - "problemMatcher": [] - }, - { - "label": "Terminate Tasks", - "command": "echo ${input:terminate}", - "type": "shell", - "problemMatcher": [] - } - ], - "inputs": [ - { - "id": "SEAT_POS", - "type": "promptString", - "description": "Seat Position [0..1000] (1000=100%)", - "default": "500" - }, - { - "id": "SEAT_WAIT", - "type": "pickString", - "description": "Wait until seat position reached?", - "options": ["wait", "no-wait"], - "default": "wait" - }, - { - "id": "AC_TEMP", - "type": "promptString", - "description": "AC Temperature", - "default": "23.0" - }, - { - "id": "AC_STATUS", - "type": "pickString", - "description": "AC Status", - "options": ["ON", "OFF"], - "default": "ON" - }, - { - "id": "terminate", - "type": "command", - "command": "workbench.action.tasks.terminate", - "args": "terminateAll" - } - ] -} diff --git a/seat_service/.devcontainer/Dockerfile b/seat_service/.devcontainer/Dockerfile index b7fcaec..7b25b10 100644 --- a/seat_service/.devcontainer/Dockerfile +++ b/seat_service/.devcontainer/Dockerfile @@ -13,7 +13,8 @@ # Download base image of Ubuntu # NOTE: it may be required to build the image locally (check root README.md) -FROM ubuntu:20.04 +#FROM mcr.microsoft.com/devcontainers/base:ubuntu +FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04 # If you get proxy errors, make sure Docker is configured correctly. # Hint: https://dev.to/zyfa/setup-the-proxy-for-dockerfile-building--4jc8 diff --git a/seat_service/Dockerfile b/seat_service/Dockerfile index c1bfd7a..1a8591c 100644 --- a/seat_service/Dockerfile +++ b/seat_service/Dockerfile @@ -12,7 +12,7 @@ # ********************************************************************************/ # DO NOT UPDATE ubuntu version, it must match the image used for building seat_service/bin_vservice-seat_*_release.* -FROM --platform=$BUILDPLATFORM ubuntu:20.04 as builder +FROM --platform=$BUILDPLATFORM ubuntu:latest as builder ARG TARGETPLATFORM @@ -27,7 +27,7 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ] ; \ then tar -xf bin_vservice-seat_x86_64_release.tar.gz && cp -rv ./target/x86_64/release/install/ ./bins; \ else tar -xf bin_vservice-seat_aarch64_release.tar.gz && cp -rv ./target/aarch64/release/install/ ./bins; fi -FROM --platform=$TARGETPLATFORM ubuntu:20.04 as runtime +FROM --platform=$TARGETPLATFORM ubuntu:latest as runtime LABEL org.opencontainers.image.description "VAL Seat Service container, providing VSC Seat impl and supporting simulated/real can ECU" diff --git a/seat_service/README.md b/seat_service/README.md index 077c14d..a94449d 100644 --- a/seat_service/README.md +++ b/seat_service/README.md @@ -54,17 +54,24 @@ For `aarch64` hosts or for quickly testing a pull request it is easier to use [G #### Prerequisites Most existing build scripts rely on that you have Docker installed. -Some scripts also assumes that you use Ubuntu 20.04 as development environment, -by for example building binaries locally and then copying to a docker environment based on Ubuntu 20.04. +Some scripts also assumes that you use Ubuntu 22.04 as development environment, +by for example building binaries locally and then copying to a docker environment based on Ubuntu 22.04. +Conan config is setup to verify gcc-version against configuration in `toolchains`. 1. Install and configure (if needed) local authentication proxy e.g. CNTLM or Px 1. Install and configure docker: [Get Docker](https://docs.docker.com/get-docker/) +Some hints if you want to update to a different environment and not change overall architecture + +1. Select the new Debian version to use +2. Update base-image accordingly in all Dockerfile and in repo `.github/workflows` for seat service. +3. Check default `gcc`version in that Ubuntu version and update version in files in `toolchains`. + #### Usage on CLI **NOTE:** Building Seat Service on `aarch64` host is not supported at the moment. -##### Building on Ubuntu 20.04 +##### Building on Ubuntu 22.04 You can use dedicated build docker script [docker-build.sh](./docker-build.sh) if host environment matches target (Ubuntu 20.04). Note that you may need to install dependencies - use [.devcontainer/Dockerfile](.devcontainer/Dockerfile) as reference. @@ -123,7 +130,7 @@ cd seat_service rm -rf bin_vservice-seat_*.tar.gz target/ # Generate bin_vservice-seat_*.tar.gz files for packing seat service container -docker run --rm -it -v $(pwd):/workspace oci_kuksa-val-services-ci:latest /bin/bash -c \ +docker run --rm -it -v $(pwd):/workspace seat_service_env:latest /bin/bash -c \ "./build-release.sh --pack" # Check if release package is build @@ -133,7 +140,7 @@ ls -la bin_vservice-seat_*.tar.gz It shall now be possible to start the service ``` bash -$ docker run --rm -it -v $(pwd):/workspace xxx:latest target/x86_64/release/install/bin/seat_service +$ docker run --rm -it -v $(pwd):/workspace seat_service_env:latest target/x86_64/release/install/bin/seat_service Usage: target/x86_64/release/install/bin/seat_service CAN_IF_NAME [LISTEN_ADDRESS [PORT]] Environment: SEAT_DEBUG=1 to enable SeatDataFeeder dumps diff --git a/seat_service/build-debug.sh b/seat_service/build-debug.sh index 30a4bc6..1915202 100755 --- a/seat_service/build-debug.sh +++ b/seat_service/build-debug.sh @@ -17,6 +17,10 @@ # Specify: # first argument: TARGET_ARCH = "x86_64" or "aarch64"; default: "x86_64" # second argument: TARGET_ARCH = "; default: "$SCRIPT_DIR/target/$TARGET_ARCH/Debug" +# +# Note: Build failures may occur if this script is run on a target with "wrong" gcc-version +# + set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" diff --git a/seat_service/build-release.sh b/seat_service/build-release.sh index 3a7e064..c04dc92 100755 --- a/seat_service/build-release.sh +++ b/seat_service/build-release.sh @@ -15,7 +15,9 @@ # Specify: # first argument: TARGET_ARCH = "x86_64" or "aarch64"; default: "x86_64" # second argument: TARGET_ARCH = "; default: "$SCRIPT_DIR/target/$TARGET_ARCH/release" - +# +# Note: Build failures may occur if this script is run on a target with "wrong" gcc-version +# # shellcheck disable=SC2086 # shellcheck disable=SC2230 # shellcheck disable=SC2046 diff --git a/seat_service/docker-build.sh b/seat_service/docker-build.sh index c703906..d645f59 100755 --- a/seat_service/docker-build.sh +++ b/seat_service/docker-build.sh @@ -15,6 +15,8 @@ # shellcheck disable=SC2086 # shellcheck disable=SC2230 +# Note: Build failures may occur if this script is run on a target with "wrong" gcc-version + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" CONTEXT_DIR="$SCRIPT_DIR/.." # name of docker image: ${DOCKER_ARCH)/${DOCKER_IMAGE} @@ -127,9 +129,9 @@ if [ "$VERBOSE" = "1" ]; then DOCKER_ARGS="--no-cache --progress=plain $DOCKER_ARGS" fi -cd "$CONTEXT_DIR" || exit 1 -echo "# docker buildx build $DOCKER_ARGS --f seat_service/Dockerfile $CONTEXT_DIR" -DOCKER_BUILDKIT=1 docker buildx build $DOCKER_ARGS -f seat_service/Dockerfile "$CONTEXT_DIR" $DOCKER_EXT +cd "$SCRIPT_DIR" || exit 1 +echo "# docker buildx build $DOCKER_ARGS --f Dockerfile $SCRIPT_DIR" +DOCKER_BUILDKIT=1 docker buildx build $DOCKER_ARGS -f Dockerfile "$SCRIPT_DIR" $DOCKER_EXT if [ "$DOCKER_ARCH" != "multiarch" ]; then echo "docker image tag $DOCKER_ARCH/$DOCKER_IMAGE ghcr.io/eclipse-kuksa/kuksa-incubation/$DOCKER_IMAGE:prerelease" diff --git a/seat_service/toolchains/target_aarch64_Debug b/seat_service/toolchains/target_aarch64_Debug index 2858aa6..d89a75c 100644 --- a/seat_service/toolchains/target_aarch64_Debug +++ b/seat_service/toolchains/target_aarch64_Debug @@ -6,7 +6,7 @@ cxx_compiler=g++ [settings] os=Linux compiler=gcc -compiler.version=9 +compiler.version=11 compiler.libcxx=libstdc++11 arch=armv8 diff --git a/seat_service/toolchains/target_aarch64_Release b/seat_service/toolchains/target_aarch64_Release index 3273f91..069c57f 100644 --- a/seat_service/toolchains/target_aarch64_Release +++ b/seat_service/toolchains/target_aarch64_Release @@ -6,7 +6,7 @@ cxx_compiler=g++ [settings] os=Linux compiler=gcc -compiler.version=9 +compiler.version=11 compiler.libcxx=libstdc++11 arch=armv8 diff --git a/seat_service/toolchains/target_x86_64_Debug b/seat_service/toolchains/target_x86_64_Debug index 7e9797a..6e06f87 100644 --- a/seat_service/toolchains/target_x86_64_Debug +++ b/seat_service/toolchains/target_x86_64_Debug @@ -1,7 +1,7 @@ [settings] os=Linux compiler=gcc -compiler.version=9 +compiler.version=11 compiler.libcxx=libstdc++11 arch=x86_64 diff --git a/seat_service/toolchains/target_x86_64_Release b/seat_service/toolchains/target_x86_64_Release index d3a214b..feb90e5 100644 --- a/seat_service/toolchains/target_x86_64_Release +++ b/seat_service/toolchains/target_x86_64_Release @@ -1,7 +1,7 @@ [settings] os=Linux compiler=gcc -compiler.version=9 +compiler.version=11 compiler.libcxx=libstdc++11 arch=x86_64