Skip to content

Commit

Permalink
Revert "feat!: Spring Cloud 2024.0 and Spring Boot 3.4.1 (#3411)"
Browse files Browse the repository at this point in the history
This reverts commit a72a86b.
  • Loading branch information
diegomarquezp authored Jan 24, 2025
1 parent a72a86b commit 57f3a09
Show file tree
Hide file tree
Showing 35 changed files with 373 additions and 1,180 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/integrationTests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,114 @@ jobs:
--batch-mode \
--define aggregate=true \
surefire-report:failsafe-report-only
- name: Archive logs
if: always()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: Integration Test Logs - ${{ matrix.it}}
path: |
**/target/failsafe-reports/*
**/target/site
spring-boot-3-2-compatibility:
if: |
github.actor != 'dependabot[bot]' && ((
github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name
) || (github.event_name != 'pull_request'))
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
it:
- alloydb
- bigquery
- cloudsql
- config
- datastore
- firestore
- kms
- kotlin
- logging
- metrics
- multisample
- pubsub
- pubsub-bus
- pubsub-docs
- pubsub-emulator
- pubsub-integration
- secretmanager
- spanner
- storage
# trace excluded
- vision
steps:
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d' --utc)" >> $GITHUB_OUTPUT
- uses: actions/checkout@v2
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Set Up Authentication
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.SPRING_CLOUD_GCP_CI_SA_KEY }}
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v1
with:
version: latest
project_id: spring-cloud-gcp-ci
export_default_credentials: true
- name: Install pubsub-emulator
if: ${{ matrix.it == 'pubsub-emulator' }}
run: |
gcloud components install pubsub-emulator beta && \
gcloud components update
- name: Mvn install # Need this when the directory/pom structure changes
id: install
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--threads 1.5C \
--define maven.test.skip=true \
--define maven.javadoc.skip=true \
--define org.slf4j.simpleLogger.showDateTime=true \
--define org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
install
- name: Update samples to use Spring Boot Starter 3.2.5
working-directory: ./spring-cloud-gcp-samples
run: |
sudo apt-get update && sudo apt-get install -y xmlstarlet
xmlstarlet ed -L -N x=http://maven.apache.org/POM/4.0.0 \
-u '/x:project/x:parent/x:version' -v '3.2.5' pom.xml
- name: Integration Tests
id: intTest
env:
DB_PASSWORD: ${{ secrets.SPRING_CLOUD_GCP_CI_DB_ROOT_PASSWORD }}
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--activate-profiles spring-cloud-gcp-ci-it \
--define maven.javadoc.skip=true \
--define skip.surefire.tests=true \
--define org.slf4j.simpleLogger.showDateTime=true \
--define org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
--define "spring.datasource.password=${DB_PASSWORD}" \
--define "spring.r2dbc.password=${DB_PASSWORD}" \
--define "spring.cloud.gcp.sql.database-name=code_samples_test_db2" \
--define it.${{ matrix.it }}=true \
verify
- name: Aggregate Report
run: |
./mvnw \
--batch-mode \
--define aggregate=true \
surefire-report:failsafe-report-only
- name: Archive logs
if: always()
continue-on-error: true
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/scripts/native-image-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,13 @@ run_sample_tests () {

else
project_names="$(echo "${module_samples[@]}" | sed 's/ /,/g')"
# Note that spring.cloud.refresh is disabled in native image mode. This affects samples
# that use @RefreshScope.
# See https://docs.spring.io/spring-cloud-config/reference/client.html#aot-and-native-image-support
mvn clean test \
--activate-profiles native-sample-config,nativeTest \
--define notAllModules=true \
--define maven.javadoc.skip=true \
-pl="${project_names}" \
--define org.slf4j.simpleLogger.showDateTime=true \
--define org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
--define spring-boot.run.arguments="--spring.cloud.refresh.enabled=false"
--define org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS
fi
popd
}
Expand Down
6 changes: 0 additions & 6 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ This project has dependency and transitive dependencies on Spring Projects. The
|===
| Spring Framework on Google Cloud | Spring Cloud | Spring Boot | Spring Framework | Supported

