Skip to content

[JENKINS-43052] Warn if a deprecated extension is used in Pipeline#3905

Merged
MarkEWaite merged 22 commits intojenkinsci:masterfrom
Nimbusprogrammer:fix-pr-1639-deprecated-warnings
Dec 30, 2025
Merged

[JENKINS-43052] Warn if a deprecated extension is used in Pipeline#3905
MarkEWaite merged 22 commits intojenkinsci:masterfrom
Nimbusprogrammer:fix-pr-1639-deprecated-warnings

Conversation

@Nimbusprogrammer
Copy link
Contributor

Implements Pipeline-only DEPRECATED warnings when deprecated GitSCM extensions are used, as described in JENKINS-43052.

The warning is written only to Pipeline build logs and does not alter behavior. Freestyle jobs are unaffected. Where applicable, the warning suggests the preferred Pipeline-native alternative.

Testing done

  • Added JUnit 5 Workflow tests using JenkinsRule and @WithGitSampleRepo to verify that DEPRECATED warnings are logged for Pipeline jobs using deprecated extensions.
  • Verified locally that Pipeline jobs log the warning and Freestyle jobs do not.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

Jira: https://issues.jenkins.io/browse/JENKINS-43052

@Nimbusprogrammer Nimbusprogrammer requested a review from a team as a code owner December 20, 2025 15:48
@github-actions github-actions bot added the tests Automated test addition or improvement label Dec 20, 2025
@MarkEWaite
Copy link
Contributor

@Nimbusprogrammer you need to resolve the spotbugs failure before I'm willing to review the proposed changes. Having spotbugs warnings says that you need to follow the instructions in the contributing guide and run mvn clean verify locally. That will fail due to the spotbugs warning and you can fix it locally.

Please close the preceding pull request if you are replacing it with this one.

@Nimbusprogrammer
Copy link
Contributor Author

Nimbusprogrammer commented Dec 26, 2025

@MarkEWaite
Thanks for the guidance.
I’ve addressed the SpotBugs warning in PreBuildMerge.decorateRevisionToBuild by guarding against a null Run, run mvn clean verify locally, and CI is now green.
The earlier pull request has been closed as suggested.

Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

I've not completed the review, but some initial comments for you to consider and possibly apply in other areas of the pull request.

@Nimbusprogrammer
Copy link
Contributor Author

@MarkEWaite
Thanks for the detailed review and for the guidance on formatting and test structure. I’ve corrected the earlier formatting issues and aligned the Workflow tests with the preferred style (scmGit, block-quoted strings, more precise assertions, and descriptive job names).

I also made a small adjustment in the tests to normalize the repository path used in the Pipeline definitions so they behave consistently across platforms.

All checks are now passing. Please let me know if you’d like any further changes.

Consistent coding pattern and avoids the need for a variable to decide if
the message has been displayed.  Messages will be displayed each checkout.

Still needs test for message exclusion deprecation and for requires
workspace polling deprecation.
@MarkEWaite
Copy link
Contributor

MarkEWaite commented Dec 30, 2025

Thanks again for the pull request. While reviewing with the debugger, I saw that there were two cases that were not covered by tests. I've added tests to cover those cases. I also realized that the deprecation messages could be simplified by placing each of them in the beforeCheckout() method. That places the deprecation message inside the implementation class (like MessageExclusion) and avoids the need for additional logic to decide if the deprecation message has already been reported for this build.

I also reduced the differences to the master branch so that the comparison would be smaller and show only the changes.

I also changed the Windows escaping of the path to the sample repository to use the Windows path separator with escaping as needed. That assures were testing Windows paths in the "Windows way".

I still need to perform interactive testing to confirm the end user experience.

MarkEWaite added a commit to MarkEWaite/docker-lfs that referenced this pull request Dec 30, 2025
@Nimbusprogrammer
Copy link
Contributor Author

@MarkEWaite Thanks for the update and for the detailed follow-up. I appreciate you adding coverage for the additional cases and simplifying the implementation.

Please let me know if there’s anything you’d like me to adjust or help verify.

Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

Thanks! I've completed interactive testing. I added test jobs to my interactive test environment so that it will continue to be easy to check.

@MarkEWaite MarkEWaite added bug Incorrect or flawed behavior and removed tests Automated test addition or improvement labels Dec 30, 2025
@MarkEWaite MarkEWaite changed the title [JENKINS-43052] Warn in Pipeline build log if a deprecated extension is used [JENKINS-43052] Warn in Pipeline console log if a deprecated extension is used Dec 30, 2025
@MarkEWaite MarkEWaite changed the title [JENKINS-43052] Warn in Pipeline console log if a deprecated extension is used [JENKINS-43052] Warn in the console log if a deprecated extension is used in Pipeline Dec 30, 2025
@MarkEWaite MarkEWaite changed the title [JENKINS-43052] Warn in the console log if a deprecated extension is used in Pipeline [JENKINS-43052] Warn if a deprecated extension is used in Pipeline Dec 30, 2025
@MarkEWaite MarkEWaite enabled auto-merge (squash) December 30, 2025 15:50
@MarkEWaite MarkEWaite merged commit 3ab523c into jenkinsci:master Dec 30, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Incorrect or flawed behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JENKINS-43052] Warn if "Additional Behaviors > Check out to a sub-directory" is used in a Pipeline project

2 participants