Skip to content

Commit

Permalink
WIP: First revision of integrations subprojects (helidon-io#109)
Browse files Browse the repository at this point in the history
First revision of integrations subprojects
  • Loading branch information
ljnelson authored Oct 17, 2018
1 parent 8fbafbd commit 8db30ab
Show file tree
Hide file tree
Showing 116 changed files with 9,016 additions and 56 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*~
*.class
*.ctxt
.mtj.tmp/
Expand Down
7 changes: 4 additions & 3 deletions etc/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ if [ "${WERCKER}" = "true" ] ; then
apt-get update && apt-get -y install graphviz
fi

inject_credentials

mvn -f ${WS_DIR}/pom.xml \
clean install \
-Pexamples,spotbugs,javadoc,docs,sources,ossrh-releases \
--fail-at-end
-Pexamples,spotbugs,javadoc,docs,sources,ossrh-releases

examples/archetypes/test-archetypes.sh
examples/archetypes/test-archetypes.sh
49 changes: 0 additions & 49 deletions etc/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,55 +181,6 @@ update_version(){
fi
}

inject_credentials(){
# Add private_key from IDENTITY_FILE
if [ -n "${IDENTITY_FILE}" ] && [ ! -e ~/.ssh ]; then
mkdir ~/.ssh/ 2>/dev/null || true
echo -e "${IDENTITY_FILE}" > ~/.ssh/id_rsa
chmod og-rwx ~/.ssh/id_rsa
echo -e "Host *" >> ~/.ssh/config
echo -e "\tStrictHostKeyChecking no" >> ~/.ssh/config
echo -e "\tUserKnownHostsFile /dev/null" >> ~/.ssh/config
fi

# Add GPG key pair
if [ -n "${GPG_PUBLIC_KEY}" ] && [ -n "${GPG_PRIVATE_KEY}" ] ; then
mkdir ~/.gnupg 2>/dev/null || true
chmod 700 ~/.gnupg
echo "pinentry-mode loopback" > ~/.gnupg/gpg.conf
echo -e "${GPG_PUBLIC_KEY}" > ~/.gnupg/helidon_pub.gpg
gpg --import --no-tty --batch ~/.gnupg/helidon_pub.gpg
echo -e "${GPG_PRIVATE_KEY}" > ~/.gnupg/helidon_sec.gpg
gpg --allow-secret-key-import --import --no-tty --batch ~/.gnupg/helidon_sec.gpg
fi

# Add docker config from DOCKER_CONFIG_FILE
if [ -n "${DOCKER_CONFIG_FILE}" ] && [ ! -e ~/.docker ]; then
mkdir ~/.docker/ 2>/dev/null || true
printf "${DOCKER_CONFIG_FILE}" > ~/.docker/config.json
chmod og-rwx ~/.docker/config.json
fi

# Add maven settings from MAVEN_SETTINGS_FILE
if [ -n "${MAVEN_SETTINGS_FILE}" ] ; then
mkdir ~/.m2/ 2>/dev/null || true
echo -e "${MAVEN_SETTINGS_FILE}" > ~/.m2/settings.xml
fi

# Add maven settings security from MAVEN_SETTINGS_SECURITY_FILE
if [ -n "${MAVEN_SETTINGS_SECURITY_FILE}" ] ; then
mkdir ~/.m2/ 2>/dev/null || true
echo -e "${MAVEN_SETTINGS_SECURITY_FILE}" > ~/.m2/settings-security.xml
fi

# Add maven settings security from MAVEN_SETTINGS_SECURITY_FILE
# Only if none exist on the system
if [ -n "${MAVEN_SETTINGS_SECURITY_FILE}" ] && [ ! -e ~/.m2/settings-security.xml ]; then
mkdir ~/.m2/ 2>/dev/null || true
echo "${MAVEN_SETTINGS_SECURITY_FILE}" > ~/.m2/settings-security.xml
fi
}

release_build(){
# Inject credentials in CI env
inject_credentials
Expand Down
65 changes: 64 additions & 1 deletion etc/scripts/wercker-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,70 @@

# WERCKER=true when running inside a wercker pipeline

inject_credentials(){
# Add private_key from IDENTITY_FILE
if [ -n "${IDENTITY_FILE}" ] && [ ! -e ~/.ssh ]; then
mkdir ~/.ssh/ 2>/dev/null || true
echo -e "${IDENTITY_FILE}" > ~/.ssh/id_rsa
chmod og-rwx ~/.ssh/id_rsa
echo -e "Host *" >> ~/.ssh/config
echo -e "\tStrictHostKeyChecking no" >> ~/.ssh/config
echo -e "\tUserKnownHostsFile /dev/null" >> ~/.ssh/config
fi

# Add GPG key pair
if [ -n "${GPG_PUBLIC_KEY}" ] && [ -n "${GPG_PRIVATE_KEY}" ] ; then
mkdir ~/.gnupg 2>/dev/null || true
chmod 700 ~/.gnupg
echo "pinentry-mode loopback" > ~/.gnupg/gpg.conf
echo -e "${GPG_PUBLIC_KEY}" > ~/.gnupg/helidon_pub.gpg
gpg --import --no-tty --batch ~/.gnupg/helidon_pub.gpg
echo -e "${GPG_PRIVATE_KEY}" > ~/.gnupg/helidon_sec.gpg
gpg --allow-secret-key-import --import --no-tty --batch ~/.gnupg/helidon_sec.gpg
fi

# Add docker config from DOCKER_CONFIG_FILE
if [ -n "${DOCKER_CONFIG_FILE}" ] && [ ! -e ~/.docker ]; then
mkdir ~/.docker/ 2>/dev/null || true
printf "${DOCKER_CONFIG_FILE}" > ~/.docker/config.json
chmod og-rwx ~/.docker/config.json
fi

# Add maven settings from MAVEN_SETTINGS_FILE
if [ -n "${MAVEN_SETTINGS_FILE}" ] ; then
mkdir ~/.m2/ 2>/dev/null || true
echo -e "${MAVEN_SETTINGS_FILE}" > ~/.m2/settings.xml
fi

# Add maven settings security from MAVEN_SETTINGS_SECURITY_FILE
# Only if none exist on the system
if [ -n "${MAVEN_SETTINGS_SECURITY_FILE}" ] && [ ! -e ~/.m2/settings-security.xml ]; then
mkdir ~/.m2/ 2>/dev/null || true
echo "${MAVEN_SETTINGS_SECURITY_FILE}" > ~/.m2/settings-security.xml
fi
}

if [ "${WERCKER}" = "true" ] ; then
export MAVEN_OPTS="-Dmaven.repo.local=${WERCKER_CACHE_DIR}/local_repository"
export MAVEN_OPTS="-Dmaven.repo.local=${WERCKER_CACHE_DIR}/local_repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
rm -rf ~/.m2/settings* ~/.gitconfig ~/.ssh ${WERCKER_CACHE_DIR}/local_repository/io/helidon
# Work around https://github.com/oracle/oci-java-sdk/issues/25
TEMP_OCI_SDK_DIR=$(mktemp -d "oci-java-sdk.XXX")
git clone \
--depth 1 \
--branch \
v$(mvn -B -f "${WERCKER_ROOT}/pom.xml" \
-Dexpression=version.lib.oci-java-sdk-objectstorage org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate | grep '^[0-9]') \
"https://github.com/oracle/oci-java-sdk.git" \
"${TEMP_OCI_SDK_DIR}" && \
mvn -B -U -f "${TEMP_OCI_SDK_DIR}/pom.xml" \
-Dmaven.test.skip=true \
-Dmaven.source.skip=true \
-Dmaven.javadoc.skip=true \
-Dlombok.delombok.skip=true \
-pl bmc-objectstorage \
-am \
install && \
rm -rf "${TEMP_OCI_SDK_DIR}"
fi


239 changes: 239 additions & 0 deletions examples/integrations/cdi/datasource-hikaricp/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>helidon-integrations-examples-datasource-hikaricp</artifactId>

<name>Helidon Integrations: DataSource/HikariCP Example</name>
<description>Helidon Integrations DataSource Hikari Connection Pool Example</description>

<parent>
<groupId>io.helidon.integrations.examples</groupId>
<artifactId>helidon-integrations-examples-project</artifactId>
<version>0.10.3-SNAPSHOT</version>
</parent>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.helidon.integrations.cdi</groupId>
<artifactId>helidon-integrations-cdi-datasource-hikaricp</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>

<!-- Test-scoped dependencies. -->

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>

<!-- Runtime-scoped dependencies. -->

<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>org.jboss.spec.javax.el</groupId>
<artifactId>jboss-el-api_3.0_spec</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.spec.javax.interceptor</groupId>
<artifactId>jboss-interceptors-api_1.2_spec</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>io.helidon.integrations.cdi</groupId>
<artifactId>helidon-integrations-cdi-datasource-hikaricp</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.jboss</groupId>
<artifactId>jandex</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>io.helidon.microprofile.server</groupId>
<artifactId>helidon-microprofile-server</artifactId>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>io.helidon.microprofile.config</groupId>
<artifactId>helidon-microprofile-config-cdi</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<scope>runtime</scope>
</dependency>

<!-- Compile-scoped dependencies. -->

<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-api</artifactId>
<scope>compile</scope>
</dependency>

</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>Copy all project dependencies to ${project.build.directory}/${dependenciesDirectory} for Docker image construction</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${dependenciesDirectory}</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<overWriteIfNewer>true</overWriteIfNewer>
<includeScope>runtime</includeScope>
<excludeScope>test</excludeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>${dependenciesDirectory}</classpathPrefix>
<mainClass>io.helidon.microprofile.server.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>Copy Dockerfile and Kubernetes resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<resources>
<resource>
<directory>src/main/docker</directory>
<filtering>true</filtering>
<includes>
<include>Dockerfile</include>
</includes>
</resource>
<resource>
<filtering>true</filtering>
<directory>src/main/k8s</directory>
<includes>
<include>datasource.secrets.template</include>
<include>app.yaml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<dependenciesDirectory>libs</dependenciesDirectory>
<kubernetesSecretName>${project.artifactId}</kubernetesSecretName>
<spotbugs.exclude>${project.basedir}/src/main/spotbugs/exclusions.xml</spotbugs.exclude>
</properties>

</project>
Loading

0 comments on commit 8db30ab

Please sign in to comment.