File tree 2 files changed +18
-5
lines changed
2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -63,13 +63,12 @@ export class Job {
63
63
jobData = deepExtend . apply ( this , deepExtendList ) ;
64
64
}
65
65
66
- this . stage = jobData . stage ;
66
+ // If the stage name is not set, it should default to "test", see:
67
+ // https://docs.gitlab.com/ee/ci/yaml/#configuration-parameters
68
+ this . stage = jobData . stage || "test" ;
67
69
this . scripts = [ ] . concat ( jobData . script || [ ] ) ;
68
70
69
71
this . stageIndex = stages . indexOf ( this . stage ) ;
70
- if ( this . stageIndex === - 1 ) {
71
- this . stage = stages [ 0 ] ;
72
- }
73
72
74
73
const jobNameStr = this . getJobNameString ( ) ;
75
74
Original file line number Diff line number Diff line change @@ -47,7 +47,21 @@ export class Parser {
47
47
// Setup variables and "merged" yml
48
48
const gitlabData = deepExtend . apply ( this , yamlDataList ) ;
49
49
50
- // Generate stages
50
+ // Generate stages. We'll do our best to replicate what the
51
+ // gitlab-org runner does.
52
+
53
+ // If there's no stages defined by the user, the following stages
54
+ // must be defined. Please see:
55
+ // https://docs.gitlab.com/ee/ci/yaml/#stages
56
+ if ( ! gitlabData . stages ) {
57
+ gitlabData . stages = [ "build" , "test" , "deploy" ] ;
58
+ }
59
+
60
+ // ".pre" and ".post" are always present. See:
61
+ // https://docs.gitlab.com/ee/ci/yaml/#pre-and-post
62
+ gitlabData . stages . unshift ( ".pre" ) ;
63
+ gitlabData . stages . push ( ".post" ) ;
64
+
51
65
for ( const value of gitlabData . stages || [ ] ) {
52
66
this . stages . set ( value , new Stage ( value ) ) ;
53
67
}
You can’t perform that action at this time.
0 commit comments