Skip to content

Commit

Permalink
Merge pull request #341 from timja/jep-229
Browse files Browse the repository at this point in the history
Handle new JEP-229 versioning
  • Loading branch information
imonteroperez authored Jan 28, 2022
2 parents 8e47233 + b6f2b4b commit d941f08
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public class PluginCompatTester {
private static final String DEFAULT_SOURCE_ID = "default";

/** First version with new parent POM. */
public static final String JENKINS_CORE_FILE_REGEX = "WEB-INF/lib/jenkins-core-([0-9.]+(?:-[0-9a-f.]+)*(?:-(?i)([a-z]+)(-)?([0-9a-f.]+)?)?(?:-(?i)([a-z]+)(-)?([0-9a-f.]+)?)?(?:-SNAPSHOT)?)[.]jar";
public static final String JENKINS_CORE_FILE_REGEX = "WEB-INF/lib/jenkins-core-([0-9.]+(?:-[0-9a-f.]+)*(?:-(?i)([a-z]+)(-)?([0-9a-f.]+)?)?(?:-(?i)([a-z]+)(-)?([0-9a-f_.]+)?)?(?:-SNAPSHOT)?)[.]jar";

private PluginCompatTesterConfig config;
private final ExternalMavenRunner runner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
*/
package org.jenkins.tools.test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -409,6 +411,15 @@ public void testCustomWarPackagerVersions() {
assertTrue("No matches", m.matches());
}

@Test
@Issue("340")
public void testJEP229WithUnderscore() {
String fileName = "WEB-INF/lib/jenkins-core-2.329-rc31964.3b_29e9d46_038_.jar";
Matcher m = Pattern.compile(PluginCompatTester.JENKINS_CORE_FILE_REGEX).matcher(fileName);
assertThat("No matches", m.matches(), is(true));
assertThat("Invalid group", m.group(1), is("2.329-rc31964.3b_29e9d46_038_"));
}

private static File getSettingsFile() throws IOException {
// Check whether we run in ci.jenkins.io with Azure settings
File ciJenkinsIOSettings = new File(new File("settings-azure.xml").getAbsolutePath()
Expand Down

0 comments on commit d941f08

Please sign in to comment.