Skip to content

[DR-3398] [ID-948] Upgrade to Spring Boot 3.1.6, TCL 0.1.9 #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Dec 14, 2023
Merged
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ ij_groovy_for_statement_right_paren_on_new_line = false
ij_groovy_for_statement_wrap = off
ij_groovy_if_brace_force = never
ij_groovy_import_annotation_wrap = 2
ij_groovy_imports_layout = *,|,javax.**,java.**,|,$*
ij_groovy_imports_layout = *,|,jakarta.**,java.**,|,$*
ij_groovy_indent_case_from_switch = true
ij_groovy_indent_label_blocks = true
ij_groovy_insert_inner_class_imports = false
Expand Down Expand Up @@ -367,7 +367,7 @@ ij_groovy_method_parameters_right_paren_on_new_line = false
ij_groovy_method_parameters_wrap = off
ij_groovy_modifier_list_wrap = false
ij_groovy_names_count_to_use_import_on_demand = 3
ij_groovy_packages_to_use_import_on_demand = java.awt.*,javax.swing.*
ij_groovy_packages_to_use_import_on_demand = java.awt.*,jakarta.swing.*
ij_groovy_parameter_annotation_wrap = off
ij_groovy_parentheses_expression_new_line_after_left_paren = false
ij_groovy_parentheses_expression_right_paren_on_new_line = false
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,13 @@ jobs:
id: tag
run: echo tag=$(git describe --tags) >> $GITHUB_OUTPUT

- name: Publish to Artifactory (javax for clients running Spring 2)
- name: Publish jakarta-based client library to Artifactory
run: ./gradlew --build-cache :client-resttemplate:artifactoryPublish
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
ARTIFACTORY_REPO_KEY: libs-snapshot-local

- name: Publish to Artifactory (jakarta for clients running Spring 3)
run: ./gradlew --build-cache :client-resttemplate-jakarta:artifactoryPublish
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
ARTIFACTORY_REPO_KEY: libs-snapshot-local

- name: Auth to GCR
uses: google-github-actions/auth@v1
with:
Expand Down
21 changes: 7 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import org.hidetake.gradle.swagger.generator.GenerateSwaggerCode
import org.springframework.boot.gradle.plugin.SpringBootPlugin

