Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
Phoenix/configure travis (#224)
Browse files Browse the repository at this point in the history
* chore(build): Configure Travis

* chore: spotless apply

* chore: fix spotbugs

* chore: tweak coveralls set up as per: kt3k/coveralls-gradle-plugin#85
  • Loading branch information
fieldju authored Dec 19, 2019
1 parent 65a8ddd commit a6640bf
Show file tree
Hide file tree
Showing 13 changed files with 145 additions and 45 deletions.
36 changes: 28 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
language: java
install: true

jdk:
- openjdk8
os: linux
dist: bionic
jdk: openjdk11

script:
- "./gradlew check build buildDashboard generateAggregatedReports --continue"

after_success:
- ./gradlew clean build cerberus-dashboard:builDashboard generateAggregatedReports coveralls
- ./gradlew coveralls
- curl -F 'json_file=@build/coveralls/report.json' 'https://coveralls.io/api/v1/jobs' # https://github.com/kt3k/coveralls-gradle-plugin/issues/85#issuecomment-475958699
- test "${TRAVIS_PULL_REQUEST}" == "false" && test "${TRAVIS_TAG}" != "" && ./gradlew bintrayUpload

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/

cache:
directories:
- "$HOME/.gradle/caches/"
- "$HOME/.gradle/wrapper/"

deploy:
skip_cleanup: true
provider: releases
api_key:
secure: c4P+wrD6ABsSsl7sg7hW686igl5VXiJ6IMoHIh3BbpVA7BKnVlHCV4mHOSW0EZ7y2dOnNH+W8V6P3Yu39Pq3JybL3tZMc6KOZIxq2/7r47cHNakimhb2WhYPf8tly7xIYx31DlDc0OFJsasW9uB++utE72CYIGIMfFkkPw+glfufNkdaQX1Qg3rJ2yzqNPZt5l8cuzQkYfJKheddnN19DcxgQeci/jWYP2dLYfis8lowTNI1CjREf3iE87+ouTMpWjFAOoU9ojQSl6k2c3OKWN81cqPGqM/cgMyR0q/D/AnE1CcooMPqkxCPJP/WeB7NNUgajxWVdl5kdKKO1z86rA3fdFmH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s/cerberus.jar.MD5
on:
repo: Nike-Inc/cerberus-management-service
repo: Nike-Inc/cerberus
tags: true

# uses: docker://cerberusoss/cerberus-build-image:latest
env:
global:
- secure: R8NA4hNA8SmxP7J0x3Nidv0GDnBctrTp0Wrd5s4VFP9+9SQdAgoulSoUgz69CuAJwmB/p0JtMFtd4LQfDeyL97u1SxfCDQFbuJf93Oj341ADOyK0p7dLBa3tmvquaCtWJqfx6GiR0Rp3WipGeyae/1nloMXltvA/gEKFQlingjXfwBERJ7aVWx2LBnuhU7QayhqEHb6AP/BSUtHBYBww7UG2xfpR1goFWp2XCCXElCot2efAxSh/mCiN3ZCn+kn3qs14lb/IM379U8In9XwAJuEdBV50Woawi+9j5cWdPo/+nCGlBM4csrR7rkz9MtGDUTTLN30xq9NkKsPeN5dYkuly/2JNSLyFIfGhsjSAeHqxB7Zw49o99pypERItmHKNzcE3WPzJrPhvHhm6T5Tf+4Rc7rUg3b5cZ6sl+/qonL19U30gF/dDJ/gdSFBULbYwh582Z0+0MrkCDkWBau/KPgt/zsDtWe8xqtKIQYPexlSCjyRujDDZCgwxx6k3AgS5mjjU/qqj6xjBLERy9IEwwe2J9mVfTfrYg5UXDxa2H+MSev1ZFDxWswhTfV/YmEk9biOADNcZI3VBnR2fUekklcPuEuI3qtxbY21iCN2Kwu38+vX+90NfS9jCfPnrY+OHtF9duSpOojPDQs+V/hcZ8wrbYAbf96itS3WZSbDSjZ8=
- secure: YYl4kXd0TKA11aEY8HDbtZmo1g6V2a/qQFUD96/2U+5LaYTyDtFqRL/My9PJqHGh7xmD5TvWhW2ZYRc3Uoh6+Zq4ekNjkk6hKWv01hHCcQo4DDaBNbqTi05+zjmMuA1X8wPS6RGd7rnOhmdpSWX5S66oQc1UjvNa6SJd1txxKHUqfu5g4V0XbKSC+ypHj54cvaOLUY+goQ4MJiZP29iAAzy1AH6gPONwxwi5i/++NNvvLesq0TgObQUUXh5j/nEw7WbjiYUCMmBbssqqUq9koZNyC/DDJbEvcHzpc8oCSzWLrGXVanhoD3Vu5DBUE/JEP18mjCGjkzSSF56nysYNm4QNtwXpx313D3f120GERjA2x81LcAcJc4UaUPNKLUxxRfbjILezJX0nmzK7UMmgegy81iGj7DrChw1BTjanVIXrXNRzZjjVcOgVxTw+Vdi+vpB+BGiEsB4RJKL5I2XGFVwvP8KVOek+OKyrrHP2MdalXteld2ShTwe8jsYbcojdAJ5eLqqYbq9cdCiYO2+wpzK1bB1Cz4FPXrxrBGL2a3bSASsh2h3bV13eOi6J7igeY4BMYqcfFJnxC9ZSBllqoei7f3eiNpDSJQZ3FI5JPTE5b1Hoc9QiaaP5x9cuSI9zbXajGSYd0ym5tAPei3R7NTBCwsesE/vELdTPSwkrR5I=
54 changes: 38 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ buildscript {
classpath "org.owasp:dependency-check-gradle:5.2.4"
classpath "com.github.spotbugs:spotbugs-gradle-plugin:3.0.0"
classpath 'com.netflix.spinnaker.gradle:spinnaker-dev-plugin:7.1.2'
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
}
}

