Skip to content

Commit f0c2e46

Browse files
committed
Add utility method for checking if a pipeline's AST is declarative
1 parent d62f76f commit f0c2e46

File tree

1 file changed

+6
-0
lines changed
  • pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser

1 file changed

+6
-0
lines changed

pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ASTParserUtils.groovy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,12 @@ class ASTParserUtils {
480480
}
481481
}
482482

483+
static boolean isDeclarativePipeline(ModuleNode src) {
484+
return src.statementBlock.statements.any {
485+
return isDeclarativePipelineStep(it)
486+
}
487+
}
488+
483489
static boolean isDeclarativePipelineStep(Statement stmt, boolean topLevel = true) {
484490
def b = matchBlockStatement(stmt)
485491

0 commit comments

Comments
 (0)