-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docker): Introduce reworked docker setup with jar (#1670)
- Loading branch information
Showing
18 changed files
with
916 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ ors-api/logs | |
|
||
ors-api/target/ | ||
ors-engine/target/ | ||
ors-docker/** | ||
|
||
cgiar_provider/ | ||
cgiar_cache/ | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
if [ "$#" -ne 2 ]; then | ||
echo "Usage: $0 input.yaml output.yaml" | ||
exit 1 | ||
fi | ||
|
||
input_file=$1 | ||
output_file=$2 | ||
|
||
echo "" | ||
echo "Copy $input_file to $output_file" | ||
cp $input_file $output_file | ||
|
||
########################### | ||
### Replace parameters #### | ||
########################### | ||
echo "" | ||
echo "Replace parameters:" | ||
|
||
echo "- enable ors.engine.profiles.car" | ||
yq -i '.ors.engine.profiles.car.enabled = true' "$output_file" || exit 1 | ||
|
||
echo "- set ors.engine.source_file to ors-api/src/test/files/heidelberg.osm.gz" | ||
yq -i '.ors.engine.source_file = "ors-api/src/test/files/heidelberg.osm.gz"' "$output_file" || exit 1 | ||
|
||
########################### | ||
### Convert input file #### | ||
########################### | ||
echo "" | ||
echo "Converting input file:" | ||
## Add # to the beginning of each line that is not empty or a comment | ||
echo "- Comment everything" | ||
sed -i '/^\s*[^#]/ s/^/#/' "$output_file" || exit 1 | ||
|
||
echo "- Uncomment ors, engine and source_file" | ||
sed -i -e '/^#ors:/s/^#//' -e '/^#.*engine:/s/^#//' -e '/^#.*source_file:/s/^#//' "$output_file" | ||
|
||
echo "- Uncomment subsequent lines for profiles.car.enabled in ors.engine" | ||
sed -i -e '/^# profiles:/,/^# enabled:/ s/^#//' "$output_file" | ||
|
||
echo "Parsing complete. Result saved to $output_file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
|
||
if [ "$#" -ne 2 ]; then | ||
echo "Usage: $0 input.yaml output.properties" | ||
exit 1 | ||
fi | ||
|
||
input_file=$1 | ||
output_file=$2 | ||
|
||
echo "" | ||
echo "Copy $input_file to $output_file" | ||
cp $input_file $output_file | ||
|
||
########################### | ||
### Replace parameters #### | ||
########################### | ||
echo "" | ||
echo "Replace parameters:" | ||
|
||
echo "- enable ors.engine.profiles.car" | ||
yq -i '.ors.engine.profiles.car.enabled = true' "$output_file" || exit 1 | ||
|
||
echo "- set ors.engine.source_file to ors-api/src/test/files/heidelberg.osm.gz" | ||
yq -i '.ors.engine.source_file = "ors-api/src/test/files/heidelberg.osm.gz"' "$output_file" || exit 1 | ||
|
||
|
||
########################### | ||
### Convert input file #### | ||
########################### | ||
echo "" | ||
echo "Convert .yaml to .env/properties file:" | ||
echo "- unwrap yaml structure to flat properties" | ||
yq -i -o=props --unwrapScalar=false '.. | select(tag != "!!map" and tag != "!!seq") | ( (path | join(".")) + "=" + .)' "$output_file" || exit 1 | ||
|
||
## Add # to the beginning of each line that is not empty or a comment | ||
echo "- Comment everything" | ||
sed -i '/^\s*[^#]/ s/^/#/' "$output_file" || exit 1 | ||
|
||
echo "- Uncomment ors.engine.source_file and ors.engine.profiles.car.enabled" | ||
sed -i -e '/^#ors.engine.source_file/s/^#//' -e '/^#ors.engine.profiles.car.enabled/s/^#//' "$output_file" || exit 1 | ||
|
||
############################ | ||
### Validate output file ### | ||
############################ | ||
echo "" | ||
echo "Validate output file:" | ||
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 | ||
|
||
echo "Parsing complete. Result saved to $output_file" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 input.yaml" | ||
exit 1 | ||
fi | ||
|
||
input_file=$1 | ||
|
||
########################### | ||
### Validate input file ### | ||
########################### | ||
echo "Validate input file:" | ||
echo "- checking if the input file is a valid yaml file" | ||
yq 'true' $input_file /dev/null || exit 1 | ||
# Fail if ors.engine.profiles.car.enabled='false' can't be found access with schema .result | select(.property_history != null) | .property_history | map(select(.event_name == "Sold"))[0].date' | ||
echo "- checking if ors.engine.source_file exists and has 'source_file' property" | ||
yq --exit-status '.ors.engine | has("source_file")' $input_file > /dev/null || exit 1 | ||
# For profiles section for car with enabled using yq and contains | ||
echo "- checking if ors.engine.profiles.car exists and has 'enabled' property" | ||
yq --exit-status '.ors.engine.profiles.car | has("enabled")' $input_file > /dev/null || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Automatic synchronization of application.yml to ors-config.yml | ||
name: Automatic synchronization of application.yml to ors-config.yml and ors-config.env | ||
on: | ||
pull_request: | ||
branches: | ||
|
@@ -10,7 +10,7 @@ on: | |
|
||
jobs: | ||
sync_config: | ||
name: Synchronize changes in application.yml to ors-config.yml | ||
name: Synchronize changes in application.yml to ors-config.yml and ors-config.env | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
|
@@ -20,10 +20,16 @@ jobs: | |
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- name: Convert application.yml to ors-config.yml | ||
- name: yq - portable yaml processor | ||
uses: mikefarah/[email protected] | ||
- name: validate application.yml | ||
run: .github/utils/yml_config_validation.sh ors-api/src/main/resources/application.yml | ||
- name: Convert application.yml to ors-config.yml and ors-config.env | ||
run: | | ||
.github/utils/config_conversion.sh ors-api/src/main/resources/application.yml ors-config.yml | ||
# Print yq version | ||
yq --version | ||
.github/utils/yml_config_to_ors_config_conversion.sh ors-api/src/main/resources/application.yml ors-config.yml | ||
.github/utils/yml_config_to_properties_conversion.sh ors-api/src/main/resources/application.yml ors-config.env | ||
- uses: MichaelsJP/git-auto-commit-action@v5 | ||
with: | ||
commit_message: 'chore(config): automatic conversion of application.yml to ors-config.yml' | ||
|
||
commit_message: 'chore(config): automatic conversion of application.yml to ors-config.yml and ors-config.env' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.