plugins {
id 'idea'

id 'io.spring.dependency-management' version '1.0.11.RELEASE' apply false
id 'org.springframework.boot' version '2.7.15' apply false
id 'io.spring.dependency-management' version '1.1.4' apply false
id 'org.springframework.boot' version '3.1.6' apply false
id 'com.diffplug.spotless' version '6.3.0' apply false
// ^^ for some reason, can't use spotless in multiple subprojects without this ^^
id 'com.google.cloud.tools.jib' version '3.1.4' apply false
Expand All @@ -14,16 +17,6 @@ plugins {

repositories { mavenCentral() }

ext {
springBootVersion = '2.7.15'
springSecurityVersion = '5.6.9'

// Dependency versions for libraries managed by Spring dependency management, affecting all projects
// This can be removed once ECM has migrated to Spring Boot 3
set('thymeleaf.version', '3.1.2.RELEASE')
set('snakeyaml.version', '1.33')
}

subprojects {
group = 'bio.terra'
version = '0.112.0-SNAPSHOT'
Expand All @@ -39,7 +32,7 @@ subprojects {

dependencyManagement {
imports {
mavenBom(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
mavenBom(SpringBootPlugin.BOM_COORDINATES)
}

dependencies {
Expand All @@ -48,7 +41,7 @@ subprojects {
}
}

tasks.withType(org.hidetake.gradle.swagger.generator.GenerateSwaggerCode).all {
tasks.withType(GenerateSwaggerCode).all {
jvmArgs = ['--add-opens=java.base/java.util=ALL-UNNAMED'] // for jvm 16+
}

Expand Down
2 changes: 0 additions & 2 deletions client-resttemplate-jakarta/.swagger-codegen-ignore

This file was deleted.

9 changes: 0 additions & 9 deletions client-resttemplate-jakarta/README.md

This file was deleted.

49 changes: 0 additions & 49 deletions client-resttemplate-jakarta/artifactory.gradle

This file was deleted.

15 changes: 0 additions & 15 deletions client-resttemplate-jakarta/build.gradle

This file was deleted.

12 changes: 0 additions & 12 deletions client-resttemplate-jakarta/publish.sh

This file was deleted.

37 changes: 0 additions & 37 deletions client-resttemplate-jakarta/swagger.gradle

This file was deleted.

2 changes: 1 addition & 1 deletion client-resttemplate/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# terra-external-credentials-manager
ECM Javax-based Client Library for compatibility with Java clients running Spring Boot 2.
ECM jakarta-based Client Library for compatibility with Java clients running Spring Boot 3.

## Publish a new version
To publish a new version of this client library:
Expand Down
2 changes: 0 additions & 2 deletions client-resttemplate/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ repositories { mavenCentral() }

apply from: 'artifactory.gradle'
apply from: 'swagger.gradle'

sourceCompatibility = JavaLanguageVersion.of(11)
2 changes: 1 addition & 1 deletion client-resttemplate/publish.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# Copied from Terra RBS repo
# Publish ECM javax Client Package:
# Publish ECM jakarta Client Package:
VAULT_TOKEN=${1:-$(cat "$HOME"/.vault-token)}
DSDE_TOOLBOX_DOCKER_IMAGE=broadinstitute/dsde-toolbox:consul-0.20.0
ARTIFACTORY_ACCOUNT_PATH=secret/dsp/accts/artifactory/dsdejenkins
Expand Down
6 changes: 5 additions & 1 deletion client-resttemplate/swagger.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ dependencies {

implementation 'io.swagger.core.v3:swagger-annotations'
swaggerCodegen 'io.swagger.codegen.v3:swagger-codegen-cli'

implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1'
implementation 'jakarta.ws.rs:jakarta.ws.rs-api:3.1.0'
}


Expand All @@ -21,7 +24,8 @@ generateSwaggerCode {
modelPackage : "${artifactGroup}.model",
apiPackage : "${artifactGroup}.api",
invokerPackage: "${artifactGroup}.client",
dateLibrary : 'java11'
dateLibrary : 'java11',
jakarta : true
Comment on lines 26 to +28
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't say this in the last review but it has been nagging me. It might be worth switching from library = 'resttemplate' above to library = 'jersey2' to be like other service. Then cross service tracing can be setup like this. Alternatively we could implement a ClientHttpRequestInterceptor that does tracing for this kind of client lib.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good shout, I can play with this.

Do you have a sense of what changes would be required to the services interacting with the client library?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd like to work on this separately in its own ticket, so will merge this PR in without it… I couldn't get it to work out of the box but I may be missing something simple.

]

rawOptions = ["--ignore-file-override", "${projectDir}/.swagger-codegen-ignore"]
Expand Down
3 changes: 0 additions & 3 deletions integration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ dependencies {
// ECM client library
implementation project(':client-resttemplate')

// ECM jakarta-based client library
implementation project(':client-resttemplate-jakarta')

// Terra Test Runner Library
implementation 'bio.terra:terra-test-runner:0.2.0-SNAPSHOT'
}
Expand Down
26 changes: 19 additions & 7 deletions service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ apply from: 'analysis.gradle'
dependencies {
// google
implementation platform('com.google.cloud:libraries-bom:25.1.0')
implementation 'com.google.cloud:google-cloud-pubsub:1.120.19'
implementation 'com.google.cloud:google-cloud-kms:2.6.8'
implementation 'com.google.cloud:google-cloud-pubsub:1.123.6'
implementation 'com.google.cloud:google-cloud-kms:2.15.0'

annotationProcessor 'org.immutables:value:2.9.0'
implementation 'bio.terra:terra-common-lib:0.0.93-SNAPSHOT'
// https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on
implementation 'org.bouncycastle:bcprov-jdk15on:1.70'
implementation 'org.codehaus.janino:janino:3.1.7' // Provides if/else xml parsing for logback config
annotationProcessor 'org.immutables:value:2.9.2'
implementation 'bio.terra:terra-common-lib:0.1.9-SNAPSHOT'
// https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on
implementation 'org.bouncycastle:bcprov-jdk18on:1.76'
implementation 'org.codehaus.janino:janino:3.1.9' // Provides if/else xml parsing for logback config
implementation('org.springframework.cloud:spring-cloud-gcp-starter-logging:1.2.8.RELEASE') {
exclude group: 'org.springframework', module: 'spring-jcl'
}
Expand All @@ -53,6 +53,18 @@ dependencies {
}
// https://mvnrepository.com/artifact/org.mockito/mockito-core
testImplementation group: 'org.mockito', name: 'mockito-core', version: '4.4.0'

// OpenTelemetry
var openTelemetryVersion = '1.31.0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After seeing this in different PRs I'm wondering if we should expose this dependency from tcl, with the idea that all terra services should be using tracing and opentelemetry.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm glad you brought this up, I was wondering about this too. @dvoet , is there a reason why this block isn't handled by default in TCL?

implementation "io.opentelemetry:opentelemetry-api:${openTelemetryVersion}"
implementation "io.opentelemetry:opentelemetry-sdk:${openTelemetryVersion}"
implementation "io.opentelemetry:opentelemetry-sdk-metrics:${openTelemetryVersion}"
implementation "io.opentelemetry:opentelemetry-exporter-logging:${openTelemetryVersion}"
implementation "io.opentelemetry.semconv:opentelemetry-semconv:1.21.0-alpha"
implementation "io.opentelemetry.instrumentation:opentelemetry-spring-webmvc-6.0:${openTelemetryVersion}-alpha"
implementation "io.opentelemetry.instrumentation:opentelemetry-instrumentation-annotations:${openTelemetryVersion}"
implementation "io.opentelemetry.instrumentation:opentelemetry-spring-boot:${openTelemetryVersion}-alpha"
implementation "com.google.cloud.opentelemetry:exporter-trace:0.25.2"
}

sonarqube {
Expand Down
3 changes: 2 additions & 1 deletion service/generators.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies {
runtimeOnly 'org.webjars.npm:swagger-ui-dist:4.18.1'

// Versioned by Spring:
implementation 'javax.validation:validation-api'
implementation 'jakarta.validation:jakarta.validation-api'
implementation 'org.webjars:webjars-locator-core'
}

Expand All @@ -19,6 +19,7 @@ generateSwaggerCode {
apiPackage : "${artifactGroup}.generated.api",
dateLibrary : 'java11',
interfaceOnly : 'true',
jakarta : 'true',
useTags : 'true',
springBootVersion: dependencyManagement.managedVersions['org.springframework.boot:spring-boot']
]
Expand Down
39 changes: 20 additions & 19 deletions service/spring.gradle
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
configurations { compileOnly { extendsFrom annotationProcessor } }

// All version controlled by dependency management plugin
dependencies {
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor:$springBootVersion"
developmentOnly "org.springframework.boot:spring-boot-devtools:$springBootVersion"
implementation "org.springframework.boot:spring-boot-starter-jdbc:$springBootVersion"
implementation "org.springframework.boot:spring-boot-starter-thymeleaf:$springBootVersion"
implementation "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
implementation "org.springframework.boot:spring-boot-starter-webflux:$springBootVersion"
implementation "org.springframework.boot:spring-boot-starter-cache:$springBootVersion"
testImplementation "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
implementation "org.springframework.security:spring-security-oauth2-core:$springSecurityVersion"
implementation ("org.springframework.security:spring-security-oauth2-client:$springSecurityVersion") {
// Need to exclude this because its strictly tied to a vulnerable version.
exclude group: 'net.minidev', module: 'json-smart'
}
implementation('net.minidev:json-smart:2.4.10')
implementation "org.springframework.security:spring-security-oauth2-jose:$springSecurityVersion"
implementation 'org.springframework.retry:spring-retry:1.3.2'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-cache'
testImplementation 'org.springframework.boot:spring-boot-starter-test'

implementation 'org.springframework:spring-aop'
implementation 'org.springframework:spring-aspects'

implementation 'org.springframework.security:spring-security-oauth2-core'
implementation 'org.springframework.security:spring-security-oauth2-client'
implementation 'org.springframework.security:spring-security-oauth2-jose'
implementation 'org.springframework.retry:spring-retry'

// allows mocking final classes
testImplementation 'org.mockito:mockito-inline:4.0.0'
testImplementation 'org.mockito:mockito-inline:5.2.0'

// DB deps (still versioned by Spring):
implementation 'org.liquibase:liquibase-core:4.8.0'
runtimeOnly 'org.postgresql:postgresql:42.3.7'
implementation 'org.liquibase:liquibase-core'
runtimeOnly 'org.postgresql:postgresql'
}

test { useJUnitPlatform() }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package bio.terra.externalcreds;

import bio.terra.common.exception.ErrorReportException;
import jakarta.annotation.Nullable;
import java.util.List;
import javax.annotation.Nullable;
import org.springframework.http.HttpStatus;

public class ExternalCredsException extends ErrorReportException {
Expand Down
Loading