From 42fb40b2025408ffd4ae4d3a4d5576aa93cbb51d Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 12 Aug 2021 13:08:21 +0100 Subject: [PATCH] Upgrade to Flyway 7.13.0 Closes gh-27644 --- .../flyway/FlywayAutoConfiguration.java | 6 -- .../flyway/FlywayProperties.java | 69 ++++++++----------- ...itional-spring-configuration-metadata.json | 24 +++++++ .../Flyway5xAutoConfigurationTests.java | 7 +- .../flyway/FlywayAutoConfigurationTests.java | 26 ++----- .../flyway/FlywayPropertiesTests.java | 2 +- .../spring-boot-dependencies/build.gradle | 2 +- 7 files changed, 64 insertions(+), 72 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java index 8478007997b..19bcb9c01e9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java @@ -248,12 +248,6 @@ public class FlywayAutoConfiguration { // No method reference for compatibility with Flyway 6.x map.from(properties.getSkipExecutingMigrations()) .to((skipExecutingMigrations) -> configuration.skipExecutingMigrations(skipExecutingMigrations)); - // Teams secrets management properties (all non-method reference for - // compatibility with Flyway 6.x) - map.from(properties.getVaultUrl()).to((vaultUrl) -> configuration.vaultUrl(vaultUrl)); - map.from(properties.getVaultToken()).to((vaultToken) -> configuration.vaultToken(vaultToken)); - map.from(properties.getVaultSecrets()).whenNot(List::isEmpty) - .to((vaultSecrets) -> configuration.vaultSecrets(vaultSecrets.toArray(new String[0]))); // No method reference for compatibility with Flyway < 7.8 map.from(properties.getIgnoreMigrationPatterns()).whenNot(List::isEmpty) .to((ignoreMigrationPatterns) -> configuration diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java index 61087b52483..678c83a1cb7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java @@ -330,6 +330,12 @@ public class FlywayProperties { */ private String oracleKerberosConfigFile; + /** + * Location of the Oracle Wallet, used to sign-in to the database automatically. + * Requires Flyway Teams. + */ + private String oracleWalletLocation; + /** * Whether Flyway should output a table with the results of queries when executing * migrations. Requires Flyway Teams. @@ -342,24 +348,6 @@ public class FlywayProperties { */ private Boolean skipExecutingMigrations; - /** - * REST API URL of the Vault server. Requires Flyway teams. - */ - private String vaultUrl; - - /** - * Vault token required to access secrets. Requires Flyway teams. - */ - private String vaultToken; - - /** - * Comma-separated list of paths to secrets that contain Flyway configurations. This - * must start with the name of the engine followed by '/data/' and end with the name - * of the secret. The resulting form is '{engine}/data/{path}/{to}/{secret_name}'. - * Requires Flyway teams. - */ - private List vaultSecrets; - /** * Ignore migrations that match this comma-separated list of patterns when validating * migrations. Requires Flyway Teams. @@ -372,6 +360,11 @@ public class FlywayProperties { */ private Boolean detectEncoding; + /** + * Filename prefix of state scripts. Requires Flyway Teams. + */ + private String stateScriptPrefix; + public boolean isEnabled() { return this.enabled; } @@ -779,6 +772,14 @@ public class FlywayProperties { this.oracleSqlplusWarn = oracleSqlplusWarn; } + public String getOracleWalletLocation() { + return this.oracleWalletLocation; + } + + public void setOracleWalletLocation(String oracleWalletLocation) { + this.oracleWalletLocation = oracleWalletLocation; + } + public Boolean getStream() { return this.stream; } @@ -843,30 +844,6 @@ public class FlywayProperties { this.skipExecutingMigrations = skipExecutingMigrations; } - public String getVaultUrl() { - return this.vaultUrl; - } - - public void setVaultUrl(String vaultUrl) { - this.vaultUrl = vaultUrl; - } - - public String getVaultToken() { - return this.vaultToken; - } - - public void setVaultToken(String vaultToken) { - this.vaultToken = vaultToken; - } - - public List getVaultSecrets() { - return this.vaultSecrets; - } - - public void setVaultSecrets(List vaultSecrets) { - this.vaultSecrets = vaultSecrets; - } - public List getIgnoreMigrationPatterns() { return this.ignoreMigrationPatterns; } @@ -883,4 +860,12 @@ public class FlywayProperties { this.detectEncoding = detectEncoding; } + public String getStateScriptPrefix() { + return this.stateScriptPrefix; + } + + public void setStateScriptPrefix(String stateScriptPrefix) { + this.stateScriptPrefix = stateScriptPrefix; + } + } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 3071ca7eae9..2f90edada6a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -910,6 +910,30 @@ "reason": "Flyway pro edition only." } }, + { + "name": "spring.flyway.vault-secrets", + "type": "java.util.List", + "deprecation": { + "level": "error", + "reason": "Removed in the open source release of Flyway 7.12." + } + }, + { + "name": "spring.flyway.vault-token", + "type": "java.lang.String", + "deprecation": { + "level": "error", + "reason": "Removed in the open source release of Flyway 7.12." + } + }, + { + "name": "spring.flyway.vault-url", + "type": "java.lang.String", + "deprecation": { + "level": "error", + "reason": "Removed in the open source release of Flyway 7.12." + } + }, { "name": "spring.freemarker.prefix", "defaultValue": "" diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/Flyway5xAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/Flyway5xAutoConfigurationTests.java index a32ef4d16ed..9c6a5548cc1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/Flyway5xAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/Flyway5xAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -116,6 +116,11 @@ class Flyway5xAutoConfigurationTests { } + @Override + public boolean isStateScript() { + return false; + } + } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java index 7be7627cb46..c500128dd45 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java @@ -629,27 +629,6 @@ class FlywayAutoConfigurationTests { .run(validateFlywayTeamsPropertyOnly("skipExecutingMigrations")); } - @Test - void vaultUrlIsCorrectlyMapped() { - this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) - .withPropertyValues("spring.flyway.vault-url=https://example.com/secrets") - .run(validateFlywayTeamsPropertyOnly("vaultUrl")); - } - - @Test - void vaultTokenIsCorrectlyMapped() { - this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) - .withPropertyValues("spring.flyway.vault-token=5150") - .run(validateFlywayTeamsPropertyOnly("vaultToken")); - } - - @Test - void vaultSecretsIsCorrectlyMapped() { - this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) - .withPropertyValues("spring.flyway.vault-secrets=kv/data/test/1/config,kv/data/test/2/config") - .run(validateFlywayTeamsPropertyOnly("vaultSecrets")); - } - @Test void whenFlywayIsAutoConfiguredThenJooqDslContextDependsOnFlywayBeans() { this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class, JooqConfiguration.class) @@ -1028,6 +1007,11 @@ class FlywayAutoConfigurationTests { } + @Override + public boolean isStateScript() { + return false; + } + } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayPropertiesTests.java index 60d00403b14..e43052170a5 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayPropertiesTests.java @@ -108,7 +108,7 @@ class FlywayPropertiesTests { ignoreProperties(configuration, "callbacks", "classLoader", "dataSource", "javaMigrations", "javaMigrationClassProvider", "resourceProvider", "resolvers"); // Properties we don't want to expose - ignoreProperties(configuration, "resolversAsClassNames", "callbacksAsClassNames"); + ignoreProperties(configuration, "resolversAsClassNames", "callbacksAsClassNames", "apiExtensions"); // Handled by the conversion service ignoreProperties(configuration, "baselineVersionAsString", "encodingAsString", "locationsAsStrings", "targetAsString"); diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index f435ee80943..75a1f642ad4 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -309,7 +309,7 @@ bom { ] } } - library("Flyway", "7.11.2") { + library("Flyway", "7.13.0") { group("org.flywaydb") { modules = [ "flyway-core"