Make the stage block behave more consistently like other blocks

None of the other blocks have parenthesis and take arguments the way the
stage(name) does. To make all blocks behave a bit more in line with one another,
this commit changes the behavior of naming stages to look more like a
generalized block settings.

This presages some macro work that's coming in the following commits.
This commit is contained in:
R Tyler Croy 2019-07-06 09:31:03 -07:00
parent 9307068785
commit ff919ce892
No known key found for this signature in database
GPG Key ID: E5C92681BEF6CEA2
3 changed files with 22 additions and 11 deletions

View File

@ -121,12 +121,12 @@ stages_block
: STAGES BEGIN stages+ END
;
stages
: STAGE OPEN StringLiteral CLOSE BEGIN stageStatements* END
: STAGE BEGIN stageStatements* END
;
stageStatements
: steps
: settings
| steps
| runtime
| cache
| gates

View File

@ -45,7 +45,9 @@ environments {
pipeline {
stages {
stage('Build') {
stage {
name = 'Build'
runtime {
docker {
image = 'ruby'
@ -64,7 +66,9 @@ pipeline {
}
}
stage('Test') {
stage {
name = 'Test'
runtime {
from 'Build'
}
@ -78,8 +82,11 @@ pipeline {
}
}
stage('Deploy') {
stage('Pre-production') {
stage {
name = 'Deploy'
stage {
name = 'Pre-production'
/*
* Indicate that the stage is going to interact with the preprod stage
* and the preprod environment settings must be made available to steps
@ -129,7 +136,10 @@ pipeline {
}
}
stage('Production') {
stage {
name = 'Production'
environment -> production
gates {
from 'Pre-production'
@ -149,7 +159,6 @@ pipeline {
}
}
environment -> production
runtime {
from 'Build'

View File

@ -40,7 +40,8 @@ configure {
pipeline {
stages {
stage('Build') {
stage {
name = 'Build'
runtime {
docker {
image = 'ruby:latest'
@ -56,7 +57,8 @@ pipeline {
}
}
stage('Test') {
stage {
name = 'Test'
runtime {
from 'Build'
}