@@ -562,6 +562,15 @@ export async function pickTestGroupRunOrder() {
562562 ) ;
563563}
564564
565+ // copied from src/platform/packages/shared/kbn-scout/src/config/discovery/search_configs.ts
566+ interface ScoutTestDiscoveryConfig {
567+ group : string ;
568+ path : string ;
569+ usesParallelWorkers : boolean ;
570+ configs : string [ ] ;
571+ type : 'plugin' | 'package' ;
572+ }
573+
565574export async function pickScoutTestGroupRunOrder ( scoutConfigsPath : string ) {
566575 const bk = new BuildkiteClient ( ) ;
567576 const envFromlabels : Record < string , string > = collectEnvFromLabels ( ) ;
@@ -570,19 +579,22 @@ export async function pickScoutTestGroupRunOrder(scoutConfigsPath: string) {
570579 throw new Error ( `Scout configs file not found at ${ scoutConfigsPath } ` ) ;
571580 }
572581
573- const rawScoutConfigs = JSON . parse ( Fs . readFileSync ( scoutConfigsPath , 'utf-8' ) ) ;
574- const pluginsWithScoutConfigs : string [ ] = Object . keys ( rawScoutConfigs ) ;
582+ const rawScoutConfigs = JSON . parse ( Fs . readFileSync ( scoutConfigsPath , 'utf-8' ) ) as Record <
583+ string ,
584+ ScoutTestDiscoveryConfig
585+ > ;
586+ const pluginsOrPackagesWithScoutTests : string [ ] = Object . keys ( rawScoutConfigs ) ;
575587
576- if ( pluginsWithScoutConfigs . length === 0 ) {
588+ if ( pluginsOrPackagesWithScoutTests . length === 0 ) {
577589 // no scout configs found, nothing to need to upload steps
578590 return ;
579591 }
580592
581- const scoutGroups = pluginsWithScoutConfigs . map ( ( plugin ) => ( {
582- title : plugin ,
583- key : plugin ,
584- usesParallelWorkers : rawScoutConfigs [ plugin ] . usesParallelWorkers ,
585- group : rawScoutConfigs [ plugin ] . group ,
593+ const scoutCiRunGroups = pluginsOrPackagesWithScoutTests . map ( ( name ) => ( {
594+ label : `Scout: [ ${ rawScoutConfigs [ name ] . group } / ${ name } ] ${ rawScoutConfigs [ name ] . type } ` ,
595+ key : name ,
596+ agents : expandAgentQueue ( rawScoutConfigs [ name ] . usesParallelWorkers ? 'n2-8-spot' : 'n2-4-spot' ) ,
597+ group : rawScoutConfigs [ name ] . group ,
586598 } ) ) ;
587599
588600 // upload the step definitions to Buildkite
@@ -591,13 +603,13 @@ export async function pickScoutTestGroupRunOrder(scoutConfigsPath: string) {
591603 {
592604 group : 'Scout Configs' ,
593605 key : 'scout-configs' ,
594- depends_on : [ 'build ' ] ,
595- steps : scoutGroups . map (
596- ( { title , key, group, usesParallelWorkers } ) : BuildkiteStep => ( {
597- label : `Scout: [ ${ group } / ${ title } ] plugin` ,
606+ depends_on : [ 'build_scout_tests ' ] ,
607+ steps : scoutCiRunGroups . map (
608+ ( { label , key, group, agents } ) : BuildkiteStep => ( {
609+ label,
598610 command : getRequiredEnv ( 'SCOUT_CONFIGS_SCRIPT' ) ,
599611 timeout_in_minutes : 60 ,
600- agents : expandAgentQueue ( usesParallelWorkers ? 'n2-8-spot' : 'n2-4-spot' ) ,
612+ agents,
601613 env : {
602614 SCOUT_CONFIG_GROUP_KEY : key ,
603615 SCOUT_CONFIG_GROUP_TYPE : group ,
0 commit comments