|6.x
|https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2024.0-Release-Notes[2024.0.x] (Moorgate)
|https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.4-Release-Notes[3.4.x]
|https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.2-Release-Notes[6.2.x]
|Yes

|5.x
|https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2023.0-Release-Notes[2023.0.x] (Leyton)
|https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes[3.2.x]*, https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.3-Release-Notes[3.3.x]
Expand Down
2 changes: 0 additions & 2 deletions docs/src/main/asciidoc/getting-started.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ Spring Framework on Google Cloud has dependency and transitive dependencies on S
|===
| Spring Framework on Google Cloud | Spring Cloud | Spring Boot | Spring Framework | Supported


|6.x |https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2024.0-Release-Notes[2024.0.x] (Moorgate)|https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.4-Release-Notes[3.4.x]|https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.2-Release-Notes[6.2.x]|Yes
|5.x | https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2023.0-Release-Notes[2023.0.x] (Leyton) |https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes[3.2.x]*, https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.3-Release-Notes[3.3.x]
| https://github.com/spring-projects/spring-framework/wiki/What%27s-New-in-Spring-Framework-6.x#whats-new-in-version-61[6.1.x]| Yes
|4.x | https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2022.0-Release-Notes[2022.0.x] (Kilburn) |https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Release-Notes[3.0.x], https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.1-Release-Notes[3.1.x]| https://github.com/spring-projects/spring-framework/wiki/What%27s-New-in-Spring-Framework-6.x#whats-new-in-version-60[6.x]| Yes
Expand Down
65 changes: 0 additions & 65 deletions docs/src/main/asciidoc/migration-guide-5.x.adoc

This file was deleted.

4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
<properties>
<project.parent.version>${project.version}</project.parent.version>
<!-- Dependency versions -->
<spring-cloud-dependencies.version>2024.0.0</spring-cloud-dependencies.version>
<spring-boot-dependencies.version>3.4.2</spring-boot-dependencies.version>
<spring-cloud-dependencies.version>2023.0.5</spring-cloud-dependencies.version>
<spring-boot-dependencies.version>3.3.4</spring-boot-dependencies.version>
<spring-cloud-gcp-dependencies.version>${project.parent.version}</spring-cloud-gcp-dependencies.version>
<zipkin-gcp.version>2.2.6</zipkin-gcp.version>
<java-cfenv.version>2.5.0</java-cfenv.version>
Expand Down
5 changes: 1 addition & 4 deletions spring-cloud-gcp-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,7 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-secretmanager</artifactId>
<!-- A few starters need this dependency to validate secrets -->
<!-- using SecretManagerSyntaxUtils. Making it optional produces runtime failures -->
<!-- of the kind ClassNotFoundError. -->
<optional>false</optional>
<optional>true</optional>
</dependency>

<!-- KMS -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

package com.google.cloud.spring.autoconfigure.secretmanager;

import static com.google.cloud.spring.secretmanager.SecretManagerSyntaxUtils.getMatchedPrefixes;
import static com.google.cloud.spring.secretmanager.SecretManagerSyntaxUtils.warnIfUsingDeprecatedSyntax;

