diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 9df0fad..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,47 +0,0 @@ -# This workflow will build a Java project with Gradle -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle - -name: Release - -on: - push: - # Sequence of patterns matched against refs/tags - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 -jobs: - Build-and-Release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 8 - uses: actions/setup-java@v1 - with: - java-version: 8 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew assemble - - name: Test with Gradle - run: ./gradlew check - - name: Upload coverage report to CodeCov - uses: codecov/codecov-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos - file: ./build/reports/cobertura/coverage.xml # optional - fail_ci_if_error: true # optional (default = false) - verbose: true - - name: Release artifact to Bintray - env: - BINTRAY_USER: ${{ secrets.BINTRAY_USER }} - BINTRAY_KEY: ${{ secrets.BINTRAY_KEY}} - run: ./gradlew bintrayUpload - - name: Slack notification when release fails - if: ${{ failure() }} - uses: rtCamp/action-slack-notify@v2.1.0 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - SLACK_CHANNEL: cerberus-alerts - SLACK_MESSAGE: 'Cerberus release workflow has failed :build-failed:' - SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png - SLACK_TITLE: Cerberus Build Failure Notification - SLACK_USERNAME: GitHub Actions \ No newline at end of file diff --git a/README.md b/README.md index 13f6ff3..0203639 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # Cerberus Spring Boot Client -[ ![Download](https://api.bintray.com/packages/nike/maven/cerberus-spring-boot-client/images/download.svg) ](https://bintray.com/nike/maven/cerberus-spring-boot-client/_latestVersion) ![][gh actions img] [![codecov](https://codecov.io/gh/Nike-Inc/cerberus-spring-boot-client/branch/master/graph/badge.svg)](https://codecov.io/gh/Nike-Inc/cerberus-spring-boot-client) [![][license img]][license] @@ -9,10 +8,24 @@ A Spring Boot client library for Cerberus for Spring Boot applications. To learn more about Cerberus, please see the [Cerberus website](http://engineering.nike.com/cerberus/). +## Publishing Notice 3/17/2021 +As of spring 2021, JFrog has decided to sunset Bintray and JCenter. +Due to this decision, we are pausing our open source publishing of the Cerberus Spring Boot Client. +However, we will still be updating the source code and making new GitHub releases. + +In order to build the jar yourself, run this command: +```bash +./gradlew assemble +``` + +The jar will be located in `./build/libs/`. + +For any questions or concerns, create a Github issue [here](https://github.com/Nike-Inc/cerberus-spring-boot-client/issues/new). + ## Quickstart for EC2 1. Start with the [quick start guide](http://engineering.nike.com/cerberus/docs/user-guide/quick-start). -2. Add the [Cerberus Spring Boot Client dependency](https://bintray.com/nike/maven/cerberus-spring-boot-client) to your build (e.g. Maven, Gradle) +2. Add the Cerberus Spring Boot Client dependency to your build (e.g. Artifactory) or build the jar 3. Provide an authentication mechanism. - For local development it is easiest to export a `CERBERUS_TOKEN` that you copied from the Cerberus dashboard. When running in AWS, your application will not need this environmetal variable, instead it will automatically diff --git a/build.gradle b/build.gradle index 4672a9c..afd0966 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,6 @@ buildscript { apply plugin: 'java' apply plugin: 'maven' -apply plugin: 'com.jfrog.bintray' apply plugin: 'maven-publish' apply plugin: "com.diffplug.gradle.spotless" @@ -41,7 +40,6 @@ targetCompatibility = 1.8 apply from: 'gradle/dependencies.gradle' apply from: 'gradle/check.gradle' apply from: 'gradle/integration.gradle' -apply from: 'gradle/bintray.gradle' apply from: 'gradle/owasp-dependency-check.gradle' group = groupId diff --git a/gradle.properties b/gradle.properties index 9dc1842..994c83e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,6 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -version=3.2.3 +version=3.2.4 groupId=com.nike artifactId=cerberus-spring-boot-client diff --git a/gradle/bintray.gradle b/gradle/bintray.gradle deleted file mode 100644 index 62a7548..0000000 --- a/gradle/bintray.gradle +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2017 Nike, Inc. - * - * 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. - */ - -def bintrayUser = project.hasProperty('bintrayUser') ? project.bintrayUser : System.getenv('BINTRAY_USER') ?: '' -def bintrayKey = project.hasProperty('bintrayKey') ? project.bintrayKey : System.getenv('BINTRAY_KEY') ?: '' -def bintrayVersion = "$version" - -bintray { - user = bintrayUser - key = bintrayKey - dryRun = false - publish = true - publications = ['jar'] - - pkg { - repo = 'maven' - name = 'cerberus-spring-boot-client' - userOrg = 'nike' - licenses = ['Apache-2.0'] - websiteUrl = 'https://github.com/Nike-Inc/cerberus-spring-boot-client' - issueTrackerUrl = 'https://github.com/Nike-Inc/cerberus-spring-boot-client/issues' - vcsUrl = 'https://github.com/Nike-Inc/cerberus-spring-boot-client.git' - githubRepo = 'Nike-Inc/cerberus-spring-boot-client' - githubReleaseNotesFile = 'CHANGELOG.md' - - version { - name = bintrayVersion - - gpg { - sign = true - } - } - } -} - - -task sourcesJar(type: Jar) { - from sourceSets.main.allSource - classifier = 'sources' -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -artifacts { - archives javadocJar - archives sourcesJar -} - -publishing { - publications { - jar(MavenPublication) { - from components.java - - artifact sourcesJar - artifact javadocJar - - } - } -} diff --git a/gradle/buildscript.gradle b/gradle/buildscript.gradle index 432c80a..6f6be21 100644 --- a/gradle/buildscript.gradle +++ b/gradle/buildscript.gradle @@ -21,7 +21,6 @@ repositories { dependencies { classpath "org.owasp:dependency-check-gradle:5.3.2" classpath "net.saliman:gradle-cobertura-plugin:2.6.1" - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5' classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.3' classpath "com.diffplug.spotless:spotless-plugin-gradle:3.30.0" } diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 986cdde..0151b33 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -24,6 +24,7 @@ configurations.all { force "ch.qos.logback:logback-classic:1.2.3" force "net.sourceforge.pmd:pmd-core:6.21.0" force "net.sourceforge.pmd:pmd-java:6.21.0" + force "com.fasterxml.jackson.core:jackson-databind:2.12.1" dependencySubstitution { substitute module("org.mortbay.jetty:jetty") with module("org.eclipse.jetty:jetty-server:9.4.33.v20201020") @@ -42,7 +43,11 @@ dependencies { compile "org.springframework.boot:spring-boot-autoconfigure:2.3.4.RELEASE" // Cerberus dependencies - compile "com.nike:cerberus-client:7.3.2" + implementation('com.nike:cerberus-client'){ + version { + branch = 'master' + } + } // Test dependencies testRuntime 'org.slf4j:slf4j-simple:1.7.25' diff --git a/gradle/integration.gradle b/gradle/integration.gradle index 661a642..49f4ce8 100644 --- a/gradle/integration.gradle +++ b/gradle/integration.gradle @@ -22,7 +22,7 @@ sourceSets { } task integration(type: Test, description: 'Runs integration tests') { - testClassesDir = sourceSets.integration.output.classesDir + testClassesDirs = sourceSets.integration.output.classesDirs classpath = sourceSets.integration.runtimeClasspath } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 13372ae..e708b1c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2d80b69..ea13fdf 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 9d82f78..4f906e0 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,20 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# ############################################################################## ## @@ -6,20 +22,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +64,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,28 +75,14 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -85,7 +106,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -105,10 +126,11 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath @@ -134,27 +156,30 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index aec9973..ac1b06f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -8,20 +24,23 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,34 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/settings.gradle b/settings.gradle index e430f56..4a7bd43 100644 --- a/settings.gradle +++ b/settings.gradle @@ -14,4 +14,10 @@ * limitations under the License. */ -rootProject.name = artifactId \ No newline at end of file +rootProject.name = artifactId + +sourceControl { + gitRepository("https://github.com/Nike-Inc/cerberus-java-client.git") { + producesModule("com.nike:cerberus-client") + } +} \ No newline at end of file diff --git a/src/integration/java/com/nike/cerberus/springboot/CerberusSpringBootClientIntegrationTests.java b/src/integration/java/com/nike/cerberus/springboot/CerberusSpringBootClientIntegrationTests.java index 5efbb8f..5854d0d 100644 --- a/src/integration/java/com/nike/cerberus/springboot/CerberusSpringBootClientIntegrationTests.java +++ b/src/integration/java/com/nike/cerberus/springboot/CerberusSpringBootClientIntegrationTests.java @@ -16,8 +16,8 @@ package com.nike.cerberus.springboot; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.fieldju.commons.EnvUtils; import com.nike.cerberus.client.CerberusClient; diff --git a/src/main/java/com/nike/cerberus/springboot/CerberusClientSpringBootConfiguration.java b/src/main/java/com/nike/cerberus/springboot/CerberusClientSpringBootConfiguration.java index c5c60b8..f0ae59a 100644 --- a/src/main/java/com/nike/cerberus/springboot/CerberusClientSpringBootConfiguration.java +++ b/src/main/java/com/nike/cerberus/springboot/CerberusClientSpringBootConfiguration.java @@ -41,7 +41,7 @@ @EnableConfigurationProperties(CerberusClientSpringBootProperties.class) public class CerberusClientSpringBootConfiguration { - private CerberusClientSpringBootProperties cerberusClientProperties; + private CerberusClientSpringBootProperties cerberusClientProperties; // NOPMD @Autowired public CerberusClientSpringBootConfiguration( @@ -59,7 +59,7 @@ public CerberusClientSpringBootConfiguration( @Bean public CerberusClient cerberusClient() { String url = cerberusClientProperties.getUrl(); - String region = cerberusClientProperties.getRegion(); + String region = cerberusClientProperties.getRegion(); // NOPMD if (url == null || url.isEmpty()) { throw new IllegalArgumentException( "cerberus.url setting is required! "