Initial attempt at codeship CI integration

This commit is contained in:
Stuart Douglas
2018-09-24 23:27:10 +10:00
parent 9fc0f9c408
commit 352a9f9ec6
11 changed files with 238 additions and 100 deletions

1
.dockerignore Normal file
View File

@@ -0,0 +1 @@
target

8
Dockerfile Normal file
View File

@@ -0,0 +1,8 @@
FROM swd847/centos-graal-maven
ENV DATABASE_URL=jdbc:postgresql:hibernate_orm_test
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
ENTRYPOINT ["mvn", "-Dno-postgres"]

17
codeship-services.yml Normal file
View File

@@ -0,0 +1,17 @@
shamrock:
build:
image: swd847/shamrock
dockerfile: Dockerfile
depends_on:
- postgres
environment:
- DATABASE_URL=jdbc:postgresql://postgres/hibernate_orm_test
# volumes:
# - /Users/stuart/.m2:/root/.m2
postgres:
image: healthcheck/postgres:alpine
environment:
POSTGRES_USER: hibernate_orm_test
POSTGRES_PASSWORD: hibernate_orm_test
POSTGRES_DB: hibernate_orm_test

3
codeship-steps.yml Normal file
View File

@@ -0,0 +1,3 @@
- name: ci
service: shamrock
command: install

View File

@@ -0,0 +1,13 @@
FROM swd847/centos-graal
ARG MAVEN_VERSION=3.3.9
ARG USER_HOME_DIR="/root"
RUN mkdir -p /usr/share/maven && \
curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar -xzC /usr/share/maven --strip-components=1 && \
ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
# speed up Maven JVM a bit
ENV MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
#ENTRYPOINT ["/usr/bin/mvn"]

View File

@@ -0,0 +1,21 @@
FROM centos:latest
ARG GRAAL_VERSION
ENV GRAAL_VERSION=${GRAAL_VERSION:-1.0.0-rc6}
ENV GRAAL_CE_URL=https://github.com/oracle/graal/releases/download/vm-${GRAAL_VERSION}/graalvm-ce-${GRAAL_VERSION}-linux-amd64.tar.gz
ENV JAVA_HOME=/opt/graalvm
ENV PATH=$PATH:$JAVA_HOME/bin
ENV GRAALVM_HOME=/opt/graalvm
RUN yum update -y && \
yum install -y tar gzip gcc glibc-devel zlib-devel curl && \
mkdir -p /opt/graalvm && \
cd /opt/graalvm && \
curl -fsSL $GRAAL_CE_URL | tar -xzC /opt/graalvm --strip-components=1

View File

@@ -48,6 +48,12 @@
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>${project.groupId}</groupId>
@@ -61,55 +67,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.26.1</version>
<configuration>
<images>
<image>
<name>postgres:10.5</name>
<alias>postgresql</alias>
<run>
<env>
<POSTGRES_USER>hibernate_orm_test</POSTGRES_USER>
<POSTGRES_PASSWORD>hibernate_orm_test</POSTGRES_PASSWORD>
<POSTGRES_DB>hibernate_orm_test</POSTGRES_DB>
</env>
<ports>
<port>5432:5432</port>
</ports>
<wait>
<tcp>
<mode>mapped</mode>
<ports>
<port>5432</port>
</ports>
</tcp>
<time>10000</time>
</wait>
</run>
</image>
</images>
</configuration>
<executions>
<execution>
<id>docker-start</id>
<phase>compile</phase>
<goals>
<goal>stop</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>docker-stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
@@ -167,6 +124,68 @@
</plugins>
</build>
</profile>
<profile>
<id>postgres</id>
<activation>
<property>
<name>!no-postgres</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.26.1</version>
<configuration>
<images>
<image>
<name>postgres:10.5</name>
<alias>postgresql</alias>
<run>
<env>
<POSTGRES_USER>hibernate_orm_test</POSTGRES_USER>
<POSTGRES_PASSWORD>hibernate_orm_test</POSTGRES_PASSWORD>
<POSTGRES_DB>hibernate_orm_test</POSTGRES_DB>
</env>
<ports>
<port>5432:5432</port>
</ports>
<wait>
<tcp>
<mode>mapped</mode>
<ports>
<port>5432</port>
</ports>
</tcp>
<time>10000</time>
</wait>
</run>
</image>
</images>
</configuration>
<executions>
<execution>
<id>docker-start</id>
<phase>compile</phase>
<goals>
<goal>stop</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>docker-stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

