Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt test for git plugin 5.0 #40

Merged
merged 1 commit into from Dec 21, 2022

Conversation

MarkEWaite
Copy link
Contributor

@MarkEWaite MarkEWaite commented Dec 18, 2022

Adapt test for git plugin 5.0

Git plugin 5.0 will require Java 11 and will add symbols to improve the Pipeline syntax editing experience. The test being modified in this pull request checks the specific syntax of the Pipeline snippet syntax generator. Adapt the test to check for current syntax with git plugin 4.x releases and for new syntax with any other releases.

It would be nice to have a new release of this plugin ready to go at (or before) the release of git plugin 5.0.0 so that the bom can include git plugin 5.0.0 soon after the release of git plugin 5.0.0.

  • 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 demonstrates feature works or fixes the issue

Git plugin 5.0 will require Java 11 and will add symbols to improve
the Pipeline syntax editing experience.  The test being modified in
this pull request checks the specific syntax of the Pipeline snippet
syntax generator.  Adapt the test to check for current syntax with git
plugin 4.x releases and for new syntax with any other releases.

jenkinsci/git-client-plugin#939 is the git
client plugin pull request that prepares git client plugin 4.0.0.
It will require Java 11 and will upgrade from JGit 5.13.1 to JGit 6.4.0.

jenkinsci/bom#1619 is the bom draft pull request
that confirms git client plugin 4.0.0 pre-release works in the plugin bom.

jenkinsci/git-plugin#1367 is the git plugin pull
request that prepares git plugin 5.0.0.  It will require Java 11.

jenkinsci/bom#1624 is the bom draft pull request
that tests git plugin 5.0.0 works in the plugin bom.

jenkinsci/git-plugin#1373 is the git plugin pull
request that relies on jenkinsci/git-plugin#1367
and adds symbols to the git plugin.

jenkinsci/bom#1625 is the bom draft pull request
that tests git plugin 5.0.0 with added symbols works in the plugin bom.
It detected this test failure when run with git plugin 5.0.0 pre-release.
@MarkEWaite
Copy link
Contributor Author

@jglick are you the preferred person to review this pull request or is there someone else that I should ask?

if (r.jenkins.get().getPlugin("git").getWrapper().getVersion().startsWith("4.")) {
snippetizerTester.assertRoundTrip(s, "library changelog: false, identifier: 'foo@master', retriever: legacySCM([$class: 'GitSCM', branches: [[name: '${library.foo.version}']], extensions: [], userRemoteConfigs: [[url: 'https://nowhere.net/']]])");
} else {
snippetizerTester.assertRoundTrip(s, "library changelog: false, identifier: 'foo@master', retriever: legacySCM(scmGit(branches: [[name: '${library.foo.version}']], extensions: [], userRemoteConfigs: [[url: 'https://nowhere.net/']]))");
Copy link
Member

Choose a reason for hiding this comment

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

I guess this is not simply git because that would conflict with the Step? 😞

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's correct. I wanted to use git but there is already a git step defined.

@@ -85,7 +85,11 @@ public class LibraryStepTest {
null, null, Collections.<GitSCMExtension>emptyList())));
s.setChangelog(false);
r.assertEqualDataBoundBeans(s, stepTester.configRoundTrip(s));
snippetizerTester.assertRoundTrip(s, "library changelog: false, identifier: 'foo@master', retriever: legacySCM([$class: 'GitSCM', branches: [[name: '${library.foo.version}']], extensions: [], userRemoteConfigs: [[url: 'https://nowhere.net/']]])");
if (r.jenkins.get().getPlugin("git").getWrapper().getVersion().startsWith("4.")) {
Copy link
Member

Choose a reason for hiding this comment

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

OK for now (a cleanup PR in a few weeks would be appreciated) though in general we prefer to avoid this kind of switch—rather just update the test dependency to the newer version. If you have not released that version yet, file a draft PR with an incremental version so it is ready to go and be included in an omnibus bom PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

@jglick jglick merged commit b5627be into jenkinsci:master Dec 21, 2022
@MarkEWaite MarkEWaite deleted the prep-for-git-plugin-5.0 branch December 21, 2022 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants