From fb0f00530793eb3cfb06f65bf80eeaae5afbb534 Mon Sep 17 00:00:00 2001 From: mattgogerly Date: Wed, 22 Nov 2023 17:11:33 +0000 Subject: [PATCH 1/6] feat(java17): use JRE17, run tests on JRE17, compile with JDK11 --- .github/workflows/build.yml | 29 ++++++++- .../integration-tests-kubernetes.yml | 10 +--- .github/workflows/integration_tests.yml | 10 +--- .github/workflows/pr.yml | 4 +- .github/workflows/release.yml | 29 ++++++++- Dockerfile.java11.slim | 59 +++++++++++++++++++ Dockerfile.java11.ubuntu | 54 +++++++++++++++++ Dockerfile.slim | 2 +- Dockerfile.ubuntu | 2 +- build.gradle | 11 ++++ .../cats/agent/CacheExecutionSpec.groovy | 4 +- .../clouddriver/google/deploy/GCEUtil.groovy | 10 ++-- .../view/GoogleSecurityGroupProvider.groovy | 2 +- .../google/deploy/GCEUtilSpec.groovy | 2 +- ...cerAtomicOperationConverterUnitSpec.groovy | 2 +- ...ogleInstanceAtomicOperationUnitSpec.groovy | 2 +- ...eServerGroupAtomicOperationUnitSpec.groovy | 4 +- ...gleInstancesAtomicOperationUnitSpec.groovy | 4 +- ...gleImageTagsAtomicOperationUnitSpec.groovy | 6 +- ...LoadBalancerAtomicOperationUnitSpec.groovy | 8 +-- clouddriver-web/config/clouddriver.yml | 3 + .../netflix/spinnaker/clouddriver/Main.groovy | 2 - 22 files changed, 216 insertions(+), 43 deletions(-) create mode 100644 Dockerfile.java11.slim create mode 100644 Dockerfile.java11.ubuntu diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a6a333c4b51..83e4e512d7b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,9 @@ jobs: uses: docker/setup-buildx-action@v3 - uses: actions/setup-java@v3 with: - java-version: 11 + java-version: | + 17 + 11 distribution: 'zulu' cache: 'gradle' - name: Prepare build variables @@ -74,3 +76,28 @@ jobs: tags: | "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ github.ref_name }}-latest-unvalidated-ubuntu" "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-unvalidated-ubuntu" + - name: Build and publish slim JRE 11 container image + # Only run this on repositories in the 'spinnaker' org, not on forks. + if: startsWith(github.repository, 'spinnaker/') + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile.java11.slim + platforms: linux/amd64,linux/arm64 + push: true + tags: | + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ github.ref_name }}-latest-java11-unvalidated" + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated" + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ github.ref_name }}-latest-java11-unvalidated-slim" + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated-slim" + - name: Build and publish ubuntu JRE 11 container image + # Only run this on repositories in the 'spinnaker' org, not on forks. + if: startsWith(github.repository, 'spinnaker/') + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile.java11.ubuntu + push: true + tags: | + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ github.ref_name }}-latest-java11-unvalidated-ubuntu" + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated-ubuntu" diff --git a/.github/workflows/integration-tests-kubernetes.yml b/.github/workflows/integration-tests-kubernetes.yml index 13a01b187f8..c4346384be6 100644 --- a/.github/workflows/integration-tests-kubernetes.yml +++ b/.github/workflows/integration-tests-kubernetes.yml @@ -23,15 +23,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - # Install Java 8 for cross-compilation support. Setting it up before - # Java 11 means it comes later in $PATH (because of how setup-java works) - uses: actions/setup-java@v3 with: - java-version: 8 - distribution: 'zulu' - - uses: actions/setup-java@v3 - with: - java-version: 11 + java-version: | + 17 + 11 distribution: 'zulu' - name: Cache on push if: github.event_name == 'push' diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 0d3ff39eaa5..f7846315621 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -16,15 +16,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - # Install Java 8 for cross-compilation support. Setting it up before - # Java 11 means it comes later in $PATH (because of how setup-java works) - uses: actions/setup-java@v3 with: - java-version: 8 - distribution: 'zulu' - - uses: actions/setup-java@v3 - with: - java-version: 11 + java-version: | + 17 + 11 distribution: 'zulu' - name: Cache on push if: github.event_name == 'push' diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 1861e5eefe0..35c74c3d546 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -21,7 +21,9 @@ jobs: uses: docker/setup-buildx-action@v3 - uses: actions/setup-java@v3 with: - java-version: 11 + java-version: | + 17 + 11 distribution: 'zulu' cache: 'gradle' - name: Prepare build variables diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a73097fa8a..48ad3d2ece8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,9 @@ jobs: uses: docker/setup-buildx-action@v3 - uses: actions/setup-java@v3 with: - java-version: 11 + java-version: | + 17 + 11 distribution: 'zulu' cache: 'gradle' - name: Assemble release info @@ -111,6 +113,31 @@ jobs: tags: | "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-unvalidated-ubuntu" "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-${{ steps.build_variables.outputs.VERSION }}-unvalidated-ubuntu" + - name: Build and publish slim JRE 11 container image + # Only run this on repositories in the 'spinnaker' org, not on forks. + if: startsWith(github.repository, 'spinnaker/') + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile.java11.slim + platforms: linux/amd64,linux/arm64 + push: true + tags: | + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-java11-unvalidated" + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-java11-unvalidated-slim" + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated-slim" + - name: Build and publish ubuntu JRE 11 container image + # Only run this on repositories in the 'spinnaker' org, not on forks. + if: startsWith(github.repository, 'spinnaker/') + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile.java11.ubuntu + platforms: linux/amd64,linux/arm64 + push: true + tags: | + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-java11-unvalidated-ubuntu" + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated-ubuntu" - name: Create release if: steps.release_info.outputs.SKIP_RELEASE == 'false' uses: softprops/action-gh-release@v1 diff --git a/Dockerfile.java11.slim b/Dockerfile.java11.slim new file mode 100644 index 00000000000..52ce2c6a8b6 --- /dev/null +++ b/Dockerfile.java11.slim @@ -0,0 +1,59 @@ +FROM python:3.7-alpine3.16 +LABEL maintainer="sig-platform@spinnaker.io" +ARG TARGETARCH + +# KUBECTL_RELEASE kept one minor version behind latest to maximise compatibility overlap +ENV KUBECTL_RELEASE=1.22.17 +ENV AWS_CLI_VERSION=1.22 +ENV AWS_CLI_S3_CMD=2.0.2 +ENV AWS_AIM_AUTHENTICATOR_VERSION=0.5.9 +ENV GOOGLE_CLOUD_SDK_VERSION=412.0.0 +ENV ECR_TOKEN_VERSION=v1.0.2 + +ENV PATH "$PATH:/usr/local/bin/:/opt/google-cloud-sdk/bin/:/usr/local/bin/aws-iam-authenticator" + +RUN apk update \ + && apk upgrade \ + && apk --no-cache add --update \ + bash \ + ca-certificates \ + wget \ + openjdk11 \ + git \ + openssh-client + +# AWS CLI +RUN pip install --upgrade --no-build-isolation awscli==${AWS_CLI_VERSION} s3cmd==${AWS_CLI_S3_CMD} python-magic \ + && pip uninstall -y pip + +# Google cloud SDK +RUN [ $TARGETARCH == 'amd64' ] && export GCP_ARCH="x86_64" || export GCP_ARCH="arm" \ + && wget -nv https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-${GCP_ARCH}.tar.gz \ + && mkdir -p /opt && cd /opt \ + && tar -xzf /google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-${GCP_ARCH}.tar.gz \ + && rm /google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-${GCP_ARCH}.tar.gz \ + && CLOUDSDK_PYTHON="python3" /opt/google-cloud-sdk/install.sh --usage-reporting=false --bash-completion=false \ + --additional-components app-engine-java app-engine-go gke-gcloud-auth-plugin \ + && rm -rf ~/.config/gcloud \ + && rm -rf /opt/google-cloud-sdk/.install/.backup + +# kubectl + AWS IAM authenticator +RUN wget https://cdn.dl.k8s.io/release/v${KUBECTL_RELEASE}/bin/linux/${TARGETARCH}/kubectl \ + && chmod +x kubectl \ + && mv ./kubectl /usr/local/bin/kubectl \ + && wget -O aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${AWS_AIM_AUTHENTICATOR_VERSION}/aws-iam-authenticator_${AWS_AIM_AUTHENTICATOR_VERSION}_linux_${TARGETARCH} \ + && chmod +x ./aws-iam-authenticator \ + && mv ./aws-iam-authenticator /usr/local/bin/aws-iam-authenticator\ + && ln -sf /usr/local/bin/aws-iam-authenticator /usr/local/bin/heptio-authenticator-aws + +RUN rm /var/cache/apk/* + +RUN addgroup -S -g 10111 spinnaker +RUN adduser -S -G spinnaker -u 10111 spinnaker + +COPY clouddriver-web/build/install/clouddriver /opt/clouddriver +RUN mkdir -p /opt/clouddriver/plugins && chown -R spinnaker:nogroup /opt/clouddriver/plugins + +USER spinnaker + +CMD ["/opt/clouddriver/bin/clouddriver"] diff --git a/Dockerfile.java11.ubuntu b/Dockerfile.java11.ubuntu new file mode 100644 index 00000000000..a5315b33580 --- /dev/null +++ b/Dockerfile.java11.ubuntu @@ -0,0 +1,54 @@ +FROM ubuntu:jammy +LABEL maintainer="sig-platform@spinnaker.io" +ARG TARGETARCH +ENV GOOGLE_CLOUD_SDK_VERSION=412.0.0 +ENV PATH "$PATH:/opt/google-cloud-sdk/bin/" +ENV KUBECTL_RELEASE=1.22.17 +ENV AWS_CLI_VERSION=1.22 +ENV AWS_CLI_S3_CMD=2.0.2 +ENV AWS_AIM_AUTHENTICATOR_VERSION=0.5.9 + +RUN apt-get update && apt-get install -y curl gnupg && \ + curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \ + echo "deb https://packages.cloud.google.com/apt cloud-sdk main" > /etc/apt/sources.list.d/cloud-sdk.list && \ + apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y \ + openjdk-11-jre-headless \ + wget \ + python3-pip \ + python3 \ + git \ + openssh-client && \ + rm -rf ~/.config/gcloud + +# AWS CLI +RUN pip install --upgrade --no-build-isolation awscli==${AWS_CLI_VERSION} s3cmd==${AWS_CLI_S3_CMD} python-magic \ + && apt remove -y python3-pip + +# kubectl + AWS IAM authenticator +RUN wget https://cdn.dl.k8s.io/release/v${KUBECTL_RELEASE}/bin/linux/${TARGETARCH}/kubectl \ + && chmod +x kubectl \ + && mv ./kubectl /usr/local/bin/kubectl \ + && wget -O aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${AWS_AIM_AUTHENTICATOR_VERSION}/aws-iam-authenticator_${AWS_AIM_AUTHENTICATOR_VERSION}_linux_${TARGETARCH} \ + && chmod +x ./aws-iam-authenticator \ + && mv ./aws-iam-authenticator /usr/local/bin/aws-iam-authenticator\ + && ln -sf /usr/local/bin/aws-iam-authenticator /usr/local/bin/heptio-authenticator-aws + +# Google cloud SDK +RUN [ $TARGETARCH == 'amd64' ] && export GCP_ARCH="x86_64" || export GCP_ARCH="arm" \ + && wget -nv https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-${GCP_ARCH}.tar.gz \ + && mkdir -p /opt && cd /opt \ + && tar -xzf /google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-${GCP_ARCH}.tar.gz \ + && rm /google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-${GCP_ARCH}.tar.gz \ + && CLOUDSDK_PYTHON="python3" /opt/google-cloud-sdk/install.sh --usage-reporting=false --bash-completion=false \ + --additional-components app-engine-java app-engine-go gke-gcloud-auth-plugin \ + && rm -rf ~/.config/gcloud \ + && rm -rf /opt/google-cloud-sdk/.install/.backup + + +RUN adduser --system --uid 10111 --group spinnaker +COPY clouddriver-web/build/install/clouddriver /opt/clouddriver +RUN mkdir -p /opt/clouddriver/plugins && chown -R spinnaker:nogroup /opt/clouddriver/plugins +USER spinnaker +CMD ["/opt/clouddriver/bin/clouddriver"] diff --git a/Dockerfile.slim b/Dockerfile.slim index 52ce2c6a8b6..2be397c24b1 100644 --- a/Dockerfile.slim +++ b/Dockerfile.slim @@ -18,7 +18,7 @@ RUN apk update \ bash \ ca-certificates \ wget \ - openjdk11 \ + openjdk17 \ git \ openssh-client diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index a5315b33580..8f57287f548 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y curl gnupg && \ apt-get update && \ apt-get upgrade -y && \ apt-get install -y \ - openjdk-11-jre-headless \ + openjdk-17-jre-headless \ wget \ python3-pip \ python3 \ diff --git a/build.gradle b/build.gradle index 4edb8985647..31fd0a06732 100644 --- a/build.gradle +++ b/build.gradle @@ -102,6 +102,17 @@ subprojects { } } + tasks.withType(JavaCompile).configureEach { + javaCompiler = javaToolchains.compilerFor { + languageVersion = JavaLanguageVersion.of(11) + } + } + tasks.withType(Test).configureEach { + javaLauncher = javaToolchains.launcherFor { + languageVersion = JavaLanguageVersion.of(17) + } + } + tasks.withType(JavaExec) { if (System.getProperty('DEBUG', 'false') == 'true') { jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7102' diff --git a/cats/cats-core/src/test/groovy/com/netflix/spinnaker/cats/agent/CacheExecutionSpec.groovy b/cats/cats-core/src/test/groovy/com/netflix/spinnaker/cats/agent/CacheExecutionSpec.groovy index 7c659a40a71..3d7d19f67b3 100644 --- a/cats/cats-core/src/test/groovy/com/netflix/spinnaker/cats/agent/CacheExecutionSpec.groovy +++ b/cats/cats-core/src/test/groovy/com/netflix/spinnaker/cats/agent/CacheExecutionSpec.groovy @@ -45,9 +45,9 @@ class CacheExecutionSpec extends Specification { ] } 1 * cachingAgent.getCacheKeyPatterns() >> { - return [ + return Optional.of([ "securityGroups": "securityGroups:*:test:us-west-1" - ] + ]) } 1 * providerCache.filterIdentifiers("securityGroups", "securityGroups:*:test:us-west-1") >> { return [ diff --git a/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/deploy/GCEUtil.groovy b/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/deploy/GCEUtil.groovy index 7825018f7e4..326935f6109 100644 --- a/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/deploy/GCEUtil.groovy +++ b/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/deploy/GCEUtil.groovy @@ -396,7 +396,7 @@ class GCEUtil { it.name in forwardingRuleNames } - if (foundForwardingRules.size == forwardingRuleNames.size) { + if (foundForwardingRules.size() == forwardingRuleNames.size()) { return foundForwardingRules } else { def foundNames = foundForwardingRules.collect { it.name } @@ -448,7 +448,7 @@ class GCEUtil { } }.flatten() - null - if (foundInstances.size == instanceLocalNames.size) { + if (foundInstances.size() == instanceLocalNames.size()) { return foundInstances.collect { it.selfLink } } else { def foundNames = foundInstances.collect { it.name } @@ -605,9 +605,9 @@ class GCEUtil { "$instanceTemplate.name.") } - if (instanceTemplateProperties.networkInterfaces?.size != 1) { + if (instanceTemplateProperties.networkInterfaces?.size() != 1) { throw new GoogleOperationException("Instance templates must have exactly one network interface defined. " + - "Instance template $instanceTemplate.name has ${instanceTemplateProperties.networkInterfaces?.size}.") + "Instance template $instanceTemplate.name has ${instanceTemplateProperties.networkInterfaces?.size()}.") } def image @@ -627,7 +627,7 @@ class GCEUtil { } } else { throw new GoogleOperationException("Instance templates must have at least one disk defined. Instance template " + - "$instanceTemplate.name has ${instanceTemplateProperties.disks?.size}.") + "$instanceTemplate.name has ${instanceTemplateProperties.disks?.size()}.") } def networkInterface = instanceTemplateProperties.networkInterfaces[0] diff --git a/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/provider/view/GoogleSecurityGroupProvider.groovy b/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/provider/view/GoogleSecurityGroupProvider.groovy index aa896ec5516..aa2df66e2fc 100644 --- a/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/provider/view/GoogleSecurityGroupProvider.groovy +++ b/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/provider/view/GoogleSecurityGroupProvider.groovy @@ -137,7 +137,7 @@ class GoogleSecurityGroupProvider implements SecurityGroupProvider> forwardingRules _ * forwardingRules.list(PROJECT_NAME, _) >> forwardingRulesList _ * forwardingRulesList.execute() >> new ForwardingRuleList(items: []) - bs.backends.size == lbNames.size + bs.backends.size() == lbNames.size() where: isRegional | location | loadBalancerList | lbNames | backendServiceNames diff --git a/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/converters/UpsertGoogleLoadBalancerAtomicOperationConverterUnitSpec.groovy b/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/converters/UpsertGoogleLoadBalancerAtomicOperationConverterUnitSpec.groovy index 1830aa69181..8886d9614ec 100644 --- a/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/converters/UpsertGoogleLoadBalancerAtomicOperationConverterUnitSpec.groovy +++ b/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/converters/UpsertGoogleLoadBalancerAtomicOperationConverterUnitSpec.groovy @@ -160,7 +160,7 @@ class UpsertGoogleLoadBalancerAtomicOperationConverterUnitSpec extends Specifica portRange: description.portRange ) List services = Utils.getBackendServicesFromHttpLoadBalancerView(httpLoadBalancer.view) - services.findAll { it.healthCheck == (hc as GoogleHealthCheck) }.size == 3 + services.findAll { it.healthCheck == (hc as GoogleHealthCheck) }.size() == 3 description.defaultService.name == DEFAULT_SERVICE description.hostRules[0].pathMatcher.defaultService.name == DEFAULT_PM_SERVICE description.hostRules[0].pathMatcher.pathRules[0].backendService.name == PM_SERVICE diff --git a/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/CreateGoogleInstanceAtomicOperationUnitSpec.groovy b/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/CreateGoogleInstanceAtomicOperationUnitSpec.groovy index b975917824f..6284abd6276 100644 --- a/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/CreateGoogleInstanceAtomicOperationUnitSpec.groovy +++ b/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/CreateGoogleInstanceAtomicOperationUnitSpec.groovy @@ -85,7 +85,7 @@ class CreateGoogleInstanceAtomicOperationUnitSpec extends Specification implemen } } - googleBatchMock.demand.size { return 1 } + googleBatchMock.demand.size() { return 1 } googleBatchMock.demand.execute { def imageList = new ImageList( diff --git a/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/DestroyGoogleServerGroupAtomicOperationUnitSpec.groovy b/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/DestroyGoogleServerGroupAtomicOperationUnitSpec.groovy index 7d0bcab0b76..502aa047d20 100644 --- a/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/DestroyGoogleServerGroupAtomicOperationUnitSpec.groovy +++ b/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/DestroyGoogleServerGroupAtomicOperationUnitSpec.groovy @@ -388,7 +388,7 @@ class DestroyGoogleServerGroupAtomicOperationUnitSpec extends Specification { _ * computeMock.forwardingRules() >> forwardingRules _ * forwardingRules.list(PROJECT_NAME, _) >> forwardingRulesList _ * forwardingRulesList.execute() >> new ForwardingRuleList(items: []) - bs.backends.size == 0 + bs.backends.size() == 0 where: isRegional | location | loadBalancerList | lbNames @@ -482,7 +482,7 @@ class DestroyGoogleServerGroupAtomicOperationUnitSpec extends Specification { _ * computeMock.forwardingRules() >> forwardingRules _ * forwardingRules.list(PROJECT_NAME, _) >> forwardingRulesList _ * forwardingRulesList.execute() >> new ForwardingRuleList(items: []) - bs.backends.size == 0 + bs.backends.size() == 0 where: isRegional | location | loadBalancerList | lbNames diff --git a/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/TerminateGoogleInstancesAtomicOperationUnitSpec.groovy b/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/TerminateGoogleInstancesAtomicOperationUnitSpec.groovy index 3e85a0f5dfa..cee29775ede 100644 --- a/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/TerminateGoogleInstancesAtomicOperationUnitSpec.groovy +++ b/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/TerminateGoogleInstancesAtomicOperationUnitSpec.groovy @@ -115,12 +115,12 @@ class TerminateGoogleInstancesAtomicOperationUnitSpec extends Specification { GoogleApiTestUtils.makeOkId( registry, "compute.instances.delete", [scope: "zonal", zone: ZONE]) - ).count() == GOOD_INSTANCE_IDS.size + ).count() == GOOD_INSTANCE_IDS.size() registry.timer( GoogleApiTestUtils.makeId( registry, "compute.instances.delete", 404, [scope: "zonal", zone: ZONE]) - ).count() == BAD_INSTANCE_IDS.size + ).count() == BAD_INSTANCE_IDS.size() thrown IOException } diff --git a/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/UpsertGoogleImageTagsAtomicOperationUnitSpec.groovy b/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/UpsertGoogleImageTagsAtomicOperationUnitSpec.groovy index 1ea51eb8b58..4a3358fe04e 100644 --- a/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/UpsertGoogleImageTagsAtomicOperationUnitSpec.groovy +++ b/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/UpsertGoogleImageTagsAtomicOperationUnitSpec.groovy @@ -79,7 +79,7 @@ class UpsertGoogleImageTagsAtomicOperationUnitSpec extends Specification impleme } } - googleBatchMock.demand.size { return 1 } + googleBatchMock.demand.size() { return 1 } googleBatchMock.demand.execute { def imageList = new ImageList( selfLink: "https://compute.googleapis.com/compute/alpha/projects/$PROJECT_NAME/global/images", @@ -149,7 +149,7 @@ class UpsertGoogleImageTagsAtomicOperationUnitSpec extends Specification impleme } } - googleBatchMock.demand.size { return 1 } + googleBatchMock.demand.size() { return 1 } googleBatchMock.demand.execute { def imageList = new ImageList( selfLink: "https://compute.googleapis.com/compute/alpha/projects/$PROJECT_NAME/global/images", @@ -219,7 +219,7 @@ class UpsertGoogleImageTagsAtomicOperationUnitSpec extends Specification impleme } } - googleBatchMock.demand.size { return 1 } + googleBatchMock.demand.size() { return 1 } googleBatchMock.demand.execute { callback.onSuccess(emptyImageList, null) callback.onSuccess(emptyImageList, null) diff --git a/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/loadbalancer/UpsertGoogleLoadBalancerAtomicOperationUnitSpec.groovy b/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/loadbalancer/UpsertGoogleLoadBalancerAtomicOperationUnitSpec.groovy index b63ad1ab0e5..a89d324f363 100644 --- a/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/loadbalancer/UpsertGoogleLoadBalancerAtomicOperationUnitSpec.groovy +++ b/clouddriver-google/src/test/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/loadbalancer/UpsertGoogleLoadBalancerAtomicOperationUnitSpec.groovy @@ -1285,7 +1285,7 @@ class UpsertGoogleLoadBalancerAtomicOperationUnitSpec extends Specification { // Add missing instances to target pool. 1 * computeMock.targetPools() >> targetPools 1 * targetPools.addInstance(PROJECT_NAME, REGION_US, TARGET_POOL_NAME, - {it.instances.size == 2 && + {it.instances.size() == 2 && it.instances[0].instance == INSTANCE_1_URL && it.instances[1].instance == INSTANCE_3_URL}) >> targetPoolsAddInstance 1 * targetPoolsAddInstance.execute() @@ -1383,7 +1383,7 @@ class UpsertGoogleLoadBalancerAtomicOperationUnitSpec extends Specification { // Remove extraneous instances from target pool. 1 * computeMock.targetPools() >> targetPools 1 * targetPools.removeInstance(PROJECT_NAME, REGION_US, TARGET_POOL_NAME, - {it.instances.size == 2 && + {it.instances.size() == 2 && it.instances[0].instance == INSTANCE_1_URL && it.instances[1].instance == INSTANCE_2_URL}) >> targetPoolsRemoveInstance 1 * targetPoolsRemoveInstance.execute() @@ -1482,13 +1482,13 @@ class UpsertGoogleLoadBalancerAtomicOperationUnitSpec extends Specification { // Add missing instances to target pool. 1 * computeMock.targetPools() >> targetPools 1 * targetPools.addInstance(PROJECT_NAME, REGION_US, TARGET_POOL_NAME, - {it.instances.size == 1 && it.instances[0].instance == INSTANCE_3_URL}) >> targetPoolsAddInstance + {it.instances.size() == 1 && it.instances[0].instance == INSTANCE_3_URL}) >> targetPoolsAddInstance 1 * targetPoolsAddInstance.execute() // Remove extraneous instances from target pool. 1 * computeMock.targetPools() >> targetPools 1 * targetPools.removeInstance(PROJECT_NAME, REGION_US, TARGET_POOL_NAME, - {it.instances.size == 1 && it.instances[0].instance == INSTANCE_1_URL}) >> targetPoolsRemoveInstance + {it.instances.size() == 1 && it.instances[0].instance == INSTANCE_1_URL}) >> targetPoolsRemoveInstance 1 * targetPoolsRemoveInstance.execute() } diff --git a/clouddriver-web/config/clouddriver.yml b/clouddriver-web/config/clouddriver.yml index e5d802794f2..5288d7fe744 100644 --- a/clouddriver-web/config/clouddriver.yml +++ b/clouddriver-web/config/clouddriver.yml @@ -11,6 +11,9 @@ redis: parallelism: -1 services: + fiat: + enabled: false + baseUrl: http://localhost:7002 front50: baseUrl: http://localhost:8080 diff --git a/clouddriver-web/src/main/groovy/com/netflix/spinnaker/clouddriver/Main.groovy b/clouddriver-web/src/main/groovy/com/netflix/spinnaker/clouddriver/Main.groovy index c26744e4c40..cf200dc7229 100644 --- a/clouddriver-web/src/main/groovy/com/netflix/spinnaker/clouddriver/Main.groovy +++ b/clouddriver-web/src/main/groovy/com/netflix/spinnaker/clouddriver/Main.groovy @@ -42,7 +42,6 @@ import org.springframework.context.annotation.Import import org.springframework.context.annotation.Primary import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder import org.springframework.scheduling.annotation.EnableScheduling -import sun.net.InetAddressCachePolicy import java.security.Security @@ -73,7 +72,6 @@ class Main extends SpringBootServletInitializer { * We often operate in an environment where we expect resolution of DNS names for remote dependencies to change * frequently, so it's best to tell the JVM to avoid caching DNS results internally. */ - InetAddressCachePolicy.cachePolicy = InetAddressCachePolicy.NEVER Security.setProperty('networkaddress.cache.ttl', '0') System.setProperty("spring.main.allow-bean-definition-overriding", "true") } From b223e77d10abf440dbd25ae55d18cb5fab48eff5 Mon Sep 17 00:00:00 2001 From: mattgogerly Date: Tue, 28 Nov 2023 13:34:14 +0000 Subject: [PATCH 2/6] fix(java17): remove invalid usage of BigInteger constructor --- .../clouddriver/data/task/InMemoryTaskRepository.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clouddriver-core/src/main/groovy/com/netflix/spinnaker/clouddriver/data/task/InMemoryTaskRepository.groovy b/clouddriver-core/src/main/groovy/com/netflix/spinnaker/clouddriver/data/task/InMemoryTaskRepository.groovy index f5156373444..392f4dab7ee 100644 --- a/clouddriver-core/src/main/groovy/com/netflix/spinnaker/clouddriver/data/task/InMemoryTaskRepository.groovy +++ b/clouddriver-core/src/main/groovy/com/netflix/spinnaker/clouddriver/data/task/InMemoryTaskRepository.groovy @@ -65,7 +65,7 @@ class InMemoryTaskRepository implements TaskRepository { private String getNextId() { while (true) { - def maybeNext = new BigInteger(new Random().nextInt(Integer.MAX_VALUE)).toString(36) + def maybeNext = BigInteger.valueOf(new Random().nextInt(Integer.MAX_VALUE)).toString(36) if (!repository.containsKey(maybeNext)) { return maybeNext } From 0f01409cd2ec31be345a60507020139ec20a8ceb Mon Sep 17 00:00:00 2001 From: mattgogerly Date: Tue, 28 Nov 2023 13:57:52 +0000 Subject: [PATCH 3/6] fix(java17): fix GHA workflows --- .github/workflows/build.yml | 22 +++++++++++----------- .github/workflows/pr.yml | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 83e4e512d7b..953eef6db06 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -90,14 +90,14 @@ jobs: "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated" "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ github.ref_name }}-latest-java11-unvalidated-slim" "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated-slim" - - name: Build and publish ubuntu JRE 11 container image - # Only run this on repositories in the 'spinnaker' org, not on forks. - if: startsWith(github.repository, 'spinnaker/') - uses: docker/build-push-action@v4 - with: - context: . - file: Dockerfile.java11.ubuntu - push: true - tags: | - "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ github.ref_name }}-latest-java11-unvalidated-ubuntu" - "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated-ubuntu" + - name: Build and publish ubuntu JRE 11 container image + # Only run this on repositories in the 'spinnaker' org, not on forks. + if: startsWith(github.repository, 'spinnaker/') + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile.java11.ubuntu + push: true + tags: | + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ github.ref_name }}-latest-java11-unvalidated-ubuntu" + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated-ubuntu" diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 35c74c3d546..52217858aec 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -55,3 +55,23 @@ jobs: tags: | "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-ubuntu" "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-ubuntu" + - name: Build slim JRE 11 container image + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile.java11.slim + platforms: linux/amd64,linux/arm64 + tags: | + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-java11" + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11" + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-java11-slim" + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-slim" + - name: Build ubuntu JRE 11 container image + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile.java11.ubuntu + platforms: linux/amd64,linux/arm64 + tags: | + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-java11-ubuntu" + "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-ubuntu" From b32690ea2ee1ec9004b24dc585bdd25b21aaa8d9 Mon Sep 17 00:00:00 2001 From: mattgogerly Date: Tue, 28 Nov 2023 17:50:23 +0000 Subject: [PATCH 4/6] fix(java17): replace SystemLambda dependency incompatible with Java 17 --- clouddriver-core/clouddriver-core.gradle | 3 ++- .../security/AccountDefinitionSecretManagerTest.java | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/clouddriver-core/clouddriver-core.gradle b/clouddriver-core/clouddriver-core.gradle index e04f3dc165b..a2003c2270e 100644 --- a/clouddriver-core/clouddriver-core.gradle +++ b/clouddriver-core/clouddriver-core.gradle @@ -56,7 +56,8 @@ dependencies { testImplementation project(":clouddriver-core-tck") testImplementation "cglib:cglib-nodep" - testImplementation "com.github.stefanbirkner:system-lambda:1.2.1" + testImplementation "uk.org.webcompere:system-stubs-core:2.1.5" + testImplementation "uk.org.webcompere:system-stubs-jupiter:2.1.5" testImplementation "io.spinnaker.kork:kork-jedis-test" testImplementation "io.spinnaker.kork:kork-test" testImplementation "org.objenesis:objenesis" diff --git a/clouddriver-core/src/test/java/com/netflix/spinnaker/clouddriver/security/AccountDefinitionSecretManagerTest.java b/clouddriver-core/src/test/java/com/netflix/spinnaker/clouddriver/security/AccountDefinitionSecretManagerTest.java index d01b53644be..62a010359ee 100644 --- a/clouddriver-core/src/test/java/com/netflix/spinnaker/clouddriver/security/AccountDefinitionSecretManagerTest.java +++ b/clouddriver-core/src/test/java/com/netflix/spinnaker/clouddriver/security/AccountDefinitionSecretManagerTest.java @@ -22,8 +22,8 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; +import static uk.org.webcompere.systemstubs.resource.Resources.with; -import com.github.stefanbirkner.systemlambda.SystemLambda; import com.google.cloud.secretmanager.v1.SecretManagerServiceClient; import com.netflix.spinnaker.clouddriver.config.AccountDefinitionConfiguration; import com.netflix.spinnaker.kork.secrets.SecretManager; @@ -42,6 +42,7 @@ import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; +import uk.org.webcompere.systemstubs.environment.EnvironmentVariables; @SpringBootTest(classes = AccountDefinitionConfiguration.class) @ImportAutoConfiguration(JacksonAutoConfiguration.class) @@ -155,11 +156,8 @@ void testVersionCompatibilityForGoogleSecretManager() throws Exception { + " \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/dummy%40my-test-project.iam.gserviceaccount.com\"\n" + "}"; String credentialsPath = writeToFile(credentials, "credentials.json"); - SystemLambda.withEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", credentialsPath) - .execute( - () -> { - assertDoesNotThrow(() -> SecretManagerServiceClient.create()); - }); + with(new EnvironmentVariables().set("GOOGLE_APPLICATION_CREDENTIALS", credentialsPath)) + .execute(() -> assertDoesNotThrow(() -> SecretManagerServiceClient.create())); } private String writeToFile(String content, String fileName) throws IOException { From 85e147f04eafd341c79846f5da467bfda6340453 Mon Sep 17 00:00:00 2001 From: mattgogerly Date: Tue, 28 Nov 2023 17:53:52 +0000 Subject: [PATCH 5/6] fix(java17): revert changes to clouddriver.yml --- clouddriver-web/config/clouddriver.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/clouddriver-web/config/clouddriver.yml b/clouddriver-web/config/clouddriver.yml index 5288d7fe744..e5d802794f2 100644 --- a/clouddriver-web/config/clouddriver.yml +++ b/clouddriver-web/config/clouddriver.yml @@ -11,9 +11,6 @@ redis: parallelism: -1 services: - fiat: - enabled: false - baseUrl: http://localhost:7002 front50: baseUrl: http://localhost:8080 From e6b0b0039b0b96e49323f0419c908db669184bbf Mon Sep 17 00:00:00 2001 From: mattgogerly Date: Tue, 28 Nov 2023 18:42:16 +0000 Subject: [PATCH 6/6] fix(java17): add missing converters to RestAdapters to avoid GSON reflection --- clouddriver-appengine/clouddriver-appengine.gradle | 1 + .../appengine/config/AppengineConfigurationProperties.java | 2 ++ clouddriver-consul/clouddriver-consul.gradle | 1 + .../netflix/spinnaker/clouddriver/consul/api/v1/Consul.groovy | 2 ++ clouddriver-docker/clouddriver-docker.gradle | 1 + .../docker/registry/api/v2/auth/DockerBearerTokenService.groovy | 2 ++ .../docker/registry/api/v2/client/DockerRegistryClient.groovy | 2 ++ .../spinnaker/clouddriver/eureka/deploy/ops/EurekaUtil.groovy | 2 ++ 8 files changed, 13 insertions(+) diff --git a/clouddriver-appengine/clouddriver-appengine.gradle b/clouddriver-appengine/clouddriver-appengine.gradle index cb09de1e1fd..b5f10550eaf 100644 --- a/clouddriver-appengine/clouddriver-appengine.gradle +++ b/clouddriver-appengine/clouddriver-appengine.gradle @@ -25,6 +25,7 @@ dependencies { implementation "io.spinnaker.kork:kork-retrofit" implementation "com.netflix.spectator:spectator-api" implementation "com.squareup.okhttp:okhttp" + implementation "com.squareup.retrofit:converter-jackson" implementation "com.squareup.retrofit:retrofit" implementation "commons-io:commons-io" implementation "org.apache.commons:commons-compress:1.21" diff --git a/clouddriver-appengine/src/main/java/com/netflix/spinnaker/clouddriver/appengine/config/AppengineConfigurationProperties.java b/clouddriver-appengine/src/main/java/com/netflix/spinnaker/clouddriver/appengine/config/AppengineConfigurationProperties.java index 67cb3507d9f..3a7971d28f1 100644 --- a/clouddriver-appengine/src/main/java/com/netflix/spinnaker/clouddriver/appengine/config/AppengineConfigurationProperties.java +++ b/clouddriver-appengine/src/main/java/com/netflix/spinnaker/clouddriver/appengine/config/AppengineConfigurationProperties.java @@ -31,6 +31,7 @@ import retrofit.RestAdapter; import retrofit.client.OkClient; import retrofit.client.Response; +import retrofit.converter.JacksonConverter; import retrofit.http.GET; import retrofit.http.Headers; import retrofit.mime.TypedByteArray; @@ -103,6 +104,7 @@ static MetadataService createMetadataService() { RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint(metadataUrl) + .setConverter(new JacksonConverter()) .setClient(new OkClient(client)) .setErrorHandler(SpinnakerRetrofitErrorHandler.getInstance()) .build(); diff --git a/clouddriver-consul/clouddriver-consul.gradle b/clouddriver-consul/clouddriver-consul.gradle index d6837716734..1c31b58493d 100644 --- a/clouddriver-consul/clouddriver-consul.gradle +++ b/clouddriver-consul/clouddriver-consul.gradle @@ -2,6 +2,7 @@ dependencies { implementation project(":clouddriver-core") implementation "com.squareup.okhttp:okhttp" + implementation "com.squareup.retrofit:converter-jackson" implementation "com.squareup.retrofit:retrofit" implementation "org.codehaus.groovy:groovy" implementation "org.codehaus.groovy:groovy-json" diff --git a/clouddriver-consul/src/main/groovy/com/netflix/spinnaker/clouddriver/consul/api/v1/Consul.groovy b/clouddriver-consul/src/main/groovy/com/netflix/spinnaker/clouddriver/consul/api/v1/Consul.groovy index 8b3e0de00ea..a79ea4361db 100644 --- a/clouddriver-consul/src/main/groovy/com/netflix/spinnaker/clouddriver/consul/api/v1/Consul.groovy +++ b/clouddriver-consul/src/main/groovy/com/netflix/spinnaker/clouddriver/consul/api/v1/Consul.groovy @@ -23,6 +23,7 @@ import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerRetrofitErrorHand import com.squareup.okhttp.OkHttpClient import retrofit.RestAdapter import retrofit.client.OkClient +import retrofit.converter.JacksonConverter class Consul { T api @@ -39,6 +40,7 @@ class Consul { this.api = new RestAdapter.Builder() .setEndpoint(this.endpoint) .setClient(new OkClient(new OkHttpClient())) + .setConverter(new JacksonConverter()) .setLogLevel(RestAdapter.LogLevel.NONE) .setErrorHandler(SpinnakerRetrofitErrorHandler.getInstance()) .build() diff --git a/clouddriver-docker/clouddriver-docker.gradle b/clouddriver-docker/clouddriver-docker.gradle index f8f8ad88273..46fbd602bf0 100644 --- a/clouddriver-docker/clouddriver-docker.gradle +++ b/clouddriver-docker/clouddriver-docker.gradle @@ -14,6 +14,7 @@ dependencies { implementation "com.google.guava:guava" implementation "com.netflix.spectator:spectator-api" implementation "com.squareup.okhttp:okhttp" + implementation "com.squareup.retrofit:converter-jackson" implementation "com.squareup.retrofit:retrofit" implementation "org.apache.commons:commons-compress:1.21" implementation "commons-io:commons-io" diff --git a/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/api/v2/auth/DockerBearerTokenService.groovy b/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/api/v2/auth/DockerBearerTokenService.groovy index 5788df4224f..a2d685bd927 100644 --- a/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/api/v2/auth/DockerBearerTokenService.groovy +++ b/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/api/v2/auth/DockerBearerTokenService.groovy @@ -22,6 +22,7 @@ import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerRetrofitErrorHand import groovy.util.logging.Slf4j import org.apache.commons.io.IOUtils import retrofit.RestAdapter +import retrofit.converter.JacksonConverter import retrofit.http.GET import retrofit.http.Headers import retrofit.http.Path @@ -191,6 +192,7 @@ class DockerBearerTokenService { if (tokenService == null) { def builder = new RestAdapter.Builder() .setEndpoint(realm) + .setConverter(new JacksonConverter()) .setLogLevel(RestAdapter.LogLevel.NONE) .setErrorHandler(SpinnakerRetrofitErrorHandler.getInstance()) .build() diff --git a/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/api/v2/client/DockerRegistryClient.groovy b/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/api/v2/client/DockerRegistryClient.groovy index 2233c6c3052..d13a91b17a7 100644 --- a/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/api/v2/client/DockerRegistryClient.groovy +++ b/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/api/v2/client/DockerRegistryClient.groovy @@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory import retrofit.RestAdapter import retrofit.client.Response import retrofit.converter.GsonConverter +import retrofit.converter.JacksonConverter import retrofit.http.GET import retrofit.http.Header import retrofit.http.Headers @@ -172,6 +173,7 @@ class DockerRegistryClient { this.registryService = new RestAdapter.Builder() .setEndpoint(address) .setClient(okClientProvider.provide(address, clientTimeoutMillis, insecureRegistry)) + .setConverter(new JacksonConverter()) .setLogLevel(RestAdapter.LogLevel.NONE) .setErrorHandler(SpinnakerRetrofitErrorHandler.getInstance()) .build() diff --git a/clouddriver-eureka/src/main/groovy/com/netflix/spinnaker/clouddriver/eureka/deploy/ops/EurekaUtil.groovy b/clouddriver-eureka/src/main/groovy/com/netflix/spinnaker/clouddriver/eureka/deploy/ops/EurekaUtil.groovy index d98902ce8be..a0268b17918 100644 --- a/clouddriver-eureka/src/main/groovy/com/netflix/spinnaker/clouddriver/eureka/deploy/ops/EurekaUtil.groovy +++ b/clouddriver-eureka/src/main/groovy/com/netflix/spinnaker/clouddriver/eureka/deploy/ops/EurekaUtil.groovy @@ -20,6 +20,7 @@ import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerRetrofitErrorHand import org.apache.http.impl.client.HttpClients import retrofit.RestAdapter import retrofit.client.ApacheClient +import retrofit.converter.JacksonConverter import java.util.concurrent.atomic.AtomicReference import java.util.regex.Pattern @@ -31,6 +32,7 @@ class EurekaUtil { new RestAdapter.Builder() .setEndpoint(eurekaEndpoint) .setClient(getApacheClient()) + .setConverter(new JacksonConverter()) .setErrorHandler(SpinnakerRetrofitErrorHandler.getInstance()) .build().create(Eureka) }