@@ -48,42 +48,40 @@ if [[ -z "$configs" && "${BUILDKITE_RETRY_COUNT:-0}" == "1" ]]; then
4848 fi
4949fi
5050
51- if [ -z " $configs " ] && [ " $SCOUT_CONFIG_GROUP_KEY " != " " ]; then
51+
52+ module_data=" "
53+ # Download module_data if SCOUT_CONFIG_GROUP_KEY is set (needed for serverRunFlags)
54+ # This is required even when retrying, as we need module_data to get serverRunFlags for each config
55+ if [ " $SCOUT_CONFIG_GROUP_KEY " != " " ]; then
5256 echo " --- Downloading Scout Test Configuration"
5357 download_artifact scout_playwright_configs.json .
54- configs=$( jq -r ' .[env.SCOUT_CONFIG_GROUP_KEY].configs[]' scout_playwright_configs.json)
58+
59+ # Extract module and its configs
60+ module_data=$( jq -c " .[] | select(.name == env.SCOUT_CONFIG_GROUP_KEY)" scout_playwright_configs.json)
61+
62+ if [[ -z " $module_data " ]]; then
63+ echo " Module '${SCOUT_CONFIG_GROUP_KEY} ' not found in scout_playwright_configs.json"
64+ exit 1
65+ fi
66+
67+ # Extract config paths only if configs is not already set (e.g., from retry logic)
68+ if [ -z " $configs " ]; then
69+ # Extract config paths: process configs with their serverRunFlags directly
70+ configs=$( echo " $module_data " | jq -r ' .configs[].path' )
71+ fi
5572fi
5673
5774if [ -z " $configs " ]; then
5875 echo " Unable to determine configs to run"
5976 exit 1
6077fi
6178
62- # Define run modes based on group
63- declare -A RUN_MODES
64- RUN_MODES[" platform" ]=" --stateful --serverless=es --serverless=oblt --serverless=security"
65- RUN_MODES[" observability" ]=" --stateful --serverless=oblt --serverless=oblt-logs-essentials"
66- RUN_MODES[" search" ]=" --stateful --serverless=es"
67- RUN_MODES[" security" ]=" --stateful --serverless=security --serverless=security-essentials --serverless=security-ease"
68-
69- # Define serverless-only run modes based on group
70- declare -A RUN_MODES_SERVERLESS_ONLY
71- RUN_MODES_SERVERLESS_ONLY[" platform" ]=" --serverless=es --serverless=oblt --serverless=security"
72- RUN_MODES_SERVERLESS_ONLY[" observability" ]=" --serverless=oblt --serverless=oblt-logs-essentials"
73- RUN_MODES_SERVERLESS_ONLY[" search" ]=" --serverless=es"
74- RUN_MODES_SERVERLESS_ONLY[" security" ]=" --serverless=security --serverless=security-essentials --serverless=security-ease"
75-
76- # Determine valid run modes for the group
77- if [[ -n " ${SERVERLESS_TESTS_ONLY:- } " ]]; then
78- echo " --- Using serverless-only test modes (SERVERLESS_TESTS_ONLY is set)"
79- RUN_MODE_LIST=${RUN_MODES_SERVERLESS_ONLY[$group]}
80- else
81- RUN_MODE_LIST=${RUN_MODES[$group]}
82- fi
83-
84- if [[ -z " $RUN_MODE_LIST " ]]; then
85- echo " Unknown group: $group "
86- exit 1
79+ # If we have module_data, we can process configs with their serverRunFlags directly
80+ # Otherwise, we need to handle the case where SCOUT_CONFIG is set directly
81+ if [[ -z " ${module_data:- } " && -n " $SCOUT_CONFIG " ]]; then
82+ echo " ⚠️ Warning: SCOUT_CONFIG is set but module_data is not available. Server run flags cannot be determined from tags."
83+ echo " As a result, tests may not run in the expected modes or with the correct configuration, which could lead to unexpected failures or incomplete test coverage."
84+ echo " Execution will proceed, but it is strongly recommended to use SCOUT_CONFIG_GROUP_KEY instead to ensure serverRunFlags are set from the JSON file."
8785fi
8886
8987results=()
@@ -137,8 +135,42 @@ while read -r config_path; do
137135 continue
138136 fi
139137
138+ # Get server run flags for this config from the module data
139+ if [[ -z " ${module_data:- } " ]]; then
140+ echo " ⚠️ Warning: No module_data available for config: $config_path "
141+ echo " Skipping config (serverRunFlags cannot be determined)"
142+ continue
143+ fi
144+
145+ # Extract serverRunFlags array for this config
146+ config_run_modes=$( echo " $module_data " | jq -r " .configs[] | select(.path == \" $config_path \" ) | .serverRunFlags[]?" )
147+
148+ if [[ -z " $config_run_modes " ]]; then
149+ echo " ⚠️ No serverRunFlags found for config: $config_path "
150+ continue
151+ fi
152+
153+ # If SERVERLESS_TESTS_ONLY is set, filter out --stateful and keep only serverless modes
154+ if [[ -n " ${SERVERLESS_TESTS_ONLY:- } " ]]; then
155+ echo " --- Using serverless-only test modes (SERVERLESS_TESTS_ONLY is set)"
156+ # Filter out --stateful and keep only serverless modes
157+ config_run_modes=$( echo " $config_run_modes " | grep -E " ^--serverless=" || true)
158+ fi
159+
160+ if [[ -z " $config_run_modes " ]]; then
161+ echo " ⚠️ No run modes available for config: $config_path (after SERVERLESS_TESTS_ONLY filtering)"
162+ continue
163+ fi
164+
165+ echo " --- Config: $config_path "
166+ echo " Tags: $( echo " $module_data " | jq -r " .configs[] | select(.path == \" $config_path \" ) | .tags | join(\" , \" )" ) "
167+ echo " Modes: $( echo " $config_run_modes " | tr ' \n' ' ' ) "
168+
140169 # Run config for each mode
141- for mode in $RUN_MODE_LIST ; do
170+ while read -r mode; do
171+ if [[ -z " $mode " ]]; then
172+ continue
173+ fi
142174 # If we're retrying specific failed pairs, check if this config+mode pair should be retried
143175 if [[ -n " $RETRY_FAILED_PAIRS " ]]; then
144176 config_mode_pair=" $config_path ($mode )"
@@ -194,7 +226,7 @@ while read -r config_path; do
194226 buildkite-agent meta-data set " $CONFIG_MODE_EXECUTION_KEY " " true"
195227 results+=(" $config_path ($mode ) ✅ (${duration} )" )
196228 fi
197- done
229+ done <<< " $config_run_modes "
198230done <<< " $configs"
199231
200232echo " --- Scout Test Run Complete: Summary"
0 commit comments