@@ -58,8 +58,6 @@ func (doc *YamlDocument) parseSingleExecutor(executorNode *sitter.Node) {
58
58
doc .Executors [executorName ] = doc .parseSingleExecutorMachine (executorNameNode , blockMappingNode )
59
59
case "macos" :
60
60
doc .Executors [executorName ] = doc .parseSingleExecutorMacOS (executorNameNode , blockMappingNode )
61
- case "windows" :
62
- doc .Executors [executorName ] = doc .parseSingleExecutorWindows (executorNameNode , blockMappingNode )
63
61
}
64
62
})
65
63
@@ -200,32 +198,6 @@ func (doc *YamlDocument) parseSingleExecutorMacOS(nameNode *sitter.Node, valueNo
200
198
return res
201
199
}
202
200
203
- func (doc * YamlDocument ) parseSingleExecutorWindows (nameNode * sitter.Node , valueNode * sitter.Node ) ast.WindowsExecutor {
204
- // valueNode is a block_mapping
205
- res := ast.WindowsExecutor {}
206
-
207
- parseWindows := func (blockNode * sitter.Node ) {
208
- // blockNode is a block_node
209
- blockMappingNode := GetChildMapping (blockNode )
210
-
211
- if blockMappingNode == nil { //TODO: deal with errors
212
- return
213
- }
214
-
215
- doc .iterateOnBlockMapping (blockMappingNode , func (child * sitter.Node ) {
216
- keyNode , valueNode := doc .GetKeyValueNodes (child )
217
- keyName := doc .GetNodeText (keyNode )
218
- switch keyName {
219
- case "image" :
220
- res .Image = doc .GetNodeText (valueNode )
221
- }
222
- })
223
- }
224
-
225
- doc .parseBaseExecutor (& res .BaseExecutor , nameNode , valueNode , parseWindows , "windows" )
226
- return res
227
- }
228
-
229
201
func (doc * YamlDocument ) parseSingleExecutorDocker (nameNode * sitter.Node , valueNode * sitter.Node ) ast.DockerExecutor {
230
202
// valueNode is a block_mapping
231
203
res := ast.DockerExecutor {
@@ -236,7 +208,7 @@ func (doc *YamlDocument) parseSingleExecutorDocker(nameNode *sitter.Node, valueN
236
208
// blockNode is a block_node
237
209
blockSequence := GetChildSequence (blockNode )
238
210
239
- if blockSequence == nil { //TODO: deal with errors
211
+ if blockSequence == nil { // TODO: deal with errors
240
212
return
241
213
}
242
214
@@ -257,14 +229,14 @@ func (doc *YamlDocument) parseDockerImage(imageNode *sitter.Node) ast.DockerImag
257
229
dockerImg := ast.DockerImage {}
258
230
blockNode := GetChildOfType (imageNode , "block_node" )
259
231
260
- if blockNode == nil { //TODO: deal with errors
232
+ if blockNode == nil { // TODO: deal with errors
261
233
// Can happen if the docker is an alias/anchor
262
234
return dockerImg
263
235
}
264
236
265
237
blockMappingNode := GetChildMapping (blockNode )
266
238
267
- if blockMappingNode == nil { //TODO: deal with errors
239
+ if blockMappingNode == nil { // TODO: deal with errors
268
240
return dockerImg
269
241
}
270
242
@@ -331,7 +303,7 @@ func (doc *YamlDocument) parseExecutorRef(valueNode *sitter.Node, child *sitter.
331
303
332
304
name := ""
333
305
blockMapping := GetChildMapping (valueNode )
334
- if blockMapping == nil { //TODO: deal with errors
306
+ if blockMapping == nil { // TODO: deal with errors
335
307
return "" , protocol.Range {}, executorParameters
336
308
}
337
309
@@ -368,11 +340,11 @@ func (doc *YamlDocument) addedMachineTrueDeprecatedDiag(child *sitter.Node, reso
368
340
return false
369
341
}
370
342
371
- if ! doc .Context .Api .UseDefaultInstance () || doc .IsSelfHostedRunner (resourceClass ) {
343
+ if ! doc .Context .Api .UseDefaultInstance () || utils .IsSelfHostedRunner (resourceClass ) {
372
344
return false
373
345
}
374
346
375
- if doc .IsSelfHostedRunner (resourceClass ) {
347
+ if utils .IsSelfHostedRunner (resourceClass ) {
376
348
return false
377
349
}
378
350
machineRange := doc .NodeToRange (child )
@@ -382,18 +354,19 @@ func (doc *YamlDocument) addedMachineTrueDeprecatedDiag(child *sitter.Node, reso
382
354
}
383
355
384
356
func (doc * YamlDocument ) machineTrueFix (machineRange protocol.Range ) {
385
- img := utils .GetLatestUbuntu2204Image ()
386
357
diagnostic := utils .CreateDiagnosticFromRange (
387
358
machineRange ,
388
359
protocol .DiagnosticSeverityWarning ,
389
- utils .GetMachineTrueMessage (img ),
360
+ utils .GetMachineTrueMessage (utils . CurrentLinuxImage ),
390
361
[]protocol.CodeAction {
391
- utils .CreateCodeActionTextEdit ("Replace with most updated ubuntu image" , doc .URI ,
362
+ utils .CreateCodeActionTextEdit ("Replace with current Ubuntu image" , doc .URI ,
392
363
[]protocol.TextEdit {
393
364
{
394
365
Range : machineRange ,
395
- NewText : `machine:
396
- ` + strings .Repeat (" " , int (machineRange .Start .Character )) + ` image: ` + utils .GetLatestUbuntu2204Image (),
366
+ NewText : "machine:\n " +
367
+ strings .Repeat (" " , int (machineRange .Start .Character )) +
368
+ " image: " +
369
+ utils .CurrentLinuxImage ,
397
370
},
398
371
}, false ),
399
372
},
@@ -402,9 +375,4 @@ func (doc *YamlDocument) machineTrueFix(machineRange protocol.Range) {
402
375
protocol .DiagnosticTagDeprecated ,
403
376
}
404
377
doc .addDiagnostic (diagnostic )
405
-
406
- }
407
-
408
- func (doc * YamlDocument ) IsSelfHostedRunner (resourceClass string ) bool {
409
- return len (strings .Split (resourceClass , "/" )) > 1
410
378
}
0 commit comments