@@ -117,6 +117,7 @@ async function evaluateAndRemoveRunners(
117
117
118
118
for ( const ownerTag of ownerTags ) {
119
119
const ec2RunnersFiltered = ec2Runners . filter ( ( runner ) => runner . owner === ownerTag ) ;
120
+ console . debug ( `Found: '${ ec2RunnersFiltered . length } ' active GitHub runners with owner tag: '${ ownerTag } '` ) ;
120
121
for ( const ec2Runner of ec2RunnersFiltered ) {
121
122
const ghRunners = await listGitHubRunners ( ec2Runner ) ;
122
123
const ghRunner = ghRunners . find ( ( runner ) => runner . name === ec2Runner . instanceId ) ;
@@ -190,15 +191,20 @@ export async function scaleDown(): Promise<void> {
190
191
191
192
// list and sort runners, newest first. This ensure we keep the newest runners longer.
192
193
const ec2Runners = await listAndSortRunners ( environment ) ;
194
+ const activeEc2RunnersCount = ec2Runners . length ;
195
+ console . info ( `Found: '${ activeEc2RunnersCount } ' active GitHub EC2 runner instances before clean-up.` ) ;
193
196
194
- if ( ec2Runners . length === 0 ) {
197
+ if ( activeEc2RunnersCount === 0 ) {
195
198
console . debug ( `No active runners found for environment: '${ environment } '` ) ;
196
199
return ;
197
200
}
198
201
const legacyRunners = filterLegacyRunners ( ec2Runners ) ;
199
- console . log ( JSON . stringify ( legacyRunners ) ) ;
202
+ console . debug ( JSON . stringify ( legacyRunners ) ) ;
200
203
const runners = filterRunners ( ec2Runners ) ;
201
204
202
205
await evaluateAndRemoveRunners ( runners , scaleDownConfigs ) ;
203
206
await evaluateAndRemoveRunners ( legacyRunners , scaleDownConfigs ) ;
207
+
208
+ const activeEc2RunnersCountAfter = ( await listAndSortRunners ( environment ) ) . length ;
209
+ console . info ( `Found: '${ activeEc2RunnersCountAfter } ' active GitHub EC2 runners instances after clean-up.` ) ;
204
210
}
0 commit comments