You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2018/03/15 01:15:48 UTC

[isis] 03/05: ISIS-1916: adds support to setup within gitlab CI

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch maint-1.16.2
in repository https://gitbox.apache.org/repos/asf/isis.git

commit c9f563e9515648d1257fb730fe48bdae089abad0
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Thu Mar 15 00:02:38 2018 +0000

    ISIS-1916: adds support to setup within gitlab CI
---
 example/application/simpleapp/.gitignore           |   2 +
 example/application/simpleapp/.gitlab-ci.yml       |  49 ++++++++
 example/application/simpleapp/.m2/settings.xml     |  15 +++
 example/application/simpleapp/application/pom.xml  |   2 +-
 .../application/simpleapp/module-simple/pom.xml    |   3 +-
 example/application/simpleapp/pom.xml              | 129 +++++++++------------
 example/application/simpleapp/webapp/pom.xml       | 111 +++++++++---------
 7 files changed, 176 insertions(+), 135 deletions(-)

diff --git a/example/application/simpleapp/.gitignore b/example/application/simpleapp/.gitignore
index e859485..371262a 100644
--- a/example/application/simpleapp/.gitignore
+++ b/example/application/simpleapp/.gitignore
@@ -39,3 +39,5 @@ pom.xml.versionsBackup
 
 rebel.xml
 translations.pot
+
+.flattened-pom.xml
\ No newline at end of file
diff --git a/example/application/simpleapp/.gitlab-ci.yml b/example/application/simpleapp/.gitlab-ci.yml
new file mode 100644
index 0000000..f7519b1
--- /dev/null
+++ b/example/application/simpleapp/.gitlab-ci.yml
@@ -0,0 +1,49 @@
+#
+# requires the following gitlab secret variables
+# - DOCKER_HUB_USERNAME
+# - DOCKER_HUB_PASSWORD
+# - DOCKER_HUB_EMAIL
+#
+
+image: maven:3.5.3-jdk-8
+
+before_script:
+  - export REVISION=$(date +%Y%m%d.%H%M).$CI_COMMIT_REF_SLUG.$(echo $CI_COMMIT_SHA | cut -c1-7)
+
+services:
+  - docker:dind
+
+variables:
+  DOCKER_HOST: tcp://docker:2375
+  DOCKER_DRIVER: overlay2
+  MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode"
+  MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository -Dskip.cloudbees-estatio-repositories -Dskip.sonatype-snapshots -Dskip.apache-snapshots"
+  APP_NAME: "isis-demoapp-simpleapp"
+  DOCKER_REGISTRY_ID: "docker-hub"
+  DOCKER_REGISTRY_URL: "https://index.docker.io/v1/"
+
+stages:
+  - build-package-push
+
+build-package-push:
+  stage: build-package-push
+  script:
+    - echo "REVISION=$REVISION"
+    - >
+      mvn $MAVEN_CLI_OPTS \
+          clean install \
+          -Drevision=$REVISION \
+          -Dmavenmixin-docker \
+          -Ddocker-plugin.imageName=$DOCKER_HUB_USERNAME/$APP_NAME
+    - >
+      mvn $MAVEN_CLI_OPTS \
+          docker:push@push-image-tagged \
+          -pl webapp \
+          -Drevision=$REVISION \
+          -DskipTests \
+          -Dskip.isis-swagger \
+          -Dmavenmixin-docker \
+          -Ddocker-plugin.imageName=$DOCKER_HUB_USERNAME/$APP_NAME \
+          -Ddocker-plugin.serverId=$DOCKER_REGISTRY_ID \
+          -Ddocker.registryUrl=$DOCKER_REGISTRY_URL
+
diff --git a/example/application/simpleapp/.m2/settings.xml b/example/application/simpleapp/.m2/settings.xml
new file mode 100644
index 0000000..aa4567d
--- /dev/null
+++ b/example/application/simpleapp/.m2/settings.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+  <servers>
+    <server>
+      <id>${env.DOCKER_REGISTRY_ID}</id>
+      <username>${env.DOCKER_HUB_USERNAME}</username>
+      <password>${env.DOCKER_HUB_PASSWORD}</password>
+      <configuration>
+        <email>${env.DOCKER_HUB_EMAIL}</email>
+      </configuration>
+    </server>
+  </servers>
+</settings>
diff --git a/example/application/simpleapp/application/pom.xml b/example/application/simpleapp/application/pom.xml
index 1447252..46d779d 100644
--- a/example/application/simpleapp/application/pom.xml
+++ b/example/application/simpleapp/application/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.isis.example.application</groupId>
         <artifactId>simpleapp</artifactId>
