@@ -48,6 +48,40 @@ function getScoutConfigGroupType(configPath: string): string | null {
4848 return null ;
4949}
5050
51+ function getScoutServerRunFlags ( configPath : string ) : string [ ] {
52+ const groupType = getScoutConfigGroupType ( configPath ) ;
53+
54+ if ( ! groupType ) {
55+ throw new Error (
56+ `Unable to determine scout config group type from path: ${ configPath } . ` +
57+ `Expected path to match platform pattern (x-pack/platform/... or src/platform/...) ` +
58+ `or solution pattern (x-pack/solutions/<solution>/plugins/...)`
59+ ) ;
60+ }
61+
62+ if ( groupType === 'platform' ) {
63+ return [ '--stateful' , '--serverless=es' , '--serverless=oblt' , '--serverless=security' ] ;
64+ }
65+
66+ if ( groupType === 'workplaceai' ) {
67+ return [ '--serverless=workplace-ai' ] ;
68+ }
69+
70+ const flags = [ '--stateful' ] ;
71+
72+ if ( groupType === 'observability' ) {
73+ flags . push ( '--serverless=oblt' ) ;
74+ } else if ( groupType === 'security' ) {
75+ flags . push ( '--serverless=security' ) ;
76+ } else if ( groupType === 'search' ) {
77+ flags . push ( '--serverless=search' ) ;
78+ } else {
79+ throw new Error ( `Unknown solution type: ${ groupType } .` ) ;
80+ }
81+
82+ return flags ;
83+ }
84+
5185function getTestSuitesFromJson ( json : string ) {
5286 const fail = ( errorMsg : string ) => {
5387 console . error ( '+++ Invalid test config provided' ) ;
@@ -192,12 +226,14 @@ for (const testSuite of testSuites) {
192226 if ( testSuite . type === 'scoutConfig' ) {
193227 const usesParallelWorkers = testSuite . scoutConfig . endsWith ( 'parallel.playwright.config.ts' ) ;
194228 const scoutConfigGroupType = getScoutConfigGroupType ( testSuite . scoutConfig ) ;
229+ const serverRunFlags = getScoutServerRunFlags ( testSuite . scoutConfig ) ;
195230
196231 steps . push ( {
197232 command : `.buildkite/scripts/steps/test/scout_configs.sh` ,
198233 env : {
199234 SCOUT_CONFIG : testSuite . scoutConfig ,
200235 SCOUT_CONFIG_GROUP_TYPE : scoutConfigGroupType ! ,
236+ SCOUT_SERVER_RUN_FLAGS : serverRunFlags . join ( '\n' ) ,
201237 } ,
202238 key : `${ TestSuiteType . SCOUT } -${ suiteIndex ++ } ` ,
203239 label : `${ testSuite . scoutConfig } ` ,
0 commit comments