import com.google.cloud.secretmanager.v1.SecretManagerServiceClient;
import com.google.cloud.secretmanager.v1.SecretManagerServiceSettings;
import com.google.cloud.spring.core.DefaultCredentialsProvider;
Expand All @@ -29,10 +26,7 @@
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.apache.arrow.util.VisibleForTesting;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.BootstrapRegistry;
import org.springframework.boot.context.config.ConfigDataLocation;
Expand All @@ -44,8 +38,10 @@
public class SecretManagerConfigDataLocationResolver implements
ConfigDataLocationResolver<SecretManagerConfigDataResource> {

private static final Logger logger = LoggerFactory.getLogger(SecretManagerConfigDataLocationResolver.class);

/**
* ConfigData Prefix for Google Cloud Secret Manager.
*/
public static final String PREFIX = "sm://";
/**
* A static client to avoid creating another client after refreshing.
*/
Expand All @@ -54,9 +50,7 @@ public class SecretManagerConfigDataLocationResolver implements
@Override
public boolean isResolvable(ConfigDataLocationResolverContext context,
ConfigDataLocation location) {
Optional<String> matchedPrefix = getMatchedPrefixes(location::hasPrefix);
warnIfUsingDeprecatedSyntax(logger, matchedPrefix.orElse(""));
return matchedPrefix.isPresent();
return location.hasPrefix(PREFIX);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@
import com.google.cloud.secretmanager.v1.SecretPayload;
import com.google.cloud.secretmanager.v1.SecretVersionName;
import com.google.protobuf.ByteString;
import java.util.stream.Stream;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.springframework.boot.BootstrapRegistry.InstanceSupplier;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
Expand All @@ -32,13 +28,6 @@ class SecretManagerCompatibilityTests {
private SpringApplicationBuilder application;
private SecretManagerServiceClient client;

static Stream<Arguments> prefixes() {
return Stream.of(
Arguments.of("sm://"),
Arguments.of("sm@")
);
}

@BeforeEach
void init() {
application = new SpringApplicationBuilder(SecretManagerCompatibilityTests.class)
Expand Down Expand Up @@ -75,11 +64,10 @@ void init() {
* com.google.cloud.spring.secretmanager.SecretManagerTemplate} autoconfiguration and properties
* resolved.
*/
@ParameterizedTest
@MethodSource("prefixes")
void testConfigurationWhenDefaultSecretIsNotAllowed(String prefix) {
@Test
void testConfigurationWhenDefaultSecretIsNotAllowed() {
application.properties(
"spring.config.import=" + prefix)
"spring.config.import=sm://")
.addBootstrapRegistryInitializer(
(registry) -> registry.registerIfAbsent(
SecretManagerServiceClient.class,
Expand All @@ -88,18 +76,17 @@ void testConfigurationWhenDefaultSecretIsNotAllowed(String prefix) {
);
try (ConfigurableApplicationContext applicationContext = application.run()) {
ConfigurableEnvironment environment = applicationContext.getEnvironment();
assertThat(environment.getProperty(prefix + "my-secret")).isEqualTo("newSecret");
assertThatThrownBy(() -> environment.getProperty(prefix + "fake-secret"))
assertThat(environment.getProperty("sm://my-secret")).isEqualTo("newSecret");
assertThatThrownBy(() -> environment.getProperty("sm://fake-secret"))
.isExactlyInstanceOf(NotFoundException.class);
}
}

@ParameterizedTest
@MethodSource("prefixes")
void testConfigurationWhenDefaultSecretIsAllowed(String prefix) {
@Test
void testConfigurationWhenDefaultSecretIsAllowed() {
application.properties(
"spring.cloud.gcp.secretmanager.allow-default-secret=true",
"spring.config.import=" + prefix)
"spring.config.import=sm://")
.addBootstrapRegistryInitializer(
(registry) -> registry.registerIfAbsent(
SecretManagerServiceClient.class,
Expand All @@ -108,8 +95,8 @@ void testConfigurationWhenDefaultSecretIsAllowed(String prefix) {
);
try (ConfigurableApplicationContext applicationContext = application.run()) {
ConfigurableEnvironment environment = applicationContext.getEnvironment();
assertThat(environment.getProperty(prefix + "my-secret")).isEqualTo("newSecret");
assertThat(environment.getProperty(prefix + "fake-secret")).isNull();
assertThat(environment.getProperty("sm://my-secret")).isEqualTo("newSecret");
assertThat(environment.getProperty("sm://fake-secret")).isNull();
}
}
}
Loading

0 comments on commit 57f3a09

Please sign in to comment.