-        <version>1.16.3-SNAPSHOT</version>
+        <version>${revision}</version>
     </parent>
 
     <artifactId>simpleapp-application</artifactId>
diff --git a/example/application/simpleapp/module-simple/pom.xml b/example/application/simpleapp/module-simple/pom.xml
index 80d0d46..a1bac12 100644
--- a/example/application/simpleapp/module-simple/pom.xml
+++ b/example/application/simpleapp/module-simple/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.isis.example.application</groupId>
         <artifactId>simpleapp</artifactId>
-        <version>1.16.3-SNAPSHOT</version>
+        <version>${revision}</version>
     </parent>
 
     <artifactId>simpleapp-module-simple</artifactId>
@@ -167,7 +167,6 @@
             <artifactId>hsqldb</artifactId>
             <scope>test</scope>
         </dependency>
-
     </dependencies>
 
 </project>
diff --git a/example/application/simpleapp/pom.xml b/example/application/simpleapp/pom.xml
index 66887e2..6fd5791 100644
--- a/example/application/simpleapp/pom.xml
+++ b/example/application/simpleapp/pom.xml
@@ -24,21 +24,23 @@
     <parent>
         <groupId>org.incode</groupId>
         <artifactId>incode-build</artifactId>
-        <version>2</version>
+        <version>2.3</version>
     </parent>
 
     <groupId>org.apache.isis.example.application</groupId>
     <artifactId>simpleapp</artifactId>
-    <version>1.16.3-SNAPSHOT</version>
+    <version>${revision}</version>
 
     <name>SimpleApp Parent</name>
 
     <packaging>pom</packaging>
 
     <properties>
-        <isis.version>1.16.3-SNAPSHOT</isis.version>
+        <revision>1.0.0-SNAPSHOT</revision>
+	
+        <isis.version>1.16.2</isis.version>
 
-        <lombok.version>1.16.18</lombok.version>
+        <lombok.version>1.16.20</lombok.version>
 
         <compiler-plugin.source>1.8</compiler-plugin.source>
         <compiler-plugin.target>1.8</compiler-plugin.target>
@@ -64,66 +66,33 @@
                     </mixins>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>flatten-maven-plugin</artifactId>
+                <version>1.0.0</version>
+                <configuration>
+                    <updatePomFile>true</updatePomFile>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>flatten</id>
+                        <phase>process-resources</phase>
+                        <goals>
+                            <goal>flatten</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>flatten.clean</id>
+                        <phase>clean</phase>
+                        <goals>
+                            <goal>clean</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 
-    <repositories>
-        <repository>
-            <id>apache.snapshots</id>
-            <name>Apache Snapshots</name>
-            <url>https://repository.apache.org/content/repositories/snapshots/</url>
-            <releases>
-                <enabled>false</enabled>
-            </releases>
-            <snapshots>
-                <enabled>true</enabled>
-            </snapshots>
-        </repository>
-        <repository>
-            <id>cloudbees.estatio.snapshots</id>
-            <url>http://repository-estatio.forge.cloudbees.com/snapshot/</url>
-            <name>CloudBees Snapshots (and Interim Releases)</name>
-            <releases>
-                <enabled>true</enabled>
-                <updatePolicy>never</updatePolicy>
-                <checksumPolicy>fail</checksumPolicy>
-            </releases>
-            <snapshots>
-                <enabled>true</enabled>
-                <updatePolicy>never</updatePolicy>
-                <checksumPolicy>fail</checksumPolicy>
-            </snapshots>
-            <layout>default</layout>
-        </repository>
-        <repository>
-            <id>sonatype-snapshots</id>
-            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
-            <snapshots>
-                <enabled>true</enabled>
-            </snapshots>
-        </repository>
-    </repositories>
-
-    <pluginRepositories>
-        <pluginRepository>
-            <id>cloudbees.estatio.snapshots</id>
-            <name>CloudBees Snapshots (and Interim Releases)</name>
-            <releases>
-                <enabled>true</enabled>
-                <updatePolicy>never</updatePolicy>
-                <checksumPolicy>fail</checksumPolicy>
-            </releases>
-            <url>http://repository-estatio.forge.cloudbees.com/snapshot/</url>
-            <layout>default</layout>
-        </pluginRepository>
-    </pluginRepositories>
-
-    <modules>
-        <module>module-simple</module>
-        <module>application</module>
-        <module>webapp</module>
-    </modules>
-
     <dependencyManagement>
         <dependencies>
 
