Skip to content

Commit

Permalink
refactor(core): Upgrade rosco to Spring Boot 2 (#392)
Browse files Browse the repository at this point in the history
* refactor(core): Upgrade rosco to Spring Boot 2

* chore(build): Update gradle scripts to pass enablePublishing

* chore(build): Bump gradle to 5.4.1
  • Loading branch information
ezimanyi authored Jun 26, 2019
1 parent 390f618 commit d6eeae9
Show file tree
Hide file tree
Showing 20 changed files with 96 additions and 121 deletions.
80 changes: 26 additions & 54 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,88 +3,60 @@ buildscript {
jcenter()
maven { url "https://spinnaker.bintray.com/gradle" }
maven { url "https://plugins.gradle.org/m2/" }
if (spinnakerGradleVersion.endsWith("-SNAPSHOT")) {
mavenLocal()
}
}
dependencies {
classpath 'com.netflix.spinnaker.gradle:spinnaker-dev-plugin:5.2.2'
classpath "com.netflix.spinnaker.gradle:spinnaker-dev-plugin:$spinnakerGradleVersion"
if (Boolean.valueOf(enablePublishing)) {
classpath "com.netflix.spinnaker.gradle:spinnaker-gradle-project:$spinnakerGradleVersion"
}
}
}

allprojects {
apply plugin: "spinnaker.base-project"
apply plugin: 'spinnaker.base-project'
if (Boolean.valueOf(enablePublishing)) {
apply plugin: 'spinnaker.project'
}
apply plugin: "groovy"

group = "com.netflix.spinnaker.rosco"


ext {
spinnakerDependenciesVersion = '1.40.0'
if (project.hasProperty('spinnakerDependenciesVersion')) {
spinnakerDependenciesVersion = project.property('spinnakerDependenciesVersion')
}
}

def checkLocalVersions = [spinnakerDependenciesVersion: spinnakerDependenciesVersion]
if (ext.has('versions')) {
def extVers = ext.get('versions')
if (extVers instanceof Map) {
checkLocalVersions.putAll(extVers)
tasks.withType(JavaExec) {
if (System.getProperty('DEBUG', 'false') == 'true') {
jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8187'
}
}
}

def localVersions = checkLocalVersions.findAll { it.value.endsWith('-SNAPSHOT') }
if (localVersions) {
logger.info("Enabling mavenLocal repo for $localVersions")
subprojects {
if (korkVersion.endsWith("-SNAPSHOT")) {
logger.info("Enabling mavenLocal")
repositories {
mavenLocal()
}
}

spinnaker {
dependenciesVersion = spinnakerDependenciesVersion
}
dependencies {
implementation platform("com.netflix.spinnaker.kork:kork-bom:$korkVersion")

configurations.all {
resolutionStrategy {
force 'org.apache.httpcomponents:httpclient:4.3.5'
force 'org.apache.httpcomponents:httpcore:4.3.2'
}
exclude group: 'javax.servlet', module: 'servlet-api'
exclude group: "org.slf4j", module: "slf4j-log4j12"
exclude group: "org.mortbay.jetty", module: "servlet-api"
annotationProcessor platform("com.netflix.spinnaker.kork:kork-bom:$korkVersion")
annotationProcessor "org.projectlombok:lombok"
testAnnotationProcessor platform("com.netflix.spinnaker.kork:kork-bom:$korkVersion")
testAnnotationProcessor "org.projectlombok:lombok"
}

dependencies {
spinnaker.group("test")
compile spinnaker.dependency("bootActuator")
compile spinnaker.dependency("groovy")
compile spinnaker.dependency("korkSwagger")
compile spinnaker.dependency("spectatorReg")
compile spinnaker.dependency("korkArtifacts")
}
test {
testLogging {
exceptionFormat = 'full'
}
}

tasks.withType(JavaExec) {
if (System.getProperty('DEBUG', 'false') == 'true') {
jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8187'
}
}

//c&p this because NetflixOss reverts it to 1.7 and ends up getting applied last..
project.plugins.withType(JavaBasePlugin) {
JavaPluginConvention convention = project.convention.getPlugin(JavaPluginConvention)
convention.sourceCompatibility = JavaVersion.VERSION_1_8
convention.targetCompatibility = JavaVersion.VERSION_1_8
spinnakerCodeStyle {
enabled = false
}
}
task listrepos {
doLast {
println "Repositories:"
project.repositories.each { println "Name: " + it.name + "; url: " + it.url }
}
}

defaultTasks ':rosco-web:run'
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
enablePublishing=false
spinnakerGradleVersion=6.6.0
korkVersion=5.6.2
org.gradle.parallel=true
6 changes: 3 additions & 3 deletions gradle/buildViaTravis.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
# This script will build the project.

GRADLE="./gradlew -I gradle/init-publish.gradle"
GRADLE="./gradlew -PenablePublishing=true"

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo -e "Build Pull Request #$TRAVIS_PULL_REQUEST => Branch [$TRAVIS_BRANCH]"
$GRADLE -Prelease.useLastTag=true build
$GRADLE build
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" == "" ]; then
echo -e 'Build Branch with Snapshot => Branch ['$TRAVIS_BRANCH']'
$GRADLE -Prelease.travisci=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" build snapshot --stacktrace
Expand All @@ -23,6 +23,6 @@ elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ]; then
esac
else
echo -e 'WARN: Should not be here => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG'] Pull Request ['$TRAVIS_PULL_REQUEST']'
$GRADLE -Prelease.useLastTag=true build
$GRADLE build
fi

14 changes: 0 additions & 14 deletions gradle/init-publish.gradle

This file was deleted.

4 changes: 2 additions & 2 deletions gradle/installViaTravis.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# This script will build the project.

GRADLE="./gradlew -I gradle/init-publish.gradle"
GRADLE="./gradlew -PenablePublishing=true"

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo -e "Assemble Pull Request #$TRAVIS_PULL_REQUEST => Branch [$TRAVIS_BRANCH]"
Expand All @@ -11,7 +11,7 @@ elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" == "" ]; then
$GRADLE -Prelease.travisci=true assemble
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ]; then
echo -e 'Assemble Branch for Release => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG']'
$GRADLE -Prelease.travisci=true -Prelease.useLastTag=true assemble
$GRADLE -Prelease.travisci=true assemble
else
echo -e 'WARN: Should not be here => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG'] Pull Request ['$TRAVIS_PULL_REQUEST']'
$GRADLE assemble
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
29 changes: 17 additions & 12 deletions rosco-core/rosco-core.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
dependencies {
spinnaker.group('bootWeb')
spinnaker.group('retrofitDefault')
compile spinnaker.dependency('rxJava')
spinnaker.group('jackson')
compile spinnaker.dependency("commonsExec")
compile spinnaker.dependency("frigga")
compile spinnaker.dependency('jacksonGuava')
compile spinnaker.dependency('jedis')
compile spinnaker.dependency('korkJedis')
compile spinnaker.dependency('korkWeb')
compile spinnaker.dependency('korkArtifacts')
compileOnly spinnaker.dependency("lombok")
compileOnly "org.projectlombok:lombok"
annotationProcessor "org.projectlombok:lombok"

implementation "com.netflix.frigga:frigga"
implementation "com.netflix.spinnaker.kork:kork-artifacts"
implementation "com.netflix.spinnaker.kork:kork-jedis"
implementation "com.netflix.spinnaker.kork:kork-swagger"
implementation "com.squareup.retrofit:converter-jackson"
implementation "com.squareup.retrofit:retrofit"
implementation "io.reactivex:rxjava"
implementation "org.apache.commons:commons-exec"
implementation "org.codehaus.groovy:groovy-all"
implementation "org.springframework.boot:spring-boot-starter-web"
implementation "redis.clients:jedis"

testImplementation "org.spockframework:spock-core"
testImplementation "org.objenesis:objenesis"
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ class BakePoller implements ApplicationListener<ContextRefreshedEvent> {
@Autowired
String roscoInstanceId

@Value('${rosco.polling.pollingIntervalSeconds:15}')
@Value('${rosco.polling.polling-interval-seconds:15}')
int pollingIntervalSeconds

@Value('${rosco.polling.orphanedJobPollingIntervalSeconds:30}')
@Value('${rosco.polling.orphaned-job-polling-interval-seconds:30}')
int orphanedJobPollingIntervalSeconds

@Value('${rosco.polling.orphanedJobTimeoutMinutes:30}')
@Value('${rosco.polling.orphaned-job-timeout-minutes:30}')
long orphanedJobTimeoutMinutes

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import java.util.function.ToDoubleFunction
@Slf4j
class JobExecutorLocal implements JobExecutor {

@Value('${rosco.jobs.local.timeoutMinutes:10}')
@Value('${rosco.jobs.local.timeout-minutes:10}')
long timeoutMinutes

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ import org.springframework.beans.factory.annotation.Value

abstract class CloudProviderBakeHandler {

@Value('${rosco.configDir}')
@Value('${rosco.config-dir}')
String configDir

@Autowired
PackerCommandFactory packerCommandFactory

@Value('${debianRepository:}')
@Value('${debian-repository:}')
String debianRepository

@Value('${yumRepository:}')
@Value('${yum-repository:}')
String yumRepository

@Value('${chocolateyRepository:}')
@Value('${chocolatey-repository:}')
String chocolateyRepository

@Value('${templatesNeedingRoot:}')
@Value('${templates-needing-root:}')
List<String> templatesNeedingRoot

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class RoscoAWSConfiguration {
AWSBakeHandler awsBakeHandler

@Bean
@ConfigurationProperties('aws.bakeryDefaults')
AWSBakeryDefaults awsBakeryDefaults(@Value('${aws.bakeryDefaults.defaultVirtualizationType:hvm}') BakeRequest.VmType defaultVirtualizationType) {
@ConfigurationProperties('aws.bakery-defaults')
AWSBakeryDefaults awsBakeryDefaults(@Value('${aws.bakery-defaults.default-virtualization-type:hvm}') BakeRequest.VmType defaultVirtualizationType) {
new AWSBakeryDefaults(defaultVirtualizationType: defaultVirtualizationType)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class RoscoAzureConfiguration {
AzureBakeHandler azureBakeHandler

@Bean
@ConfigurationProperties('azure.bakeryDefaults')
@ConfigurationProperties('azure.bakery-defaults')
AzureBakeryDefaults azureBakeryDefaults() {
new AzureBakeryDefaults()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class RoscoDockerConfiguration {
DockerBakeHandler dockerBakeHandler

@Bean
@ConfigurationProperties('docker.bakeryDefaults')
@ConfigurationProperties('docker.bakery-defaults')
DockerBakeryDefaults dockerBakeryDefaults() {
new DockerBakeryDefaults()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ class RoscoGoogleConfiguration {
GCEBakeHandler gceBakeHandler

@Bean
@ConfigurationProperties('google.gce.bakeryDefaults')
@ConfigurationProperties('google.gce.bakery-defaults')
GCEBakeryDefaults deprecatedGCEBakeryDefaults() {
new GCEBakeryDefaults()
}

@Bean
@ConfigurationProperties('google.bakeryDefaults')
@ConfigurationProperties('google.bakery-defaults')
GCEBakeryDefaults gceBakeryDefaults() {
new GCEBakeryDefaults()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void init() {
}

@Bean
@ConfigurationProperties("oracle.bakeryDefaults")
@ConfigurationProperties("oracle.bakery-defaults")
public OracleBakeryDefaults oracleBakeryDefaults() {
return new OracleBakeryDefaults();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@

@Configuration
public class ServiceConfig {
@Value("${services.clouddriver.baseUrl:http://localhost:7002}")
@Value("${services.clouddriver.base-url:http://localhost:7002}")
String clouddriverBaseUrl;

@Value("${retrofit.logLevel:BASIC}")
@Value("${retrofit.log-level:BASIC}")
String retrofitLogLevel;

// This should be service-agnostic if more integrations than clouddriver are used
Expand Down
12 changes: 9 additions & 3 deletions rosco-manifests/rosco-manifests.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
dependencies {
compileOnly spinnaker.dependency("lombok")
compile project(":rosco-core")

compile group: 'commons-io', name: 'commons-io', version: '2.4'
compileOnly "org.projectlombok:lombok"
annotationProcessor "org.projectlombok:lombok"

compile project(":rosco-core")
implementation "org.springframework.boot:spring-boot-starter-web"
implementation "com.netflix.spinnaker.kork:kork-artifacts"
implementation "com.netflix.spinnaker.kork:kork-exceptions"
implementation "com.netflix.spinnaker.kork:kork-security"

implementation "com.squareup.retrofit:retrofit"
}
20 changes: 11 additions & 9 deletions rosco-web/rosco-web.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'spinnaker.application'

ext {
springConfigLocation = System.getProperty('spring.config.location', "${System.getProperty('user.home')}/.spinnaker/")
springConfigLocation = System.getProperty('spring.config.additional-location', "${System.getProperty('user.home')}/.spinnaker/")
}

run {
systemProperty('spring.config.location', project.springConfigLocation)
systemProperty('spring.config.additional-location', project.springConfigLocation)
}
mainClassName = 'com.netflix.spinnaker.rosco.Main'

Expand All @@ -17,13 +17,15 @@ configurations.all {
dependencies {
compile project(":rosco-core")
compile project(":rosco-manifests")
compile spinnaker.dependency("kork")
compile spinnaker.dependency("korkWeb")
compile spinnaker.dependency('korkStackdriver')
compile spinnaker.dependency("korkSwagger")
compile spinnaker.dependency("spectatorReg")
runtime "com.netflix.spinnaker.kork:kork-secrets-aws:${spinnaker.version('kork')}"
spinnaker.group("bootWeb")
implementation "com.netflix.spinnaker.kork:kork-secrets-aws"
implementation "com.netflix.spinnaker.kork:kork-swagger"
implementation "com.netflix.spinnaker.kork:kork-web"

implementation "org.codehaus.groovy:groovy-all"
implementation "com.netflix.spinnaker.kork:kork-artifacts"
implementation "org.springframework.boot:spring-boot-starter-web"
testImplementation "org.spockframework:spock-core"
testImplementation "org.objenesis:objenesis"
}

if (project.plugins.hasPlugin('spinnaker.package')) {
Expand Down
Loading

0 comments on commit d6eeae9

Please sign in to comment.