Expand Down Expand Up @@ -74,6 +75,8 @@ allprojects {
subprojects {
apply plugin: 'io.spring.dependency-management'

apply from: file("${rootProject.projectDir}/gradle/bintray.gradle")

sourceCompatibility = '11'

sourceSets {
Expand Down Expand Up @@ -131,26 +134,43 @@ subprojects {
}
}

task aggregatedJacocoReport(type: JacocoReport) {
dependsOn subprojects.test

additionalSourceDirs.from files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories.from files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories.from files(subprojects.sourceSets.main.output)
executionData.from project.fileTree(dir: '.', include: '**/build/jacoco/test.exec')
reports {
xml.enabled true
csv.enabled false
html.enabled true
List<String> blackList = [
'cerberus-api-tests'
]
def publishedProjects = subprojects.findAll { !blackList.contains(it.path) }

task jacocoMerge(type: JacocoMerge) {
publishedProjects.each { subproject ->
executionData subproject.tasks.withType(Test)
}
doFirst {
executionData = files(executionData.findAll { it.exists() })
}
}

afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: 'com/nike/cerberus/api/**') // exclude the api test code
}))
task aggregatedJacocoReport(type: JacocoReport, group: 'Coverage reports') {
description = 'Generates an aggregate report from all subprojects'
dependsOn publishedProjects.test, jacocoMerge

additionalSourceDirs.from = files(publishedProjects.sourceSets.main.allSource.srcDirs)
sourceDirectories.from = files(publishedProjects.sourceSets.main.allSource.srcDirs)
classDirectories.from = files(publishedProjects.sourceSets.main.output)
executionData jacocoMerge.destinationFile

reports {
html.enabled = true // human readable
xml.enabled = true // required by coveralls
}
}

coveralls {
sourceDirs = publishedProjects.sourceSets.main.allSource.srcDirs.flatten()
jacocoReportPath = "${buildDir}/reports/jacoco/aggregatedJacocoReport/aggregatedJacocoReport.xml"
saveAsFile = true
sendToCoveralls = false
}

