What Groovy language construct, syntax or control structure is used in the following code fragment in a Jenkinsfile?
stage('Stage 1') {
steps {
// One or more steps
}
}
i.e. What are blocks in Jenkinsfile, in terms of pure Groovy language?
what is 'steps'? or stage
?
Is it calling a function? or definition? or a function call with anonymous (lambda) argument?
Inherent in this question is another question:
Question 2:
Is a Jenkinsfile, a code fragment in groovy language?
In other words, 1. Does a Jenkinsfile follow all syntax and control structures of pure Groovy? (perhaps by an implicit library import-ed or #include d silently in beginning),
As opposed to being a DSL: 2. Jenkinsfile being almost a groovy source file augmented with new Jenkins-specific constructs not originally in Groovy, e.g. Jenkins using a preprocessing.
Which of the above two hold?
Related:
- https://www.jenkins.io/doc/book/pipeline/syntax/
- https://www.jenkins.io/doc/book/pipeline/getting-started/#directive-generator
- What is a Jenkins Stage in terms of Groovy? (despite similar title, the ask is different. The related comments are inconclusive).