TINKERPOP-1897 Avoid pushing of Docker images for SNAPSHOT versions This also adds the minor version as an additional tag for Docker images when the version is not a SNAPSHOT version.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/3186829c Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/3186829c Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/3186829c Branch: refs/heads/TINKERPOP-1897 Commit: 3186829ca784acb6e167d269b7e60808a321e50b Parents: c3015db Author: Florian Hockmann <f...@florian-hockmann.de> Authored: Wed Mar 14 22:41:55 2018 +0100 Committer: Florian Hockmann <f...@florian-hockmann.de> Committed: Sat Apr 14 15:46:33 2018 +0200 ---------------------------------------------------------------------- gremlin-console/pom.xml | 61 +++++++++++++++++++++++++++++++++++++------- gremlin-server/pom.xml | 53 ++++++++++++++++++++++++++++++++++---- pom.xml | 5 ++++ 3 files changed, 105 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3186829c/gremlin-console/pom.xml ---------------------------------------------------------------------- diff --git a/gremlin-console/pom.xml b/gremlin-console/pom.xml index ac34e20..fb1c32b 100644 --- a/gremlin-console/pom.xml +++ b/gremlin-console/pom.xml @@ -348,23 +348,66 @@ limitations under the License. <build> <plugins> <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <!-- source: https://stackoverflow.com/a/39139979/6753576 --> + <!-- sets the only.when.is.snapshot.used property to true if SNAPSHOT was used, + to the project version otherwise --> + <id>build-helper-regex-is-snapshot-used</id> + <phase>validate</phase> + <goals> + <goal>regex-property</goal> + </goals> + <configuration> + <name>only.when.is.snapshot.used</name> + <value>${project.version}</value> + <regex>.*-SNAPSHOT</regex> + <replacement>true</replacement> + <failIfNoMatch>false</failIfNoMatch> + </configuration> + </execution> + </executions> + </plugin> + <plugin> <groupId>com.spotify</groupId> <artifactId>dockerfile-maven-plugin</artifactId> <executions> <execution> - <id>docker-image</id> - <goals> - <goal>build</goal> - <goal>push</goal> - </goals> + <id>docker-image-build</id> + <goals> + <goal>build</goal> + </goals> + <configuration> + <tag>${project.version}</tag> + <buildArgs> + <GREMLIN_CONSOLE_DIR>target/apache-tinkerpop-${project.artifactId}-${project.version}-standalone</GREMLIN_CONSOLE_DIR> + </buildArgs> + </configuration> + </execution> + <execution> + <id>docker-image-tag-minor-version</id> + <goals> + <goal>tag</goal> + </goals> + <configuration> + <tag>3.2</tag> + <skip>${only.when.is.snapshot.used}</skip> + </configuration> + </execution> + <execution> + <id>docker-image-push</id> + <goals> + <goal>push</goal> + </goals> + <configuration> + <skip>${only.when.is.snapshot.used}</skip> + </configuration> </execution> </executions> <configuration> <repository>tinkerpop/gremlin-console</repository> - <tag>${project.version}</tag> - <buildArgs> - <GREMLIN_CONSOLE_DIR>target/apache-tinkerpop-${project.artifactId}-${project.version}-standalone</GREMLIN_CONSOLE_DIR> - </buildArgs> </configuration> </plugin> </plugins> http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3186829c/gremlin-server/pom.xml ---------------------------------------------------------------------- diff --git a/gremlin-server/pom.xml b/gremlin-server/pom.xml index da007cf..2035210 100644 --- a/gremlin-server/pom.xml +++ b/gremlin-server/pom.xml @@ -256,23 +256,66 @@ limitations under the License. <build> <plugins> <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <!-- source: https://stackoverflow.com/a/39139979/6753576 --> + <!-- sets the only.when.is.snapshot.used property to true if SNAPSHOT was used, + to the project version otherwise --> + <id>build-helper-regex-is-snapshot-used</id> + <phase>validate</phase> + <goals> + <goal>regex-property</goal> + </goals> + <configuration> + <name>only.when.is.snapshot.used</name> + <value>${project.version}</value> + <regex>.*-SNAPSHOT</regex> + <replacement>true</replacement> + <failIfNoMatch>false</failIfNoMatch> + </configuration> + </execution> + </executions> + </plugin> + <plugin> <groupId>com.spotify</groupId> <artifactId>dockerfile-maven-plugin</artifactId> <executions> <execution> - <id>docker-image</id> + <id>docker-image-build</id> <goals> <goal>build</goal> + </goals> + <configuration> + <tag>${project.version}</tag> + <buildArgs> + <GREMLIN_SERVER_DIR>target/apache-tinkerpop-${project.artifactId}-${project.version}-standalone</GREMLIN_SERVER_DIR> + </buildArgs> + </configuration> + </execution> + <execution> + <id>docker-image-tag-minor-version</id> + <goals> + <goal>tag</goal> + </goals> + <configuration> + <tag>3.2</tag> + <skip>${only.when.is.snapshot.used}</skip> + </configuration> + </execution> + <execution> + <id>docker-image-push</id> + <goals> <goal>push</goal> </goals> + <configuration> + <skip>${only.when.is.snapshot.used}</skip> + </configuration> </execution> </executions> <configuration> <repository>tinkerpop/gremlin-server</repository> - <tag>${project.version}</tag> - <buildArgs> - <GREMLIN_SERVER_DIR>target/apache-tinkerpop-${project.artifactId}-${project.version}-standalone</GREMLIN_SERVER_DIR> - </buildArgs> </configuration> </plugin> </plugins> http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3186829c/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 8a94c45..14e7a42 100644 --- a/pom.xml +++ b/pom.xml @@ -496,6 +496,11 @@ limitations under the License. <artifactId>dockerfile-maven-plugin</artifactId> <version>1.3.7</version> </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>3.0.0</version> + </plugin> </plugins> </pluginManagement> </build>