From b28103eff991b913f66eff63425eb7a774891eca Mon Sep 17 00:00:00 2001 From: Julian Psotta Date: Wed, 7 Feb 2024 16:08:30 +0100 Subject: [PATCH] fix(config): Add some additional parsing and validating steps --- .../yml_config_to_properties_conversion.sh | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/utils/yml_config_to_properties_conversion.sh b/.github/utils/yml_config_to_properties_conversion.sh index 5402640025..d073ffc9bf 100755 --- a/.github/utils/yml_config_to_properties_conversion.sh +++ b/.github/utils/yml_config_to_properties_conversion.sh @@ -28,9 +28,30 @@ yq --exit-status '(.ors.engine.source_file == null)' $input_file || exit 1 ########################### echo "Replacing source_file with ors-api/src/test/files/heidelberg.osm.gz" # Output the converted yml to the final file temporarily -yq e '.ors.engine.source_file="ors-api/src/test/files/heidelberg.osm.gz"' $input_file > $output_file || exit 1 +yq e '.ors.engine.source_file = "ors-api/src/test/files/heidelberg.osm.gz"' $input_file > $output_file || exit 1 echo "Replacing ors.engine.profiles.car.enabled='false' with ors.engine.profiles.car.enabled='true'" -yq e '.ors.engine.profiles.car.enabled = "true"' -i $output_file || exit 1 +yq e '.ors.engine.profiles.car.enabled = true' -i $output_file || exit 1 + + +############################ +### Validate output file ### +############################ +echo "Checking if the output file is a valid yaml file" +yq 'true' $output_file /dev/null || exit 1 +echo "Checking for ors.engine.source_file=ors-api/src/test/files/heidelberg.osm.gz" +return_value=$(sed -n '/^ +ors.engine.source_file=ors-api\/src\/test\/files\/heidelberg.osm.gz/p') $output_file || exit 1 +if [ -z "$return_value" ]; then + echo "ors.engine.source_file=ors-api/src/test/files/heidelberg.osm.gz not found" + exit 1 +fi +echo "Checking for ors.engine.profiles.car.enabled=true" +return_value=$(sed -n '/^ors.engine.profiles.car.enabled=true/p') $output_file || exit 1 +if [ -z "$return_value" ]; then + echo "ors.engine.profiles.car.enabled=true not found" + exit 1 +fi + ########################### ### Convert input file ####