Skip to content

Commit

Permalink
Fix two text replacements in init script (#556)
Browse files Browse the repository at this point in the history
There are two issues with the text replacements made by the init.sh script.  These are:
1.) The packagesToScan property in application.yaml is changed from "uk.gov.hmcts.reform.demo.controllers" to "uk.gov.hmcts.reform.$component_name.controllers".  It should be changed to "uk.gov.hmcts.reform.$package.controllers" to match the directory rename carried out later in the script.
2.) The chart name property in Chart.yaml is changed from "rpe-spring-boot-template" to "$product_name-$product_name-$component_name" by a combination of the maintainer name and slug replacements.  It should be changed to "$product_name-$component_name".

To fix the first issue the changes to the application.yaml file have been moved to a separate section.  This replaces all instances of "rpe" with $product_name and then all instances of "reform.demo" with reform.$package".

To fix the second issue a new line of code has been added to the section that processes the Chart.yaml file.  This removes the "rpe-" prefix from the chart name value leaving just "spring-boot-template".  The remaining "spring-boot-template" part is replaced with "$product_name-$component_name" when the slug replacement is carried out later in the script.

Co-authored-by: Tyler-35 <[email protected]>
Co-authored-by: Felix Eyetan <[email protected]>
  • Loading branch information
3 people authored Aug 20, 2024
1 parent ece2344 commit e111dbc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions bin/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,22 @@ do
perl -i -pe "s/spring-boot-template/$component_name/g" ${i}
done

#update maintainer name
# Remove "rpe-" prefix from chart name to prepare it for spring-boot-template slug replacement and update maintainer name
for i in "charts/rpe-spring-boot-template/Chart.yaml"
do
perl -i -pe "s/rpe-//g" ${i}
perl -i -pe "s/rpe/$product_name/g" ${i}
done

#update app insights & file mount config
for i in "src/main/resources/application.yaml lib/applicationinsights.json"
# Update mount config and packagesToScan
for i in "src/main/resources/application.yaml"
do
perl -i -pe "s/rpe/$product_name/g" ${i}
perl -i -pe "s/reform.demo/reform.$package/g" ${i}
done

# Update app insights
for i in "lib/applicationinsights.json"
do
perl -i -pe "s/rpe/$product_name/g" ${i}
perl -i -pe "s/demo/$component_name/g" ${i}
Expand Down

0 comments on commit e111dbc

Please sign in to comment.