View File

@@ -14,7 +14,7 @@
<!-- Connection specific -->
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL95Dialect"/>
<property name="hibernate.connection.url" value="jdbc:postgresql:hibernate_orm_test"/>
<property name="hibernate.connection.url" value="${postgres.url}"/>
<property name="hibernate.connection.username" value="hibernate_orm_test"/>
<property name="hibernate.connection.password" value="hibernate_orm_test"/>

View File

@@ -136,6 +136,12 @@
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>${project.groupId}</groupId>
@@ -149,55 +155,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.26.1</version>
<configuration>
<images>
<image>
<name>postgres:10.5</name>
<alias>postgresql</alias>
<run>
<env>
<POSTGRES_USER>hibernate_orm_test</POSTGRES_USER>
<POSTGRES_PASSWORD>hibernate_orm_test</POSTGRES_PASSWORD>
<POSTGRES_DB>hibernate_orm_test</POSTGRES_DB>
</env>
<ports>
<port>5432:5432</port>
</ports>
<wait>
<tcp>
<mode>mapped</mode>
<ports>
<port>5432</port>
</ports>
</tcp>
<time>10000</time>
</wait>
</run>
</image>
</images>
</configuration>
<executions>
<execution>
<id>docker-start</id>
<phase>compile</phase>
<goals>
<goal>stop</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>docker-stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
@@ -254,6 +211,67 @@
</plugins>
</build>
</profile>
<profile>
<id>postgres</id>
<activation>
<property>
<name>!no-postgres</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.26.1</version>
<configuration>
<images>
<image>
<name>postgres:10.5</name>
<alias>postgresql</alias>
<run>
<env>
<POSTGRES_USER>hibernate_orm_test</POSTGRES_USER>
<POSTGRES_PASSWORD>hibernate_orm_test</POSTGRES_PASSWORD>
<POSTGRES_DB>hibernate_orm_test</POSTGRES_DB>
</env>
<ports>
<port>5432:5432</port>
</ports>
<wait>
<tcp>
<mode>mapped</mode>
<ports>
<port>5432</port>
</ports>
</tcp>
<time>10000</time>
</wait>
</run>
</image>
</images>
</configuration>
<executions>
<execution>
<id>docker-start</id>
<phase>compile</phase>
<goals>
<goal>stop</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>docker-stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

View File

@@ -16,7 +16,7 @@
<!-- Connection specific -->
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL95Dialect"/>
<property name="hibernate.connection.url" value="jdbc:postgresql:hibernate_orm_test"/>
<property name="hibernate.connection.url" value="${postgres.url}"/>
<property name="hibernate.connection.username" value="hibernate_orm_test"/>
<property name="hibernate.connection.password" value="hibernate_orm_test"/>

38
pom.xml
View File

@@ -62,6 +62,8 @@
<wildfly.openssl.version>1.0.6.Final</wildfly.openssl.version>
<graalvmHome>${env.GRAALVM_HOME}</graalvmHome>
<postgres.url>${env.DATABASE_URL}</postgres.url>
</properties>
<modules>
@@ -132,6 +134,28 @@
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<!-- Workaround maven not being able to set a property conditionally based on environment variable -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<exportAntProperties>true</exportAntProperties>
<target>
<echo message="${postgres.url}"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencyManagement>
@@ -749,4 +773,18 @@
</snapshotRepository>
</distributionManagement>
<profiles>
<profile>
<id>database-url</id>
<activation>
<property>
<name>!env.DATABASE_URL</name>
</property>
</activation>
<properties>
<postgres.url>jdbc:postgresql:hibernate_orm_test</postgres.url>
</properties>
</profile>
</profiles>
</project>