@@ -139,23 +108,23 @@
             <dependency>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>simpleapp-module-simple</artifactId>
-                <version>${project.version}</version>
+                <version>${revision}</version>
             </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>simpleapp-module-simple</artifactId>
-                <version>${project.version}</version>
+                <version>${revision}</version>
                 <type>test-jar</type>
             </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>simpleapp-application</artifactId>
-                <version>${project.version}</version>
+                <version>${revision}</version>
             </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>simpleapp-webapp</artifactId>
-                <version>${project.version}</version>
+                <version>${revision}</version>
             </dependency>
 
             <!-- lombok -->
@@ -177,6 +146,12 @@
         </dependency>
     </dependencies>
 
+    <modules>
+        <module>module-simple</module>
+        <module>application</module>
+        <module>webapp</module>
+    </modules>
+
     <profiles>
         <profile>
             <id>m2e</id>
@@ -187,18 +162,18 @@
             </activation>
             <build>
                 <directory>target-ide</directory>
-		        <plugins>
-		        	<!-- eclipse doesn't seem to support maven mixins config, so repeat here -->
-					<plugin>
-						<artifactId>maven-compiler-plugin</artifactId>
-						<configuration>
-							<source>${compiler-plugin.source}</source>
-							<target>${compiler-plugin.target}</target>
-							<compilerArgument />
-						</configuration>
-					</plugin>
-		        </plugins>
-		    </build>
+                <plugins>
+                    <!-- eclipse doesn't seem to support maven mixins config, so repeat here -->
+                    <plugin>
+                        <artifactId>maven-compiler-plugin</artifactId>
+                        <configuration>
+                            <source>${compiler-plugin.source}</source>
+                            <target>${compiler-plugin.target}</target>
+                            <compilerArgument>${compiler-plugin.compilerArgument}</compilerArgument>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
         </profile>
     </profiles>
 
diff --git a/example/application/simpleapp/webapp/pom.xml b/example/application/simpleapp/webapp/pom.xml
index ac32730..3731f8b 100644
--- a/example/application/simpleapp/webapp/pom.xml
+++ b/example/application/simpleapp/webapp/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.isis.example.application</groupId>
         <artifactId>simpleapp</artifactId>
-        <version>1.16.3-SNAPSHOT</version>
+        <version>${revision}</version>
     </parent>
 
     <artifactId>simpleapp-webapp</artifactId>
@@ -45,13 +45,11 @@
         <maven-war-plugin.warName>${project.parent.artifactId}</maven-war-plugin.warName>
 
         <docker-plugin.imageName>DOCKER_REGISTRY_ACCOUNT/${project.parent.artifactId}</docker-plugin.imageName>
+        <docker-plugin.imageTag>${project.version}</docker-plugin.imageTag>
         <docker-plugin.resource.include>${maven-war-plugin.warName}.war</docker-plugin.resource.include>
 
-        <docker-plugin.releaseServerId>docker-hub</docker-plugin.releaseServerId>
-        <docker-plugin.releaseRegistryUrl>https://index.docker.io/v1/</docker-plugin.releaseRegistryUrl>
-        <docker-plugin.snapshotServerId>docker-hub</docker-plugin.snapshotServerId>
-        <docker-plugin.snapshotRegistryUrl>https://index.docker.io/v1/</docker-plugin.snapshotRegistryUrl>
-
+        <docker-plugin.serverId>docker-hub</docker-plugin.serverId>
+        <docker-plugin.registryUrl>https://index.docker.io/v1/</docker-plugin.registryUrl>
     </properties>
 
     <build>