configurations {
antJUnit
}
Expand All @@ -164,8 +184,9 @@ task aggregatedJunitXml {
ant.taskdef(name: 'junitreport', classname: 'org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator', classpath: configurations.antJUnit.asPath)
dependsOn subprojects*.test
doFirst {
mkdir "$buildDir/test-results"
ant.junitreport(todir: "$buildDir/test-results") {
///reports/jacoco/test/jacocoTestReport.xml
mkdir "$buildDir/reports/jacoco/test"
ant.junitreport(todir: "$buildDir/reports/jacoco") {
subprojects.each {
if (it.testResultsDir.exists()) {
fileset(dir: it.testResultsDir)
Expand All @@ -176,6 +197,7 @@ task aggregatedJunitXml {
}

task aggregatedJunitHtml(type: TestReport) {
dependsOn subprojects*.test
destinationDir = file("$buildDir/reports/allTests")
// Include the results from the `test` task in all sub projects
reportOn subprojects*.test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public void test_pojo_structure_and_behavior() {
List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses("com.nike.cerberus.domain");

pojoClasses.remove(PojoClassFactory.getPojoClass(CerberusAuthToken.class));
pojoClasses.remove(PojoClassFactory.getPojoClass(CerberusAuthToken.Builder.class));
pojoClasses.remove(
PojoClassFactory.getPojoClass(CerberusAuthToken.CerberusAuthTokenBuilder.class));
pojoClasses.remove(PojoClassFactory.getPojoClass(VaultStyleErrorResponse.Builder.class));
pojoClasses.remove(PojoClassFactory.getPojoClass(IamPrincipalPermission.Builder.class));
pojoClasses.remove(PojoClassFactory.getPojoClass(UserGroupPermission.Builder.class));
Expand Down
3 changes: 1 addition & 2 deletions cerberus-web/cerberus-web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,5 @@ jar {
}

bootJar {
archiveClassifier = ''
archiveVersion = ''
archiveName = 'cerberus.jar'
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.nike.cerberus.aws.sts;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
Expand Down Expand Up @@ -114,11 +113,7 @@ public <M> M execute(
}
}

/**
* Build the request
*
* @throws JsonProcessingException
*/
/** Build the request */
protected Request buildRequest(String region, Map<String, String> headers) {
Request.Builder requestBuilder =
new Request.Builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* This is a port of the C3p0DataSourceProvider from the MyBaits Guice package. There might be a
* better way to do this in Spring land with the Spring Mybatis package, however... We are doing
* this to ensure matching behavior when porting CMS from Guice -> Spring Context, as we have battle
* this to ensure matching behavior when porting CMS from Guice to Spring Context, as we have battle
* tested that config.
*
* <p>This creates the C3P0 DataSource bean.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import com.nike.backstopper.apierror.ApiError;
import com.nike.backstopper.exception.ApiException;
import com.nike.cerberus.domain.DomainConstants;
import com.nike.cerberus.domain.EncryptedAuthDataWrapper;
import com.nike.cerberus.domain.IamRoleCredentials;
import com.nike.cerberus.event.AuditLoggingFilterDetails;
Expand Down Expand Up @@ -38,12 +37,6 @@ public AwsIamKmsAuthV1Controller(

@RequestMapping(method = POST, consumes = APPLICATION_JSON_VALUE)
public EncryptedAuthDataWrapper authenticate(@RequestBody IamRoleCredentials request) {
String iamPrincipalArn =
String.format(
DomainConstants.AWS_IAM_ROLE_ARN_TEMPLATE,
request.getAccountId(),
request.getRoleName());

EncryptedAuthDataWrapper authResponse;
try {
authResponse = authenticationService.authenticate(request);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.nike.cerberus.event;

import static com.nike.cerberus.CerberusHttpHeaders.*;

import com.google.common.collect.ImmutableMap;
import com.nike.cerberus.util.SdbAccessRequest;
import com.nike.wingtips.Span;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.nike.cerberus.event;

import com.nike.cerberus.security.CerberusPrincipal;
import java.io.Serializable;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
Expand All @@ -27,8 +28,9 @@
/** An event that can be used to describe what a principal is doing with the API */
@Data
@Builder
public class AuditableEventContext {
public class AuditableEventContext implements Serializable {

private static final long serialVersionUID = 2906382176272161512L;
public static final String UNKNOWN = "_unknown";

private Object principal;
Expand Down
2 changes: 1 addition & 1 deletion debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ JAVA_OPT=""
JVM_ARG="-Xdebug -Xrunjdwp:transport=dt_socket,address=5006,server=y,suspend=y"

# Run
java ${JVM_ARG} -jar ${JAVA_OPT} ./cerberus-web/build/libs/cerberus-web.jar "$@"
java ${JVM_ARG} -jar ${JAVA_OPT} ./cerberus-web/build/libs/cerberus.jar "$@"
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version=4.0.0-SNAPSHOT
version=4.0.0-RC1
group=com.nike.cerberus
springBootVersion=2.2.1.RELEASE
67 changes: 67 additions & 0 deletions gradle/bintray.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'

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 = project.name
userOrg = 'nike'
licenses = ['Apache-2.0']
websiteUrl = 'https://github.com/Nike-Inc/cerberus'
issueTrackerUrl = 'https://github.com/Nike-Inc/cerberus/issues'
vcsUrl = 'https://github.com/Nike-Inc/cerberus.git'
githubRepo = 'Nike-Inc/cerberus'

version {
name = bintrayVersion

gpg {
sign = true
}
}
}
}


task sourcesJar(type: Jar) {
from sourceSets.main.allSource
archiveClassifier = 'sources'
}

task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}

tasks.withType(Zip) { task ->
task.doLast {
ant.checksum file: it.archivePath
}
}

artifacts {
archives javadocJar
archives sourcesJar
}

publishing {
publications {
jar(MavenPublication) {
from components.java

artifact sourcesJar
artifact javadocJar
}
}
}
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ JAVA_OPT=""
JVM_ARG="-Xdebug -Xrunjdwp:transport=dt_socket,address=5006,server=y,suspend=n"

# Run
java ${JVM_ARG} -jar ${JAVA_OPT} ./cerberus-web/build/libs/cerberus-web.jar "$@"
java ${JVM_ARG} -jar ${JAVA_OPT} ./cerberus-web/build/libs/cerberus.jar "$@"

0 comments on commit a6640bf

Please sign in to comment.