github-api-global-lib icon indicating copy to clipboard operation
github-api-global-lib copied to clipboard

The nested block depth is 6 GroovyLint(NestedBlockDepth-42)

Open VladFrost opened this issue 1 year ago • 0 comments

Hello @darinpope I'm trying to implement a Jenkins declarative pipeline with parallel stages, but I've run into an issue with the GroovyLint tool. It's complaining about The nested block depth is 6 GroovyLint(NestedBlockDepth-42). I've seen similar issues in certain parts of your library and was wondering if there's a way to manage this complexity across libraries? For example, can I delegate particular parts of the declarative pipeline like all constructions inside parallel block to a shared library so that the nested block depth isn't an issue?

image

Here is an example that I didn't find in your library.

Jenkinsfile:
parallel {
    executeStagesInParallel()
}

executeStagesInParallel.groovy:
void call() {
    stage('Stage a') {
        steps {
            echo env.STAGE_NAME
        }
    }
    stage('Stage b') {
        steps {
            echo env.STAGE_NAME
        }
    }
}

VladFrost avatar May 23 '24 09:05 VladFrost