@@ -102,41 +100,6 @@
                     </mixins>
                 </configuration>
             </plugin>
-            <plugin>
-                <groupId>org.apache.isis.tool</groupId>
-                <artifactId>isis-maven-plugin</artifactId>
-                <version>${isis.version}</version>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>swagger</goal>
-                        </goals>
-                        <configuration>
-                            <appManifest>${isis-maven-plugin.appManifest}</appManifest>
-                            <visibilities>
-                                <visibility>PUBLIC</visibility>
-                                <visibility>PRIVATE</visibility>
-                            </visibilities>
-                            <format>JSON</format>
-                            <fileNamePrefix>swagger</fileNamePrefix>
-                        </configuration>
-                    </execution>
-                </executions>
-                <dependencies>
-                    <dependency>
-                        <groupId>${project.groupId}</groupId>
-                        <artifactId>${project.parent.artifactId}-application</artifactId>
-                        <version>${project.version}</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.hsqldb</groupId>
-                        <artifactId>hsqldb</artifactId>
-                        <version>2.3.1</version>
-                    </dependency>
-                    <!-- workaround to avoid conflict with plexus-default -->
-                </dependencies>
-            </plugin>
         </plugins>
     </build>
 
@@ -159,6 +122,53 @@
 
     <profiles>
         <profile>
+            <id>isis-swagger</id>
+            <activation>
+                <property>
+                    <name>!skip.isis-swagger</name>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.isis.tool</groupId>
+                        <artifactId>isis-maven-plugin</artifactId>
+                        <version>${isis.version}</version>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>swagger</goal>
+                                </goals>
+                                <configuration>
+                                    <appManifest>${isis-maven-plugin.appManifest}</appManifest>
+                                    <visibilities>
+                                        <visibility>PUBLIC</visibility>
+                                        <visibility>PRIVATE</visibility>
+                                    </visibilities>
+                                    <format>JSON</format>
+                                    <fileNamePrefix>swagger</fileNamePrefix>
+                                </configuration>
+                            </execution>
+                        </executions>
+                        <dependencies>
+                            <dependency>
+                                <groupId>${project.groupId}</groupId>
+                                <artifactId>${project.parent.artifactId}-application</artifactId>
+                                <version>${project.version}</version>
+                            </dependency>
+                            <dependency>
+                                <groupId>org.hsqldb</groupId>
+                                <artifactId>hsqldb</artifactId>
+                                <version>2.3.1</version>
+                            </dependency>
+                            <!-- workaround to avoid conflict with plexus-default -->
+                        </dependencies>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
             <id>jdbc-hsqldb</id>
             <activation>
                 <property>
@@ -176,7 +186,7 @@
             <id>jdbc-logging</id>
             <activation>
                 <property>
-                    <name>!skip.jdbc-logging</name>
+                    <name>jdbc-logging</name>
                 </property>
             </activation>
             <dependencies>
@@ -196,7 +206,7 @@
             <id>jdbc-postgres</id>
             <activation>
                 <property>
-                    <name>!skip.jdbc-postgres</name>
+                    <name>jdbc-postgres</name>
                 </property>
             </activation>
             <dependencies>
@@ -207,30 +217,21 @@
                 </dependency>
             </dependencies>
         </profile>
-        <!--
         <profile>
             <id>jdbc-mssql</id>
             <activation>
                 <property>
-                    <name>!skip.jdbc-mssql</name>
+                    <name>jdbc-mssql</name>
                 </property>
             </activation>
-
-            mvn install:install-file -Dfile=sqljdbc4.jar \
-                                     -DgroupId=com.microsoft.sqlserver \
-                                     -DartifactId=jdbc \
-                                     -Dversion=4.0 \
-                                     -Dpackaging=jar
-
             <dependencies>
                <dependency>
                    <groupId>com.microsoft.sqlserver</groupId>
-                   <artifactId>sqljdbc4</artifactId>
-                   <version>4.0</version>
+                   <artifactId>mssql-jdbc</artifactId>
+                   <version>6.4.0.jre8</version>
                </dependency>
             </dependencies>
         </profile>
-        -->
     </profiles>
 
 </project>

-- 
To stop receiving notification emails like this one, please contact
danhaywood@apache.org.