Skip to content

Commit

Permalink
Merge branch 'master' into opendocsUpgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
christosarvanitis authored Nov 26, 2024
2 parents 85100d2 + 6d13c51 commit a0f2a0a
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 214 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
- uses: actions/setup-java@v4
with:
java-version: |
11
17
distribution: 'zulu'
cache: 'gradle'
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
- uses: actions/setup-java@v4
with:
java-version: |
11
17
distribution: 'zulu'
cache: 'gradle'
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
- uses: actions/setup-java@v4
with:
java-version: |
11
17
distribution: 'zulu'
cache: 'gradle'
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kotlinVersion=1.6.21
org.gradle.parallel=true
spinnakerGradleVersion=8.32.1
targetJava17=false
targetJava17=true
includeRuntimes=actuator,core,eureka,retrofit,secrets-aws,secrets-gcp,stackdriver,swagger,tomcat,web

org.gradle.jvmargs=-Xmx2g -Xms2g
2 changes: 1 addition & 1 deletion gradle/kotlin-test.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ dependencies {
compileTestKotlin {
kotlinOptions {
languageVersion = "1.6"
jvmTarget = "11"
jvmTarget = "17"
}
}
4 changes: 2 additions & 2 deletions gradle/kotlin.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ dependencies {
compileKotlin {
kotlinOptions {
languageVersion = "1.6"
jvmTarget = "11"
jvmTarget = "17"
}
}

compileTestKotlin {
kotlinOptions {
languageVersion = "1.6"
jvmTarget = "11"
jvmTarget = "17"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.netflix.spinnaker.config.okhttp3.OkHttpClientProvider;
import com.netflix.spinnaker.kork.annotations.NonnullByDefault;
import com.netflix.spinnaker.kork.client.ServiceClientFactory;
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerRetrofitErrorHandler;
import com.netflix.spinnaker.retrofit.Slf4jRetrofitLogger;
import retrofit.Endpoint;
import retrofit.RequestInterceptor;
Expand Down Expand Up @@ -54,6 +55,7 @@ public <T> T create(Class<T> type, ServiceEndpoint serviceEndpoint, ObjectMapper
.setRequestInterceptor(spinnakerRequestInterceptor)
.setConverter(new JacksonConverter(objectMapper))
.setEndpoint(endpoint)
.setErrorHandler(SpinnakerRetrofitErrorHandler.getInstance())
.setClient(new Ok3Client(clientProvider.getClient(serviceEndpoint)))
.setLogLevel(retrofitLogLevel)
.setLog(new Slf4jRetrofitLogger(type))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jakewharton.retrofit.Ok3Client;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -52,6 +53,7 @@ static void setupOnce() throws Exception {

retrofitService =
new RestAdapter.Builder()
.setClient(new Ok3Client())
.setEndpoint(mockWebServer.url("/").toString())
.setErrorHandler(SpinnakerRetrofitErrorHandler.getInstance())
.build()
Expand Down
1 change: 0 additions & 1 deletion kork-web/kork-web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ dependencies {
api "org.springframework.security:spring-security-core"
api "com.netflix.spectator:spectator-api"
api "com.fasterxml.jackson.core:jackson-annotations"
api "com.squareup.okhttp:okhttp"
api "com.squareup.okhttp3:logging-interceptor"
api "com.squareup.okhttp3:okhttp"
api "com.squareup.retrofit:retrofit"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.netflix.spinnaker.kork.crypto.X509IdentitySource;
import com.netflix.spinnaker.okhttp.OkHttp3MetricsInterceptor;
import com.netflix.spinnaker.okhttp.OkHttpClientConfigurationProperties;
import com.netflix.spinnaker.okhttp.OkHttpMetricsInterceptor;
import com.netflix.spinnaker.okhttp.SpinnakerRequestHeaderInterceptor;
import com.netflix.spinnaker.okhttp.SpinnakerRequestInterceptor;
import com.netflix.spinnaker.retrofit.Retrofit2ConfigurationProperties;
Expand Down Expand Up @@ -90,11 +89,6 @@ public SpinnakerRequestHeaderInterceptor spinnakerRequestHeaderInterceptor() {
return new SpinnakerRequestHeaderInterceptor(clientProperties.getPropagateSpinnakerHeaders());
}

@Bean
public OkHttpMetricsInterceptor okHttpMetricsInterceptor() {
return new OkHttpMetricsInterceptor(registryProvider, metricsProperties);
}

@Bean
public OkHttp3MetricsInterceptor okHttp3MetricsInterceptor() {
return new OkHttp3MetricsInterceptor(registryProvider, metricsProperties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import com.netflix.spectator.api.Registry;
import com.netflix.spinnaker.config.OkHttpMetricsInterceptorProperties;
import com.netflix.spinnaker.kork.common.Header;
import com.squareup.okhttp.Interceptor;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
Expand Down Expand Up @@ -45,14 +42,11 @@ protected final Object doIntercept(Object chainObject) throws IOException {
boolean wasSuccessful = false;
int statusCode = -1;

Interceptor.Chain chain =
(chainObject instanceof Interceptor.Chain) ? (Interceptor.Chain) chainObject : null;
okhttp3.Interceptor.Chain chain3 =
(chainObject instanceof okhttp3.Interceptor.Chain)
? (okhttp3.Interceptor.Chain) chainObject
: null;

Request request = (chain != null) ? chain.request() : null;
okhttp3.Request request3 = (chain3 != null) ? chain3.request() : null;

List<String> missingHeaders = new ArrayList<>();
Expand All @@ -63,24 +57,14 @@ protected final Object doIntercept(Object chainObject) throws IOException {

Object response;

if (chain != null) {
method = request.method();
url = request.url();
response = chain.proceed(request);
statusCode = ((Response) response).code();
} else {
method = request3.method();
url = request3.url().url();
response = chain3.proceed(request3);
statusCode = ((okhttp3.Response) response).code();
}
method = request3.method();
url = request3.url().url();
response = chain3.proceed(request3);
statusCode = ((okhttp3.Response) response).code();

if (checkForHeaders(url.toString())) {
for (Header header : Header.values()) {
String headerValue =
(request != null)
? request.header(header.getHeader())
: request3.header(header.getHeader());
String headerValue = request3.header(header.getHeader());

if (header.isRequired() && StringUtils.isEmpty(headerValue)) {
missingHeaders.add(header.getHeader());
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static org.assertj.core.api.Assertions.assertThat;

import com.netflix.spinnaker.okhttp.OkHttp3MetricsInterceptor;
import com.netflix.spinnaker.okhttp.OkHttpMetricsInterceptor;
import com.netflix.spinnaker.okhttp.SpinnakerRequestHeaderInterceptor;
import com.netflix.spinnaker.okhttp.SpinnakerRequestInterceptor;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -47,7 +46,6 @@ void verifyValidConfiguration() {
ctx -> {
assertThat(ctx).hasSingleBean(SpinnakerRequestInterceptor.class);
assertThat(ctx).hasSingleBean(SpinnakerRequestHeaderInterceptor.class);
assertThat(ctx).hasSingleBean(OkHttpMetricsInterceptor.class);
assertThat(ctx).hasSingleBean(OkHttp3MetricsInterceptor.class);
});
}
Expand Down
Loading

0 comments on commit a0f2a0a

Please sign in to comment.