fix(ci): maintain correct working directory in workflow

Adds working_dir variable to track the initial directory and ensures
proper directory navigation when processing services in the release
deployment workflow.

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
This commit is contained in:
rjshrjndrn 2025-03-06 16:18:39 +01:00 committed by Rajesh Rajendran
parent 15829d865e
commit 45656ec6d7

View file

@ -40,6 +40,7 @@ jobs:
run: | run: |
# Parse the comma-separated services list into an array # Parse the comma-separated services list into an array
IFS=',' read -ra SERVICES <<< "${{ github.event.inputs.services }}" IFS=',' read -ra SERVICES <<< "${{ github.event.inputs.services }}"
working_dir=$(pwd)
# Define backend services (consider moving this to workflow inputs or repo config) # Define backend services (consider moving this to workflow inputs or repo config)
ls backend/cmd >> /tmp/backend.txt ls backend/cmd >> /tmp/backend.txt
@ -48,10 +49,11 @@ jobs:
for SERVICE in "${SERVICES[@]}"; do for SERVICE in "${SERVICES[@]}"; do
# Check if service is backend # Check if service is backend
if grep -q $SERVICE /tmp/backend.txt; then if grep -q $SERVICE /tmp/backend.txt; then
cd backend cd $working_dir/backend
foss_build_args="nil $SERVICE" foss_build_args="nil $SERVICE"
ee_build_args="ee $SERVICE" ee_build_args="ee $SERVICE"
else else
cd $working_dir
[[ $SERVICE == 'chalice' || $SERVICE == 'alerts' || $SERVICE == 'crons' ]] && cd $working_dir/api || cd $SERVICE [[ $SERVICE == 'chalice' || $SERVICE == 'alerts' || $SERVICE == 'crons' ]] && cd $working_dir/api || cd $SERVICE
[[ $SERVICE == 'alerts' || $SERVICE == 'crons' ]] && BUILD_SCRIPT_NAME="build_${SERVICE}.sh" [[ $SERVICE == 'alerts' || $SERVICE == 'crons' ]] && BUILD_SCRIPT_NAME="build_${SERVICE}.sh"
ee_build_args="ee" ee_build_args="ee"