Skip to content

Jenkins parser does not resolve shared library methods from @Library #7229

@MBoegers

Description

@MBoegers

Description

The Jenkins/Groovy parser does not resolve methods provided by shared libraries imported via the @Library annotation. This affects any recipe that relies on type attribution in Jenkinsfiles and lead to unresolvable types.

Example Jenkinsfile:

#!groovy
@Library(['my-pipeline-library', 'my-jenkins-library'])
sbPipeline()

sbPipeline() is defined in an external Jenkins shared library, not in the Jenkinsfile itself. The parser cannot resolve this method, resulting in missing type attribution. Recipes like FindCallGraph then report "Method type not found" warnings, but the root cause is the parser not understanding @Library imports.

Expected behavior

The Jenkins/Groovy parser should either:

  1. Resolve shared library methods if the library source is available in the analysis scope, or
  2. Model @Library imports as external dependencies so that downstream recipes can distinguish "unresolved external method" from "truly unknown method"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions