Skip to content

Commit 3a3e33f

Browse files
authored
Merge pull request #86 from egineering-llc/release/1.8.0
Release/1.8.0
2 parents 2cff52b + 59a9f73 commit 3a3e33f

23 files changed

+1050
-282
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ script: mvn verify
44

55
jdk:
66
- openjdk7
7-
- oraclejdk7
87
- oraclejdk8
98

109
cache:

README.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ All of the solutions to these issues are implemented independently in different
124124
<hotfixBranchPropertyFile>foo/bar/emer.props</hotfixBranchPropertyFile>
125125
<releaseBranchPropertyFile>foo/bar/test.props</releaseBranchPropertyFile>
126126
<developmentBranchPropertyFile>foo/bar/dev.props</developmentBranchPropertyFile>
127+
<featureOrBugfixBranchPropertyFile>foo/bar/feat.props</featureOrBugfixBranchPropertyFile>
127128
<otherBranchPropertyFile>foo/bar/ci.props</otherBranchPropertyFile>
128129
<undefinedBranchPropertyFile>foo/bar/local.props</undefinedBranchPropertyFile>
129130
</configuration>
@@ -143,8 +144,8 @@ One common stumbling block for teams adjusting to gitflow with Maven projects is
143144
In practice, the Maven versions should:
144145

145146
* Be synchronized with release branch and hotfix branch names.
146-
* Never be -SNAPSHOT in the master, support, release, or hotfix branches.
147-
* Always be -SNAPSHOT in the develop branch.
147+
* Never be -SNAPSHOT in the master, support, release, or hotfix branches. Also, no -SNAPSHOT parent or (plugin) dependencies are allowed. (This condition may be disabled by setting `enforceNonSnapshots` = `false`.)
148+
* Always be -SNAPSHOT in the feature and develop branches.
148149
* Be irrelevant if there's no git branch resolvable from your environment.
149150

150151
The `enforce-versions` goal asserts these semantics when it can resolve the `gitBranchExpression`.
@@ -158,12 +159,17 @@ The following properties change the behavior of this goal:
158159
| Property | Default Value | SNAPSHOT allowed? | Description |
159160
| -------------------- | ------------- | --------------------------- | ----------- |
160161
| gitBranchExpression | current git branch resolved from SCM or ${env.GIT_BRANCH} | n/a | Maven property expression to resolve in order to determine the current git branch |
162+
| deploySnapshotTypeBranches | `false` | n/a | When `true`, the POM version should end with the feature branch name and -SNAPSHOT, e.g. `1.0.0-myfeature-SNAPSHOT`. This prevents a feature branch snapshot from "overwriting" a snapshot from the develop branch. |
163+
| enforceNonSnapshots | `true` | n/a | When `true`, enforce the requirement that none of the following may contain a -SNAPSHOT: the POM version, any parent, or any (plugin) dependencies. |
164+
| releaseBranchMatchType | `equals` | n/a | When `equals`, the POM version should be identical to the branch name for release and hotfix branches (e.g. POM version should be `1.0.0` for branch `release/1.0.0`). When `startsWith`, POM version should start with the name branch (e.g. POM version could be `1.0.1` for branch `release/1.0`. When using the `update-stage-dependencies` mojo, set to `equals`, otherwise set to `startsWith`. |
161165
| masterBranchPattern | (origin/)?master | No | Regex. When matched, signals the master branch is being built. |
162166
| supportBranchPattern | (origin/)?support/(.*) | No | Regex. When matches, signals a support branch (long term master-equivalent for older release) being built. Last subgroup, if present, must be start of the Maven project version. |
163167
| releaseBranchPattern | (origin/)?release/(.*) | No | Regex. When matched, signals a release branch being built. Last subgroup, if present, must match the Maven project version. |
164168
| hotfixBranchPattern | (origin/)?hotfix/(.*) | No | Regex. When matched, signals a hotfix branch is being built. Last subgroup, if present, must match the Maven project version. |
169+
| featureOrBugfixBranchPattern | (origin/)?(?:feature&#124;bugfix)/(.*) | Yes | Regex. When matched, signals a feature or bugfix branch is being built. |
165170
| developmentBranchPattern | (origin/)?develop | Yes | Regex. When matched, signals a development branch is being built. Note the lack of a subgroup. |
166171

172+
167173
## Goal: `retarget-deploy` (Branch Specific Deploy Targets & Staging)
168174

169175
One of the challenges of building a good CI/CD job for Maven environments is the lack of a 'staging' repository baked into Maven.
@@ -179,10 +185,12 @@ plugins in the build process (deploy, site-deploy, etc.) will use the repositori
179185
| Property | Default Value | Description |
180186
| -------- | ------------- | ----------- |
181187
| gitBranchExpression | current git branch resolved from SCM or ${env.GIT_BRANCH} | Maven property expression to resolve in order to determine the current git branch |
188+
| deploySnapshotTypeBranches | `false` | When `true`, feature branches will also be deployed to the snapshots repository. |
182189
| releaseDeploymentRepository | n/a | The repository to use for releases. (Builds with a GIT_BRANCH matching `masterBranchPattern` or `supportBranchPattern`) |
183190
| stageDeploymentRepository | n/a | The repository to use for staging. (Builds with a GIT_BRANCH matching `releaseBranchPattern` or `hotfixBranchPattern`) |
184191
| snapshotDeploymentRepository | n/a | The repository to use for snapshots. (Builds matching `developmentBranchPattern`) |
185192

193+
186194
**The repository properties should follow the following format**, `id::layout::url::uniqueVersion`.
187195

188196
When using this plugin, the `<distributionManagement>` repository definitions can be completely removed from your pom.xml
@@ -250,11 +258,11 @@ properties from files with an assigned keyPrefix, letting you name-space propert
250258
The maven `-U` command line switch does a fine job of updating SNAPSHOT versions from snapshot repositories, there is no
251259
built-in way to force maven to re-resolve non-snapshot release versions. This goal addresses that shortcoming in a fairly
252260
straight-forward manner. Any release version dependency of the project which was provided to the local repository by a
253-
remote repository with the same ID as the `<stageDeploymentRepository>`, will be purged from the local repository and
261+
remote repository with the same ID as the `<stageDeploymentRepository>`, will be purged from the local repository and
254262
re-resolved (so you get the latest version from either the stage repository, or your release repository).
255263

256-
It is **very important** if you're using this goal, that the **`stageDeploymentReposity` have a unique repository/server id**.
257-
If you use the same ID for release, snapshot, and stage, every time you exeucte this goal, every release version
264+
It is **very important** if you're using this goal, that the **`stageDeploymentReposity` have a unique repository/server id**.
265+
If you use the same ID for release, snapshot, and stage, every time you exeucte this goal, every release version
258266
dependency will be purged and re-resolved.
259267

260268
If you have a local build / install of a release version, this goal will currently not update that package, by design.
@@ -299,7 +307,7 @@ To accomplish this the `promote-master` goal and a Maven build extension work to
299307

300308
With the build extension added to your project, any build where the `gitBranchExpression` matches the `masterBranchPattern` or `supportBranchPattern` will have it's
301309
build lifecycle (plugins, goals, etc) altered. Any plugin other than the gitflow-helper-maven-plugin, the maven-deploy-plugin, or plugins with goals
302-
explicitly referenced on the command line will be ignored (removed from the project reactor).
310+
explicitly referenced on the command line will be ignored (removed from the project reactor).
303311
This allows us to enforce the ideal that code should never be built in the master branch.
304312

305313
The `promote-master` goal executes when the `gitBranchExpression` resolves to a value matching the `masterBranchPattern` or `supportBranchPattern` regular expression.
@@ -331,6 +339,7 @@ The following table describes the git branch expression -> repository used for r
331339
| supportBranchPattern | release |
332340
| releaseBranchPattern | stage |
333341
| hotfixBranchPattern | stage |
342+
| featureOrBugfixBranchPattern | snapshots |
334343
| developmentBranchPattern | snapshots |
335344
| All Others | local |
336345

@@ -352,3 +361,15 @@ it's building. The attach-deploy will 'clean' the maven project, then download t
352361
that the first build deployed into. Once they're attached to the project, the `jboss-as:deploy-only` goal will deliver
353362
the artifacts built by the first job into a jboss application server.
354363

364+
365+
# Resolving the Git branch name
366+
As stated before, the plugin determines what to do by resolving the Git branch name.
367+
368+
* The first try is a `git symbolic-ref HEAD` to check the local branch name. If it's found, that's the branch name that's used.
369+
* If the `symbolic-ref` fails then it's probably due to a detached HEAD. This typically happens on Jenkins, when it simply checks out the commit hash that was just pushed.
370+
Or, it's because of a developer doing a `git checkout origin/feature/x`, e.g. when doing a code review and no local branch is required.
371+
In such a case:
372+
* The plugin will first resolve the HEAD to a commit using `git rev-parse HEAD`.
373+
* Next, it will do a `git show-ref` to check which (local/remote) branches point to the commit.
374+
* If it can resolve the commit to a single branch type (e.g. develop or master) then that's the branch name that's used.
375+
* If all of the above fails, `${env.GIT_BRANCH}` is tried.

pom.xml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
<groupId>com.e-gineering</groupId>
1010
<artifactId>gitflow-helper-maven-plugin</artifactId>
11+
<version>1.8.0</version>
1112

12-
<version>1.7.2</version>
1313
<packaging>maven-plugin</packaging>
1414

1515
<name>gitflow-helper-maven-plugin</name>
@@ -49,6 +49,8 @@
4949
</scm>
5050

5151
<properties>
52+
<maven.compiler.source>1.7</maven.compiler.source>
53+
<maven.compiler.target>1.7</maven.compiler.target>
5254
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5355
</properties>
5456

@@ -126,7 +128,7 @@
126128
<plugin>
127129
<groupId>org.apache.maven.plugins</groupId>
128130
<artifactId>maven-plugin-plugin</artifactId>
129-
<version>3.2</version>
131+
<version>3.5.1</version>
130132
<configuration>
131133
<goalPrefix>gitflow-helper</goalPrefix>
132134
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
@@ -149,7 +151,7 @@
149151
<plugin>
150152
<groupId>org.codehaus.plexus</groupId>
151153
<artifactId>plexus-component-metadata</artifactId>
152-
<version>1.6</version>
154+
<version>1.7.1</version>
153155
<executions>
154156
<execution>
155157
<goals>
@@ -162,7 +164,7 @@
162164
<plugin>
163165
<groupId>org.apache.maven.plugins</groupId>
164166
<artifactId>maven-source-plugin</artifactId>
165-
<version>2.4</version>
167+
<version>3.0.1</version>
166168
<executions>
167169
<execution>
168170
<id>attach-sources</id>
@@ -187,7 +189,7 @@
187189
<plugin>
188190
<groupId>org.apache.maven.plugins</groupId>
189191
<artifactId>maven-gpg-plugin</artifactId>
190-
<version>1.5</version>
192+
<version>1.6</version>
191193
<executions>
192194
<execution>
193195
<id>sign-artifacts</id>
@@ -201,7 +203,7 @@
201203
<plugin>
202204
<groupId>org.sonatype.plugins</groupId>
203205
<artifactId>nexus-staging-maven-plugin</artifactId>
204-
<version>1.6.7</version>
206+
<version>1.6.8</version>
205207
<extensions>true</extensions>
206208
<configuration>
207209
<serverId>ossrh</serverId>

0 commit comments

Comments
 (0)