jenkinsci / plugin-compat-tester

Jenkins Plugin Compatibility Tester
MIT License
46 stars 55 forks source link

re-introduce check on tag alignment for a repository #530

Closed jtnord closed 1 year ago

jtnord commented 1 year ago

In the multimodule branch there was a check to ensure that all plugins from a given repository use the same tag, but this was not carried over in #510

This PR changes the assumption that the input is correct (which would silently provide incorrect results), to an explicit check that fails early before starting to check compatibility.

Only plugins that are being checked for compatibility will be involved in the repository. This is to allows a war to contain a plugin that was formerly in the repository that has been changed to just migrate data to a new location (by adding a dependency on a replacement plugin) to still be in the war, even after it has been deleted from the repository.

Tested manually with a war that contained unaligned version of plugins from the aws-java-sdk-plugin repository

...
2023-04-19 15:00:30.920+0000 [id=1]     INFO    o.j.tools.test.util.WarExtractor#getPlugin: Extracting metadata for workflow-support
java.lang.IllegalArgumentException: Repository https://github.com/jenkinsci/aws-java-sdk-plugin.git present with multiple tags: da68e200723379de6156c03d547c9c5d776c8887, 84eef68d11f4e3ffd93a01457d2dfa0c222b2d8e
        at org.jenkins.tools.test.PluginCompatTester.testPlugins(PluginCompatTester.java:115)
        at org.jenkins.tools.test.PluginCompatTesterCli.call(PluginCompatTesterCli.java:199)
        at org.jenkins.tools.test.PluginCompatTesterCli.call(PluginCompatTesterCli.java:1)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
        at picocli.CommandLine.access$1500(CommandLine.java:148)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
        at picocli.CommandLine.execute(CommandLine.java:2170)
        at org.jenkins.tools.test.CLI.main(CLI.java:13)