Skip to content

Testing commons-lang2 removal from jenkins-core - #6234

Draft
alecharp wants to merge 26 commits into
jenkinsci:masterfrom
alecharp:testing/commons-lang2-removal
Draft

Testing commons-lang2 removal from jenkins-core#6234
alecharp wants to merge 26 commits into
jenkinsci:masterfrom
alecharp:testing/commons-lang2-removal

Conversation

@alecharp

Copy link
Copy Markdown
Member

This is simply to validate / see what breaks with the removal of the library from Jenkins Core.
See jenkinsci/jenkins#26105.

@alecharp alecharp added do-not-merge weekly-test Test only the Weekly line in this PR labels Jan 14, 2026
Comment thread sample-plugin/pom.xml Outdated

@MarkEWaite MarkEWaite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can update to a more recent incremental of Jenkins core.

@timja

timja commented Feb 3, 2026

Copy link
Copy Markdown
Member

I tried using openrewrite but neither the commons-lang3-api recipe or openrewrite cli seemed to do anything for me.

Gave up and just did:

rg -0 -lF 'org.apache.commons.lang.' . |
while IFS= read -r -d '' file; do
  sed -i '' 's/org.apache.commons.lang/org.apache.commons.lang3/' "$file"
done

Added the dep:

        <dependency>
            <groupId>io.jenkins.plugins</groupId>
            <artifactId>commons-lang3-api</artifactId>
        </dependency>

Banned commons-lang2:

<ban-commons-lang-2.skip>false</ban-commons-lang-2.skip>

Would be nice if there was a command that could be run to just do it.
Or migrate to Java platform API...

@timja

timja commented Feb 5, 2026

Copy link
Copy Markdown
Member

@jonesbusy any idea what I was missing above? I would have thought there should be a simple method of migrating commons-lang to either java APIs or to commons-lang3

@jonesbusy

jonesbusy commented Feb 8, 2026

Copy link
Copy Markdown
Contributor

@jonesbusy any idea what I was missing above? I would have thought there should be a simple method of migrating commons-lang to either java APIs or to commons-lang3

Any error in particular?

There is a recipe that change to commons-lang3 plugin-modernizer dry-run --plugins <plugin> --recipe MigrateCommonsLang2ToLang3AndCommonText that I was using of quiet a few plugins

For native Java API it's tracked by jenkins-infra/plugin-modernizer-tool#1542

It's probably just reusing what is provided by OpenRewrite

EDIT: Not sure if related by last with infra incident but some URL that we were using to get installation data return 404

        at io.jenkins.tools.pluginmodernizer.cli.Main.main(Main.java:50)
Caused by: io.jenkins.tools.pluginmodernizer.core.model.ModernizerException: Failed to get CSV data. Received response code: 404 from https://stats.jenkins.io/jenkins-stats/svg/202505-plugins.csv
        at io.jenkins.tools.pluginmodernizer.core.utils.CSVUtils.fromUrl(CSVUtils.java:40)

I will publish a release that ignore installation stats for now

MarkEWaite added a commit to MarkEWaite/repository-permissions-updater that referenced this pull request Feb 11, 2026
Plugin repository:

* https://github.com/jenkinsci/job-dsl-plugin

Pull request to enable automated releases (CD):

* jenkinsci/job-dsl-plugin#2563

The new release will help with the removal of Apache Commons Lang 2 from
Jenkins core.  That is currently being tested in:

* jenkinsci/jenkins#16404
* jenkinsci/bom#6234

Also updates permissions that were missed in previous changes.  Completes
the removal of @jamietanna and @daspilker as Job DSL maintainers, since
they removed themselves with earlier pull requests.

@jamietanna removed himself as a Job DSL maintainer in pull request:

* jenkins-infra#4404

@daspilker removed himself as a Job DSL maintainer in pull request:

* jenkins-infra#4385
Comment thread sample-plugin/pom.xml Outdated
@timja

timja commented Aug 4, 2026

Copy link
Copy Markdown
Member

warnings-ng is failing because of https://github.com/jenkinsci/flexible-publish-plugin/blob/c66efc74337e0ad8af61def68433e4c093cd0f28/src/main/java/org/jenkins_ci/plugins/flexible_publish/builder/FailAtEndBuilder.java#L33

Which is not captured in the spreadsheet.
I'm doing a usage in plugins run to make sure everything is captured.

@timja

timja commented Aug 4, 2026

Copy link
Copy Markdown
Member

No idea where that original spreadsheet came from =/ It was missing about 400 plugins.
It was accurate for most of the high install plugins, but quite a few in the 1000-10000 range missing

Added to the sheet now though

@timja

timja commented Aug 4, 2026

Copy link
Copy Markdown
Member

I pointed my debug skill at this PR using the ci.jenkins.io MCP.

Updated 08/08

Commons Lang 2 removal — PCT triage for #6234, build #11

Build: Tools/bom/PR-6234 #11FAILURE, validating jenkinsci/jenkins#26105.

12 pct-*-plugin-weekly jobs failing / 115 failing tests, down from 22 jobs / ~225 tests in #10.

Every one of the 115 has age=7, failedSince=5 — all attributable to this change, with no unrelated flakes mixed in. Causes: 70 × StringUtils, 29 × cascade from ArrayUtils (see swarm), 9 × RandomStringUtils, 2 × StringEscapeUtils, 2 × cascade from StringUtils in a bundled library (see build-failure-analyzer), 1 × WordUtils, 1 × reflect.ConstructorUtils, 1 × silent no-op (see warnings-ng).

Every remaining failure now has either an open PR or a pending version bump — nothing is uncovered.

Open PRs — live status

Merged, awaiting a release

Released — needs a version bump only

Cleared since build #10

authorize-project · claim · multibranch-build-strategy-extension · gitea · gitea-checks · instant-messaging · s3 · google-storage · role-strategy · sbt

Which PR clears which job

PCT job Tests Culprit Fix
swarm 38 swarm PluginImpl.java:27 (ArrayUtils) — main code, plus 2 test classes jenkinsci/swarm-plugin#904
htmlpublisher 33 htmlpublisher jenkinsci/htmlpublisher-plugin#371 (in no release)
build-failure-analyzer 18 16 × build-failure-analyzer, 2 × bundled gerrit-events lib jenkinsci/build-failure-analyzer-plugin#418 + sonyxperiadev/gerrit-events#131
view-job-filters 8 view-job-filters jenkinsci/view-job-filters-plugin#116
mcp-server 4 2 × extended-choice-parameter, 2 × list-git-branches-parameter jenkinsci/mcp-server-plugin#218 + jenkinsci/list-git-branches-parameter-plugin#80
declarative-pipeline-migration-assistant 4 htmlpublisher jenkinsci/htmlpublisher-plugin#371
reverse-proxy-auth 2 reverse-proxy-auth jenkinsci/reverse-proxy-auth-plugin#218
pipeline-model-definition 2 htmlpublisher + reflect.ConstructorUtils (pipeline-model-extensions, already released) jenkinsci/htmlpublisher-plugin#371
kubernetes-credentials-provider 2 hashicorp-vault jenkinsci/hashicorp-vault-plugin#376 (released, needs dep bump)
bitbucket-branch-source 2 bitbucket-branch-source jenkinsci/bitbucket-branch-source-plugin#1237 (merged, unreleased)
warnings-ng 1 flexible-publish FailAtEndBuilder jenkinsci/flexible-publish-plugin#27
build-monitor 1 build-monitor jenkinsci/build-monitor-plugin#1324 (released, needs BOM bump)

6 of the 12 are collateral damage — the plugin under test is clean, a dependency is not.

swarm — 29 of the 38 are cascade, not separate failures

Only 9 failures name RandomStringUtils directly. The other 29 surface as InterruptedException: sleep interrupted in SwarmClientRule.waitOnline, which looks like a timeout but is not: the client's captured stderr shows

java.lang.ClassNotFoundException: org.apache.commons.lang.ArrayUtils
Caused: java.lang.NoClassDefFoundError: org/apache/commons/lang/ArrayUtils
Caused: jakarta.servlet.ServletException

thrown from a servlet request. PluginImpl.java:27 — swarm's main code, not just test code — imports org.apache.commons.lang.ArrayUtils, so agent registration 500s, the client never comes online, and waitOnline times out. jenkinsci/swarm-plugin#904 fixes PluginImpl and both test classes, so it clears all 38.

htmlpublisher — highest leverage, blocks 3 jobs / 37 tests

jenkinsci/htmlpublisher-plugin#371 merged 2025-10-03 and master is on lang3, but the newest release htmlpublisher-427.1 (2026-04-29, the version the BOM pins) still has import org.apache.commons.lang.StringUtils at line 21 of HtmlPublisherTarget.java.

