Skip to content

Commit

Permalink
Bump version to flyway-10.17.2
Browse files Browse the repository at this point in the history
Please see the GH release for the release notes
  • Loading branch information
rg-buildmonkey committed Aug 22, 2024
1 parent dc6caeb commit 68538a6
Show file tree
Hide file tree
Showing 83 changed files with 1,398 additions and 428 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ subtitle: Check Code Concept

## Overview

The `-code` flag produces a report showing the results of running static code analysis over your SQL migrations.
The `-code` flag produces a report showing the results of running static code analysis over your SQL migrations from `filesystem:` [Locations](<Configuration/Parameters/Flyway/Locations>).

Rules that Flyway comes supplied with can be found in: [Code Analysis Rules](<Usage/Code Analysis Rules>)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
pill: id
subtitle: flyway.id
redirect_from: Configuration/id/
---

# Id

## Description

An optional unique GUID id generated by you for your pipeline in Flyway Pipelines. Used at the top level of your
configuration file. Hashed together with your user id to create a [`pipeline id`](configuration/parameters/flyway/pipeline_id).
Also used by Flyway Desktop to identify projects. See the Flyway Pipelines documentation [here](https://red-gate.com/flyway/pipelines/documentation).

## Usage

### TOML
```properties
id = "c96f6ff1-ecb9-4019-9046-c21caf895764"
```
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,9 @@ This configuration parameter will only be used in the command line version of Fl
./flyway -jarDirs="/my/jar/dir1,/my/jar/dir2" info
```

To configure a named environment via command line when using a TOML configuration, prefix `jarDirs` with `environments.{environment name}.` for example:
```powershell
./flyway "-environments.sample.jarDirs=/my/jar/dir1,/my/jar/dir2" info
```

### TOML Configuration File
```toml
[environments.default]
[flyway]
jarDirs = ["/my/jar/dir1", "/my/jar/dir2"]
```

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
pill: name
subtitle: flyway.name
redirect_from: Configuration/name/
---

# Name

## Description

An optional name for your pipeline in Flyway Pipelines. Used at the top level of your configuration file to tell Flyway
Pipelines what the display name of your pipeline is. Also used by Flyway Desktop as the display name for projects.
See the Flyway Pipelines documentation [here](https://red-gate.com/flyway/pipelines/documentation).

## Usage

### TOML
```properties
name = "My Flyway Pipeline"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
pill: pipeline_id
subtitle: flyway.pipeline_id
redirect_from: Configuration/pipeline_id/
---

# Pipeline Id

## Description

An id for identifying your pipeline in Flyway Pipelines. Used to tell Flyway which pipeline in Flyway Pipelines to send
data to. Pipeline Ids are copyable from within Flyway Pipelines for use as the value to this parameter. See the Flyway
Pipelines documentation [here](https://red-gate.com/flyway/pipelines/documentation).

## Usage

### Commandline
```bash
./flyway -pipelineId="0E305365CCA981B68883AB6F81629B9D"
```

### TOML
```properties
[flyway]
pipelineId = "0E305365CCA981B68883AB6F81629B9D"
```

### Environment Variable
```properties
FLYWAY_PIPELINE_ID=0E305365CCA981B68883AB6F81629B9D
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
pill: publish_result
subtitle: flyway.publish_result
redirect_from: Configuration/publish_result/
---

# Publish Result

## Description

A boolean value that tells Flyway whether or not to publish the result of your Flyway run to Flyway Pipelines. Set
to false by default. See the Flyway Pipelines documentation [here](https://red-gate.com/flyway/pipelines/documentation).

## Usage

### Commandline
```bash
./flyway -publishResult=true
```

### TOML
```properties
[flyway]
publishResult = true
```

### Environment Variable
```properties
FLYWAY_PUBLISH_RESULT=true
```
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ Assume we have the following two secrets in Dapr:
- `secret2` which contains `flyway.user=sa`

In order to read these secrets you need to configure just the following Flyway parameters:
- [flyway.plugins.dapr.url](Configuration/Parameters/Flyway/Dapr URL) - This is the REST API URL of your Dapr sidecar application e.g. `http://localhost:3500/v1.0/secrets/my-secrets-store`
- [flyway.plugins.dapr.secrets](configuration/parameters/Flyway/dapr-secrets) - This is a comma-separated list of paths to secrets that contain Flyway configurations. In our case we would set `flyway.plugins.dapr.secrets=secret1,secret2`
- [flyway.dapr.url](Configuration/Parameters/Flyway/Dapr URL) - This is the REST API URL of your Dapr sidecar application e.g. `http://localhost:3500/v1.0/secrets/my-secrets-store`
- [flyway.dapr.secrets](configuration/parameters/Flyway/dapr-secrets) - This is a comma-separated list of paths to secrets that contain Flyway configurations. In our case we would set `flyway.dapr.secrets=secret1,secret2`

After configuring the above parameters, we would be able to connect to a database in Flyway without configuring a database connection locally, as all the necessary configuration would be read from Dapr.

Expand All @@ -86,8 +86,8 @@ Assume we have the following two secrets in GCSM:
- `secret2` which contains `flyway.user=sa`

In order to read these secrets you need to configure just the following Flyway parameters:
- [flyway.plugins.gcsm.project](Configuration/Parameters/Flyway/Google Cloud Secret Manager Project) - This is the name of your GCSM project e.g. `quixotic-ferret-345678`
- [flyway.plugins.gcsm.secrets](Configuration/Parameters/Flyway/Google Cloud Secret Manager Secrets) - This is a comma-separated list of paths to secrets that contain Flyway configurations. In our case we would set `flyway.plugins.gcsm.secrets=secret1,secret2`
- [flyway.gcsm.project](Configuration/Parameters/Flyway/Google Cloud Secret Manager Project) - This is the name of your GCSM project e.g. `quixotic-ferret-345678`
- [flyway.gcsm.secrets](Configuration/Parameters/Flyway/Google Cloud Secret Manager Secrets) - This is a comma-separated list of paths to secrets that contain Flyway configurations. In our case we would set `flyway.gcsm.secrets=secret1,secret2`

After configuring the above parameters, we would be able to connect to a database in Flyway without configuring a database connection locally, as all the necessary configuration would be read from GCSM.

Expand All @@ -104,8 +104,8 @@ Assume we have the following two secrets in Vault:
- `test/2/config` which contains `flyway.user=sa` and uses key-value engine V2

In order to read these secrets you need to configure just the following Flyway parameters:
- [flyway.plugins.vault.url](Configuration/Parameters/Flyway/Vault Url) - This is the REST API URL of your Vault server e.g. `http://localhost:8200/v1/`
- [flyway.plugins.vault.token](Configuration/Parameters/Flyway/Vault Token) - This is the Vault token required to access your secrets e.g. `s.abcdefghijklmnopqrstuvwx`
- [flyway.plugins.vault.secrets](Configuration/Parameters/Flyway/Vault Secrets) - This is a comma-separated list of paths to secrets that contain Flyway configurations. This must start with the name of the engine and end with the name of the secret. In our case we would set `flyway.plugins.vault.secrets=kv/test/1/config,kv/data/test/2/config`
- [flyway.vault.url](Configuration/Parameters/Flyway/Vault Url) - This is the REST API URL of your Vault server e.g. `http://localhost:8200/v1/`
- [flyway.vault.token](Configuration/Parameters/Flyway/Vault Token) - This is the Vault token required to access your secrets e.g. `s.abcdefghijklmnopqrstuvwx`
- [flyway.vault.secrets](Configuration/Parameters/Flyway/Vault Secrets) - This is a comma-separated list of paths to secrets that contain Flyway configurations. This must start with the name of the engine and end with the name of the secret. In our case we would set `flyway.vault.secrets=kv/test/1/config,kv/data/test/2/config`

After configuring the above parameters, we would be able to connect to a database in Flyway without configuring a database connection locally, as all the necessary configuration would be read from Vault.
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ This is the REST API URL of your Vault server, and should include the API versio
_Note: Flyway currently only supports API version v1_

If you are using a [Vault dev server](https://learn.hashicorp.com/tutorials/vault/getting-started-dev-server) then an example of what configuring this in Flyway may look like is:<br/>
`flyway.plugins.vault.url=http://localhost:8200/v1/`
`flyway.vault.url=http://localhost:8200/v1/`

### [`vault.token`](Configuration/Parameters/Flyway/Vault Token)

This is the token required to access your secrets. You can read about generating tokens [here](https://www.vaultproject.io/docs/commands/token/create), including how to add a lifetime to your token in order to control the duration of its validity.

If we have a token `<vault_token>` then configuring this parameter involves adding the following to our Flyway configuration:<br/>
`flyway.plugins.vault.token=<vault_token>`
`flyway.vault.token=<vault_token>`

### [`vault.secrets`](Configuration/Parameters/Flyway/Vault Secrets)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
</div>
<div class="col-md-9">

<div class="release">
<h2 id="10.17.2">Flyway 10.17.2 (2024-08-22)</h2>

<h3>Bug fixes</h3>
<ul>
<li>Fixed the issue that Flyway errors when running 'check -code' with 'classpath' locations</li>
<li>Fixed the issue where the classpath could not be resolved when running the 'check' command</li>
</ul>

</div>

<div class="release">
<h2 id="10.17.1">Flyway 10.17.1 (2024-08-13)</h2>

Expand Down
2 changes: 1 addition & 1 deletion documentation/_config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
flywayVersion: 10.17.1
flywayVersion: 10.17.2
enterpriseUrl: https://download.red-gate.com/maven/release/com/redgate/flyway
kramdown:
smart_quotes: ["apos", "apos", "quot", "quot"]
Expand Down
9 changes: 8 additions & 1 deletion flyway-commandline/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-parent</artifactId>
<version>10.17.1</version>
<version>10.17.2</version>
</parent>
<artifactId>flyway-commandline</artifactId>
<packaging>jar</packaging>
Expand Down Expand Up @@ -463,6 +463,7 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${version.gson}</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
Expand Down Expand Up @@ -569,6 +570,12 @@












Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import lombok.SneakyThrows;
Expand All @@ -54,6 +55,7 @@
import org.flywaydb.core.api.output.ErrorOutput;
import org.flywaydb.core.api.output.HtmlResult;
import org.flywaydb.core.api.output.InfoResult;
import org.flywaydb.core.api.output.MigrateResult;
import org.flywaydb.core.api.output.OperationResult;
import org.flywaydb.core.extensibility.CommandExtension;
import org.flywaydb.core.extensibility.EventTelemetryModel;
Expand Down Expand Up @@ -126,6 +128,11 @@ public static void main(String[] args) throws Exception {
reportDetails = resultReportGenerator.generateReport(result, configuration, executionTime);
}

if (configuration.getPluginRegister().getPlugin(PublishingConfigurationExtension.class).isPublishResult()) {
publishOperationResult(configuration, result);
publishReport(configuration, reportDetails);
}

if (commandLineArguments.shouldOutputJson()) {
printJson(commandLineArguments, result, reportDetails);
}
Expand Down Expand Up @@ -341,10 +348,6 @@ private static OperationResult executeOperation(final Flyway flyway,
telemetryManager);
}

if (configuration.getPluginRegister().getPlugin(PublishingConfigurationExtension.class).isPublishResult()) {
publishOperationResult(configuration, result);
}

return result;
}

Expand All @@ -356,6 +359,15 @@ private static void publishOperationResult(final Configuration configuration, fi
}
}

private static void publishReport(final Configuration configuration, final ReportDetails reportDetails) {
final List<OperationResultPublisher> publishers = configuration.getPluginRegister().getPlugins(
OperationResultPublisher.class);

for (final OperationResultPublisher publisher : publishers) {
publisher.publishReport(configuration, reportDetails);
}
}

private static MigrationFilterImpl getInfoFilter(final CommandLineArguments commandLineArguments) {
return new MigrationFilterImpl(commandLineArguments.getInfoSinceDate(),
commandLineArguments.getInfoUntilDate(),
Expand Down Expand Up @@ -435,7 +447,13 @@ private static void printUsage(final Boolean fullVersion) {
LOG.info(indent + StringUtils.rightPad("validate", padSize, ' ') + "Validates the applied migrations against the ones on the classpath");
LOG.info(indent + StringUtils.rightPad("baseline", padSize, ' ') + "Baselines an existing database at the baselineVersion");
LOG.info(indent + StringUtils.rightPad("repair", padSize, ' ') + "Repairs the schema history table");
usages.forEach(u -> LOG.info(indent + StringUtils.rightPad(u.getLeft(), padSize, ' ') + u.getRight()));
for (final Pair<String, String> usage : usages) {
final List<String> lines = Arrays.stream(usage.getRight().split("\n")).map(String::trim).toList();
LOG.info(indent + StringUtils.rightPad(usage.getLeft(), padSize, ' ') + lines.get(0));
for (int i = 1; i < lines.size(); i++) {
LOG.info(indent + " ".repeat(padSize) + lines.get(i));
}
}
LOG.info("");
LOG.info("Configuration parameters (Format: -key=value)");
LOG.info(indent + "driver Fully qualified classname of the JDBC driver");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public Configuration getConfiguration(CommandLineArguments commandLineArguments)

ClassLoader classLoader = buildClassLoaderBasedOnJarDirs(Thread.currentThread().getContextClassLoader(), config);

ConfigUtils.dumpConfigurationMap(config);
ConfigUtils.dumpConfigurationMap(config, "Using configuration:");
filterProperties(config);

final FluentConfiguration configuration = new FluentConfiguration(classLoader).configuration(config).workingDirectory(workingDirectory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

import static org.flywaydb.core.internal.configuration.ConfigUtils.DEFAULT_CLI_JARS_LOCATION;
import static org.flywaydb.core.internal.configuration.ConfigUtils.DEFAULT_CLI_SQL_LOCATION;
import static org.flywaydb.core.internal.configuration.ConfigUtils.dumpEnvironmentModel;
import static org.flywaydb.core.internal.configuration.ConfigUtils.makeRelativeJarDirsBasedOnWorkingDirectory;
import static org.flywaydb.core.internal.configuration.ConfigUtils.makeRelativeJarDirsInEnvironmentsBasedOnWorkingDirectory;
import static org.flywaydb.core.internal.configuration.ConfigUtils.makeRelativeLocationsBasedOnWorkingDirectory;
Expand Down Expand Up @@ -81,8 +82,21 @@ public Configuration getConfiguration(CommandLineArguments commandLineArguments)
ConfigurationModel commandLineArgumentsModel = TomlUtils.loadConfigurationFromCommandlineArgs(
commandLineArguments.getConfiguration(true));
ConfigurationModel environmentVariablesModel = TomlUtils.loadConfigurationFromEnvironment();
config = config.merge(environmentVariablesModel)
.merge(commandLineArgumentsModel);

if (ConfigUtils.detectNullConfigModel(environmentVariablesModel)) {
LOG.debug("Skipping empty environment variables");
} else {
ConfigUtils.dumpConfigurationModel(environmentVariablesModel, "Loading configuration from environment variables:");
config = config.merge(environmentVariablesModel);
}

if (ConfigUtils.detectNullConfigModel(commandLineArgumentsModel)) {
LOG.debug("No flyway namespace variables found in command line");
} else {
ConfigUtils.dumpConfigurationModel(commandLineArgumentsModel, "Loading configuration from command line arguments:");
config = config.merge(commandLineArgumentsModel);
}


if (commandLineArgumentsModel.getEnvironments().containsKey(ClassicConfiguration.TEMP_ENVIRONMENT_NAME) ||
environmentVariablesModel.getEnvironments().containsKey(ClassicConfiguration.TEMP_ENVIRONMENT_NAME)) {
Expand All @@ -105,6 +119,7 @@ public Configuration getConfiguration(CommandLineArguments commandLineArguments)
}

if (mergedModel != null) {
LOG.debug("Merged " + ClassicConfiguration.TEMP_ENVIRONMENT_NAME + " into the " + config.getFlyway().getEnvironment() + " environment");
config.getEnvironments().put(config.getFlyway().getEnvironment(), mergedModel);
}

Expand Down Expand Up @@ -139,6 +154,7 @@ public Configuration getConfiguration(CommandLineArguments commandLineArguments)
flywayEnvironmentModelArguments).getFlyway()));

EnvironmentModel env = objectMapper.convertValue(envValueObject, EnvironmentModel.class);
dumpEnvironmentModel(env, envKey, "Loading environment configuration from command line:");

if (config.getEnvironments().containsKey(envKey)) {
env = config.getEnvironments().get(envKey).merge(env);
Expand Down Expand Up @@ -167,7 +183,7 @@ public Configuration getConfiguration(CommandLineArguments commandLineArguments)
makeRelativeJarDirsInEnvironmentsBasedOnWorkingDirectory(workingDirectory, config.getEnvironments());
}

ConfigUtils.dumpConfigurationModel(config);
ConfigUtils.dumpConfigurationModel(config, "Using configuration:");
ClassicConfiguration cfg = new ClassicConfiguration(config);

cfg.setWorkingDirectory(workingDirectory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,13 @@ public static RootTelemetryModel populateRootTelemetry(RootTelemetryModel rootTe

if (configuration != null) {
ConfigurationModel modernConfig = configuration.getModernConfig();
if (modernConfig != null && StringUtils.hasText(modernConfig.getId())) {
rootTelemetryModel.setProjectId(EncryptionUtils.hashString(modernConfig.getId(), "fur"));
if (modernConfig != null) {
if (StringUtils.hasText(modernConfig.getId())) {
rootTelemetryModel.setProjectId(EncryptionUtils.hashString(modernConfig.getId(), "fur"));
}
boolean resolversPresent = !(modernConfig.getFlyway().getMigrationResolvers() == null || modernConfig.getFlyway().getMigrationResolvers().isEmpty());
rootTelemetryModel.setCustomMigrationResolver(resolversPresent);

}

rootTelemetryModel.setSecretsManagementType(getSecretsManagementType(configuration));
Expand Down
Loading

0 comments on commit 68538a6

Please sign in to comment.