Loading .gitignore +2 −1 Original line number Diff line number Diff line Loading @@ -4,3 +4,4 @@ dependency-reduced-pom.xml .classpath .settings bin .vscode No newline at end of file .gitlab-ci.yml +4 −0 Original line number Diff line number Diff line cache: paths: - .m2/repository stages: - build - deploy Loading pom.xml +6 −6 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>fr.mines-stetienne.ci.saref</groupId> <artifactId>saref-pipeline</artifactId> <version>1.0</version> <version>1.0.1</version> <packaging>jar</packaging> <name>SAREF-Pipeline</name> Loading Loading @@ -45,7 +45,7 @@ </license> </licenses> <repositories> <!-- <repositories> <repository> <id>gitlab-maven</id> <url>${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven</url> Loading @@ -61,13 +61,13 @@ <id>gitlab-maven</id> <url>${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven</url> </repository> </distributionManagement> </distributionManagement> --> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format> <jdk.version>1.8</jdk.version> <jdk.version>11</jdk.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.scm.id>git</project.scm.id> Loading src/main/java/fr/mines_stetienne/ci/saref/managers/RepositoryFactory.java +23 −23 Original line number Diff line number Diff line Loading @@ -69,12 +69,10 @@ public class RepositoryFactory extends SAREFErrorLogger { target_name, develop_branch, not_clean, release_branch, release_git, source_name; } public static final String REGEX_REMOTELOCAL_BRANCH_VAR = "remotelocal"; public static final String REGEX_VERSION_BRANCH_VAR = "type"; public static final String REGEX_VERSION_BRANCH = String.format( "^(refs/heads/)?(?<%s>(develop|prerelease|release))-%s$", REGEX_VERSION_BRANCH_VAR, SAREF.REGEX_VERSION_NUMBER); public static final String REGEX_ORIGIN_VERSION_BRANCH = String.format( "^refs/remotes/origin/(?<%s>(develop|prerelease|release))-%s$", REGEX_VERSION_BRANCH_VAR, "^(refs/?(?<%s>(heads|remotes/origin)/))?(?<%s>(develop|prerelease|release))-%s$", REGEX_REMOTELOCAL_BRANCH_VAR, REGEX_VERSION_BRANCH_VAR, SAREF.REGEX_VERSION_NUMBER); private final boolean isTarget; Loading Loading @@ -193,17 +191,13 @@ public class RepositoryFactory extends SAREFErrorLogger { private void readVersions(Git git, SAREFRepository repository) throws GitAPIException { final List<Ref> allBranches; final Pattern pattern; if (isTarget) { allBranches = git.branchList().call(); pattern = Pattern.compile(REGEX_VERSION_BRANCH); } else { allBranches = git.branchList().setListMode(ListMode.REMOTE).call(); pattern = Pattern.compile(REGEX_ORIGIN_VERSION_BRANCH); } pattern = Pattern.compile(REGEX_VERSION_BRANCH); Map<SAREFVersionName, VersionBuilder> versionBuilders = new HashMap<>(); for (Ref ref : allBranches) { Matcher m = pattern.matcher(ref.getName()); if (m.find()) { String remotelocalType = m.group(REGEX_REMOTELOCAL_BRANCH_VAR); String branchType = m.group(REGEX_VERSION_BRANCH_VAR); // only consider release branches when running in RELEASE_PORTAL mode Loading @@ -228,13 +222,19 @@ public class RepositoryFactory extends SAREFErrorLogger { } switch (branchType) { case "develop": if(versionBuilder.developRef == null || remotelocalType.equals("heads")) { versionBuilder.developRef = ref; } break; case "prerelease": if(versionBuilder.developRef == null || remotelocalType.equals("heads")) { versionBuilder.prereleaseRef = ref; } break; case "release": if(versionBuilder.releaseRef == null || remotelocalType.equals("heads")) { versionBuilder.releaseRef = ref; } break; default: throw new NullPointerException("Should not reach this point"); Loading Loading
.gitignore +2 −1 Original line number Diff line number Diff line Loading @@ -4,3 +4,4 @@ dependency-reduced-pom.xml .classpath .settings bin .vscode No newline at end of file
.gitlab-ci.yml +4 −0 Original line number Diff line number Diff line cache: paths: - .m2/repository stages: - build - deploy Loading
pom.xml +6 −6 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>fr.mines-stetienne.ci.saref</groupId> <artifactId>saref-pipeline</artifactId> <version>1.0</version> <version>1.0.1</version> <packaging>jar</packaging> <name>SAREF-Pipeline</name> Loading Loading @@ -45,7 +45,7 @@ </license> </licenses> <repositories> <!-- <repositories> <repository> <id>gitlab-maven</id> <url>${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven</url> Loading @@ -61,13 +61,13 @@ <id>gitlab-maven</id> <url>${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven</url> </repository> </distributionManagement> </distributionManagement> --> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format> <jdk.version>1.8</jdk.version> <jdk.version>11</jdk.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.scm.id>git</project.scm.id> Loading
src/main/java/fr/mines_stetienne/ci/saref/managers/RepositoryFactory.java +23 −23 Original line number Diff line number Diff line Loading @@ -69,12 +69,10 @@ public class RepositoryFactory extends SAREFErrorLogger { target_name, develop_branch, not_clean, release_branch, release_git, source_name; } public static final String REGEX_REMOTELOCAL_BRANCH_VAR = "remotelocal"; public static final String REGEX_VERSION_BRANCH_VAR = "type"; public static final String REGEX_VERSION_BRANCH = String.format( "^(refs/heads/)?(?<%s>(develop|prerelease|release))-%s$", REGEX_VERSION_BRANCH_VAR, SAREF.REGEX_VERSION_NUMBER); public static final String REGEX_ORIGIN_VERSION_BRANCH = String.format( "^refs/remotes/origin/(?<%s>(develop|prerelease|release))-%s$", REGEX_VERSION_BRANCH_VAR, "^(refs/?(?<%s>(heads|remotes/origin)/))?(?<%s>(develop|prerelease|release))-%s$", REGEX_REMOTELOCAL_BRANCH_VAR, REGEX_VERSION_BRANCH_VAR, SAREF.REGEX_VERSION_NUMBER); private final boolean isTarget; Loading Loading @@ -193,17 +191,13 @@ public class RepositoryFactory extends SAREFErrorLogger { private void readVersions(Git git, SAREFRepository repository) throws GitAPIException { final List<Ref> allBranches; final Pattern pattern; if (isTarget) { allBranches = git.branchList().call(); pattern = Pattern.compile(REGEX_VERSION_BRANCH); } else { allBranches = git.branchList().setListMode(ListMode.REMOTE).call(); pattern = Pattern.compile(REGEX_ORIGIN_VERSION_BRANCH); } pattern = Pattern.compile(REGEX_VERSION_BRANCH); Map<SAREFVersionName, VersionBuilder> versionBuilders = new HashMap<>(); for (Ref ref : allBranches) { Matcher m = pattern.matcher(ref.getName()); if (m.find()) { String remotelocalType = m.group(REGEX_REMOTELOCAL_BRANCH_VAR); String branchType = m.group(REGEX_VERSION_BRANCH_VAR); // only consider release branches when running in RELEASE_PORTAL mode Loading @@ -228,13 +222,19 @@ public class RepositoryFactory extends SAREFErrorLogger { } switch (branchType) { case "develop": if(versionBuilder.developRef == null || remotelocalType.equals("heads")) { versionBuilder.developRef = ref; } break; case "prerelease": if(versionBuilder.developRef == null || remotelocalType.equals("heads")) { versionBuilder.prereleaseRef = ref; } break; case "release": if(versionBuilder.releaseRef == null || remotelocalType.equals("heads")) { versionBuilder.releaseRef = ref; } break; default: throw new NullPointerException("Should not reach this point"); Loading