openrewrite / openrewrite/rewrite

Jenkins parser does not resolve shared library methods from @Library

Open
#7,229 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

groovy parser
Dominant language
Java
Stars
3.7k
Forks
570
Avg merge
13h 12m
Merged PRs (30d)
261

Description

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"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Jenkins/Groovy parser handling @Library annotations and the FindCallGraph path that reports missing method types. Compare how shared-library methods are represented when source is available versus absent. Done means shared-library methods resolve when possible, or external dependencies are modeled distinctly so downstream recipes avoid treating them as unknown.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
compilers, devtools
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.