Skip to content

Commit d727bb3

Browse files
committed
add lock and unlock jobs to the Go code for validation
1 parent 7ba7705 commit d727bb3

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

pkg/parser/validate/jobs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ func (val Validate) validateSingleJob(job ast.Job) {
2121

2222
val.validateSteps(job.Steps, job.Name, job.Parameters)
2323

24-
if job.Steps != nil && (job.Type == "approval" || job.Type == "no-op" || job.Type == "release") {
24+
if job.Steps != nil && job.Type != "" && job.Type != "build" {
2525
val.addDiagnostic(
2626
protocol.Diagnostic{
2727
Range: job.StepsRange,
28-
Message: "If job type is approval, no-op or release, then steps will be ignored.",
28+
Message: "Steps only exist in `build` jobs. Steps here will be ignored.",
2929
Severity: protocol.DiagnosticSeverityWarning,
3030
},
3131
)

pkg/parser/validate/jobs_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ func TestJobTypeValidation(t *testing.T) {
315315
End: protocol.Position{Line: 2, Character: 18},
316316
},
317317
Severity: protocol.DiagnosticSeverityError,
318-
Message: "Invalid job type 'bad-type'. Allowed types: approval, build, no-op, release",
318+
Message: "Invalid job type 'bad-type'. Allowed types: approval, build, no-op, release, lock, unlock",
319319
},
320320
},
321321
{
@@ -331,7 +331,7 @@ func TestJobTypeValidation(t *testing.T) {
331331
End: protocol.Position{Line: 4, Character: 16},
332332
},
333333
Severity: protocol.DiagnosticSeverityWarning,
334-
Message: "If job type is approval, no-op or release, then steps will be ignored.",
334+
Message: "Steps only exist in `build` jobs. Steps here will be ignored.",
335335
},
336336
},
337337
}

pkg/utils/jobs.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ var JobTypes = []string{
2222
"build", // default
2323
"no-op",
2424
"release",
25+
"lock",
26+
"unlock",
2527
}

0 commit comments

Comments
 (0)