Skip to content

Commit

Permalink
Merge pull request #97 from egineering-llc/release/2.1.0
Browse files Browse the repository at this point in the history
Release/2.1.0
  • Loading branch information
bvarner committed Aug 30, 2018
2 parents cf96b50 + 62683b0 commit ec90523
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
12 changes: 8 additions & 4 deletions README.md
Expand Up @@ -256,11 +256,15 @@ Can be replaced with the following plugin configuration, which also introduces t

In addition to setting up repository targets for release branches, the `retarget-depoy` branch can deploy other branches
matching the `otherDeploymentBranchPattern` as -SNAPSHOT artifacts which include the branch name as build metadata.
This is loosely based on the [semVer](https://semver.org) semantic version scheme, in that the plugin will reversion any
artifacts to be produced with `+feature-branch-name-normalized-SNAPSHOT` where any characters not in `[0-9A-Za-z-.]` will
be replaced with `-`. Artifact versions for feature branches will _always_ be -SNAPSHOT, and will _always_ target the
By default this is loosely based on the [semVer](https://semver.org) semantic version scheme, in that the plugin will
reversion any artifacts to be produced with `+feature-branch-name-normalized-SNAPSHOT` where any characters not in
`[0-9A-Za-z-.]` will be replaced with `-`. In cases where the `+` delimiter is problematic, you can override that default
by specifying `<otherBranchVersionDelimiter>` in your configuration block.

Using this feature, artifact versions for feature branches will _always_ be -SNAPSHOT, and will _always_ target the
Snapshots repository. The intent for this configuration setting is to provide a way for long-running branches (matching
a naming convention you define) can be published to a SNAPSHOT repo for use by other projects.
a naming convention you define) can be published to a SNAPSHOT repo for use by other projects, and to prevent feature
branches forked from release branches from mangling the test release in an artifact repository.

## Goal: `update-stage-dependencies` (Force update of dependency staged Releases)

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -8,7 +8,7 @@

<groupId>com.e-gineering</groupId>
<artifactId>gitflow-helper-maven-plugin</artifactId>
<version>2.0.0</version>
<version>2.1.0</version>

<packaging>maven-plugin</packaging>

Expand Down
Expand Up @@ -87,6 +87,9 @@ private static PrintWriter newPrintWriter(File catalog) throws FileNotFoundExcep
@Parameter(property = "otherDeployBranchPattern", required = false)
String otherDeployBranchPattern;

@Parameter(defaultValue = "+", required = true)
String otherBranchVersionDelimiter;

@Component
private EnhancedLocalRepositoryManagerFactory localRepositoryManagerFactory;

Expand Down
Expand Up @@ -47,7 +47,7 @@ protected void execute(final GitBranchInfo gitBranchInfo) throws MojoExecutionEx
updateArtifactVersion(a, gitBranchInfo.getName());
}

getLog().info("Artifact versions updated with semVer build metadata: " + getAsBranchSnapshotVersion("", gitBranchInfo.getName()));
getLog().info("Artifact versions updated with build metadata: " + getAsBranchSnapshotVersion("", gitBranchInfo.getName()));
break;
}
}
Expand Down Expand Up @@ -84,8 +84,7 @@ private void updateArtifactVersion(Artifact a, String branchName) {
* @return A mangled version string with the branchname and -SNAPSHOT.
*/
private String getAsBranchSnapshotVersion(final String version, final String branchName) {
return version.replace("-SNAPSHOT", "") + "+" + branchName.replaceAll("[^0-9A-Za-z-.]", "-") + "-SNAPSHOT";

return version.replace("-SNAPSHOT", "") + otherBranchVersionDelimiter + branchName.replaceAll("[^0-9A-Za-z-.]", "-") + "-SNAPSHOT";
}

private void setTargetSnapshots() throws MojoExecutionException, MojoFailureException {
Expand Down
Expand Up @@ -15,7 +15,7 @@ public void featureSnapshotSemVer() throws Exception {
try {
verifier.executeGoal("deploy");

verifier.verifyTextInLog("Artifact versions updated with semVer build metadata: +origin-feature-poc-my-feature-branch-SNAPSHOT");
verifier.verifyTextInLog("Artifact versions updated with build metadata: +origin-feature-poc-my-feature-branch-SNAPSHOT");
verifier.verifyErrorFreeLog();
} finally {
verifier.resetStreams();
Expand All @@ -28,7 +28,7 @@ public void featureSemVer() throws Exception {
try {
verifier.executeGoal("deploy");

verifier.verifyTextInLog("Artifact versions updated with semVer build metadata: +origin-feature-poc-my-feature-branch.with.other.identifiers-SNAPSHOT");
verifier.verifyTextInLog("Artifact versions updated with build metadata: +origin-feature-poc-my-feature-branch.with.other.identifiers-SNAPSHOT");
verifier.verifyErrorFreeLog();
} finally {
verifier.resetStreams();
Expand All @@ -55,19 +55,21 @@ public void automagicVersionDependenciesResolve() throws Exception {
try {
verifier.executeGoal("deploy");

verifier.verifyTextInLog("Artifact versions updated with semVer build metadata: +origin-feature-poc-long-running-SNAPSHOT");
verifier.verifyTextInLog("Artifact versions updated with build metadata: +origin-feature-poc-long-running-SNAPSHOT");
verifier.verifyErrorFreeLog();
} finally {
verifier.resetStreams();
}

// Create a -SNAPSHOT of the project-alt1-stub that depends upon the other project's automagic version.
// The alt project defines a `-` as the otherBranchVersionDelimiter.
verifier = createVerifier("/project-alt1-stub", "origin/feature/poc/long-running", "2.0.0");
try {
verifier.getCliOptions().add("-Ddependency.stub.version=2.0.0+origin-feature-poc-long-running-SNAPSHOT");
verifier.getCliOptions().add("-Dplugin.stub.version=2.0.0+origin-feature-poc-long-running-SNAPSHOT");

verifier.executeGoal("deploy");
verifier.verifyTextInLog("Artifact versions updated with build metadata: -origin-feature-poc-long-running-SNAPSHOT");
verifier.verifyErrorFreeLog();
} finally {
verifier.resetStreams();
Expand All @@ -80,7 +82,7 @@ public void attachDeployed() throws Exception {
try {
verifier.executeGoal("deploy");

verifier.verifyTextInLog("Artifact versions updated with semVer build metadata: +origin-feature-poc-reattach-SNAPSHOT");
verifier.verifyTextInLog("Artifact versions updated with build metadata: +origin-feature-poc-reattach-SNAPSHOT");
verifier.verifyErrorFreeLog();
} finally {
verifier.resetStreams();
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/project-alt1-stub/pom.xml
Expand Up @@ -57,6 +57,7 @@
<foo>bar</foo>
</releaseBranchProperties>
<otherDeployBranchPattern>(origin/)?feature/poc/.*</otherDeployBranchPattern>
<otherBranchVersionDelimiter>-</otherBranchVersionDelimiter>
</configuration>
<executions>
<execution>
Expand Down

0 comments on commit ec90523

Please sign in to comment.