Skip to content

Commit

Permalink
Add travis integration (strimzi#6)
Browse files Browse the repository at this point in the history
* Add Travis integration

Signed-off-by: Jakub Scholz <[email protected]>

* Fix Travis YAML

Signed-off-by: Jakub Scholz <[email protected]>

* Set source for Javadoc plugin

Signed-off-by: Jakub Scholz <[email protected]>

* Set source for Javadoc plugin

Signed-off-by: Jakub Scholz <[email protected]>

* Set source for Javadoc plugin

Signed-off-by: Jakub Scholz <[email protected]>

* Set source for Javadoc plugin

Signed-off-by: Jakub Scholz <[email protected]>

* Set source for Javadoc plugin

Signed-off-by: Jakub Scholz <[email protected]>

* Do not build JavaDoc JARs on Java 11

Signed-off-by: Jakub Scholz <[email protected]>

* Fix sportbugs on Java 11

Signed-off-by: Jakub Scholz <[email protected]>

* Add link to the sportbugs bug

Signed-off-by: Jakub Scholz <[email protected]>

* Review comments

Signed-off-by: Jakub Scholz <[email protected]>
  • Loading branch information
scholzj authored Sep 16, 2019
1 parent 52ad2cb commit 8858195
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 14 deletions.
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
dist: xenial
sudo: required
language: java
jdk:
- openjdk8
- openjdk11
cache:
directories:
- "$HOME/.m2"
env:
global:
- PULL_REQUEST=${TRAVIS_PULL_REQUEST}
- TAG=${TRAVIS_TAG:-latest}
- BRANCH=${TRAVIS_BRANCH:-master}
- secure: ZUtBG8nQ3n7r434wrNnkSSMwpqG8Bdqv/nUubP7RPAtGIS/qyWOtYsNLyAj1jKpS5NR0xuqMBSX6BJd8JbG11gpTYH4Gx4aE+TmnhFm489IgywLeEKrlU+5m26I4kMw/P/JoK1jJ6Juu9TyLMLtzkzJhYK1n/VVS1kq2LRXn81ukJrhbxGIqNvk6ok46s0L8SWwjFVyBPgzxc6kcjOQSn9y/zrKsSZUVi6dW0Q7oGTfIMq6LIIlQWk3LJPMW4g8QH6+67WI4z9Ef8z5lzcJ5ypi0tDO9uCiGAGhh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q8BiaSXtvVnzHPWhNci0=
script:
- "./.travis/build.sh"
38 changes: 38 additions & 0 deletions .travis/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -e

# The first segment of the version number is '1' for releases < 9; then '9', '10', '11', ...
JAVA_MAJOR_VERSION=$(java -version 2>&1 | sed -E -n 's/.* version "([0-9]*).*$/\1/p')
if [ ${JAVA_MAJOR_VERSION} -gt 1 ] ; then
export JAVA_VERSION=${JAVA_MAJOR_VERSION}
fi

if [ ${JAVA_MAJOR_VERSION} -eq 1 ] ; then
# some parts of the workflow should be done only one on the main build which is currently Java 8
export MAIN_BUILD="TRUE"
fi

export PULL_REQUEST=${PULL_REQUEST:-true}
export BRANCH=${BRANCH:-master}
export TAG=${TAG:-latest}

if [ ${JAVA_MAJOR_VERSION} -eq 1 ] ; then
mvn -e -V -B install
else
mvn -e -V -B -Dmaven.javadoc.skip=true install
fi


mvn spotbugs:check

# Push only releases
if [ "$PULL_REQUEST" != "false" ] ; then
echo "Building Pull Request - nothing to push"
elif [ "$TAG" = "latest" ] && [ "$BRANCH" != "master" ]; then
echo "Not in master branch and not in release tag - nothing to push"
else
if [ "${MAIN_BUILD}" = "TRUE" ] ; then
echo "Pushing JARs"
./.travis/push-to-nexus.sh
fi
fi
10 changes: 10 additions & 0 deletions .travis/push-to-nexus.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

openssl aes-256-cbc -K $encrypted_9bb2e0bcb75b_key -iv $encrypted_9bb2e0bcb75b_iv -in .travis/signing.gpg.enc -out signing.gpg -d
gpg --import signing.gpg

GPG_EXECUTABLE=gpg mvn -B -DskipTests -s ./.travis/settings.xml -pl '!kafka-oauth-examples-consumer,!kafka-oauth-examples-producer' -P ossrh clean package gpg:sign deploy

rm -rf signing.gpg
gpg --delete-keys
gpg --delete-secret-keys
9 changes: 9 additions & 0 deletions .travis/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
<servers>
<server>
<id>ossrh</id>
<username>${env.NEXUS_USERNAME}</username>
<password>${env.NEXUS_PASSWORD}</password>
</server>
</servers>
</settings>
Binary file added .travis/signing.gpg.enc
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
package io.strimzi.kafka.oauth.common;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -61,6 +62,8 @@ public static <T> T post(URI uri, SSLSocketFactory socketFactory, HostnameVerifi
}

@SuppressWarnings("checkstyle:NPathComplexity")
// Surpressed because of Spotbugs Java 11 bug - https://github.com/spotbugs/spotbugs/issues/756
@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
public static <T> T postOrGet(URI uri, SSLSocketFactory socketFactory, HostnameVerifier hostnameVerifier, String authorization, String contentType, String body, Class<T> responseType) throws IOException {
HttpURLConnection con;
try {
Expand Down
109 changes: 95 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,51 @@
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

<name>Strimzi - Apache Kafka on Kubernetes</name>
<description>Strimzi uses the Kubernetes operator pattern to provide a way to run an Apache Kafka cluster on
Kubernetes in various deployment configurations. The OAuth subproject implements the callbacks for
Kafka authentication using OAuth (based on SASL OAUTHBEARER mechanism).</description>
<url>https://strimzi.io/</url>

<scm>
<connection>scm:git:git://github.com/strimzi/strimzi-kafka-oauth.git</connection>
<developerConnection>scm:git:ssh://github.com:strimzi/strimzi-kafka-oauth.git</developerConnection>
<url>https://github.com/strimzi/strimzi-kafka-oauth</url>
</scm>

<issueManagement>
<system>GitHub</system>
<url>https://github.com/strimzi/strimzi-kafka-oauth/issues</url>
</issueManagement>

<developers>
<developer>
<name>Tom Bentley</name>
<email>[email protected]</email>
<organization>Red Hat</organization>
<organizationUrl>http://www.redhat.com</organizationUrl>
</developer>
<developer>
<name>Paolo Patierno</name>
<email>[email protected]</email>
<organization>Red Hat</organization>
<organizationUrl>http://www.redhat.com</organizationUrl>
</developer>
<developer>
<name>Jakub Scholz</name>
<email>[email protected]</email>
<organization>Red Hat</organization>
<organizationUrl>http://www.redhat.com</organizationUrl>
</developer>
</developers>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
Expand All @@ -30,12 +75,13 @@
<bouncycastle.version>1.60</bouncycastle.version>
</properties>

<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<modules>
<module>oauth-common</module>
<module>oauth-client</module>
<module>oauth-server</module>
<module>examples/consumer</module>
<module>examples/producer</module>
</modules>

<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -220,7 +266,6 @@
<goal>jar</goal>
</goals>
<configuration>
<sourcepath>${project.build.sourceDirectory}:${project.build.directory}/generated-sources/annotations</sourcepath>
<show>public</show>
<failOnError>true</failOnError>
<failOnWarnings>true</failOnWarnings>
Expand All @@ -231,12 +276,48 @@
</plugins>
</build>

<modules>
<module>oauth-common</module>
<module>oauth-client</module>
<module>oauth-server</module>
<module>examples/consumer</module>
<module>examples/producer</module>
</modules>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<!--suppress UnresolvedMavenProperty -->
<gpg.executable>${env.GPG_EXECUTABLE}</gpg.executable>
<!--suppress UnresolvedMavenProperty -->
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven.gpg.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>deploy</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${sonatype.nexus.staging}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit 8858195

Please sign in to comment.