compare/htmlpublisher-427.1...964f7305 reports diverged, ahead 4 / behind 2 — 427.1 was cut from a maintenance line that never contained the fix. This cannot be resolved by picking up a newer 427.x; it needs a release off master.

build-failure-analyzer — a third-party library, outside the plugin ecosystem

14 StringUtils + 1 StringEscapeUtils + 1 WordUtils failures are build-failure-analyzer's own code, covered by jenkinsci/build-failure-analyzer-plugin#418.

The remaining 2 (ScanOnDemandBaseActionTest, surfacing as HTTP 500) are not BFA's code and jenkinsci/build-failure-analyzer-plugin#418 will not fix them:

at com.sonymobile.tools.gerrit.gerritevents.GerritHandler.scheduleGerritWhitelistRead(GerritHandler.java:…)
Caused: java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils

That is com.sonymobile.tools.gerrit:gerrit-events 2.22.0, a plain Java library from sonyxperiadev/gerrit-events reached via gerrit-trigger (BFA depends on gerrit-trigger 2.39.0, optional). Because it is not a Jenkins plugin, the ban-commons-lang-2 enforcer never flagged it. sonyxperiadev/gerrit-events#131 migrates all 5 affected files; it needs an upstream release and a gerrit-events bump in gerrit-trigger before this job goes green.

Worth noting for reviewers: that PR removes the source usage but leaves commons-lang:2.5 as a transitive dependency of net.sf.json-lib:json-lib:2.4, which cannot simply be excluded — json-lib 2.4 makes 59 bytecode references to Commons Lang 2. That does not affect this BOM run: in gerrit-trigger's resolved tree commons-lang is provided and never bundled (dependency:list -DincludeScope=runtime shows only lang3 reaching WEB-INF/lib), and net.sf.json-lib is substituted by org.kohsuke.stapler:json-lib, also provided. The failing call sites were gerrit-events' own, so removing them is sufficient here.

Separately, gerrit-trigger's own migration was incomplete: jenkinsci/gerrit-trigger-plugin#519 (merged, released) migrated PluginPatchsetCreatedEvent.java but missed the sibling PluginChangeMergedEvent.java:32. jenkinsci/gerrit-trigger-plugin#1030 fixes that and enables ban-commons-lang-2, which had never been set on that plugin — which is exactly why the miss went unnoticed.

Needs only version movement — no new code

Plugin Currently resolved Fixed in Action
build-monitor 1.14-985.v7b_f37b_3d0b_f5 (BOM pin) 1113.v841eb_e2ccda_5 (2026-08-05) bump in BOM
hashicorp-vault 368.v48134f694db_f (kubernetes-credentials-provider pom; not managed by bom-weekly) 384.vda_86ec66c537 (2026-08-05) bump in kubernetes-credentials-provider
bitbucket-branch-source 937.3.6 (2026-07-10) jenkinsci/bitbucket-branch-source-plugin#1237, merged 2026-07-23 needs a release

A full usage-in-plugins scan of all 2093 published plugins on 2026-08-08 confirms cloudbees-bitbucket-branch-source:937.3.6 still references Commons Lang 2, so that release genuinely predates the fix.

mcp-server — two culprits, split exactly 2 / 2

So jenkinsci/mcp-server-plugin#218 clears half this job; the other half is the longest remaining chain of the twelve.

warnings-ng — now has a stack trace

In build #10 this failure (FlexiblePublishITest, "Expected size: 2 but was: 0") had no stack trace and flexible-publish was inferred. Build #11 confirms it directly:

at org.jenkins_ci.plugins.flexible_publish.builder.FailAtEndBuilder$1.getDisplayName(FailAtEndBuilder.java:…)
Caused: java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils

The publisher fails silently and produces zero results rather than erroring. jenkinsci/flexible-publish-plugin#27 covers FailAtEndBuilder.java.

Releases needed before this run can go green

@timja

timja commented Aug 8, 2026

Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

@timja

timja commented Aug 8, 2026

Copy link
Copy Markdown
Member

14 failing now, previously 23.

All should have PRs open or merged, some unreleased (e.g. jenkinsci/bitbucket-branch-source-plugin#1237)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge weekly-test Test only the Weekly line in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants