Skip to content

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

@VladFrost

Description

@VladFrost

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
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions