Skip to content

Commit

Permalink
#176 remove FileUtils, MigrationUtils in prep for Baton release
Browse files Browse the repository at this point in the history
  • Loading branch information
cpointe-ibllanos committed Jun 28, 2024
1 parent 72319a1 commit bcd0e80
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 268 deletions.
2 changes: 1 addition & 1 deletion build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<version.hadoop>3.3.4</version.hadoop>
<version.neo4j>4.1.5_for_spark_3</version.neo4j>
<version.aws.sdk.bundle>1.12.262</version.aws.sdk.bundle>
<version.baton>1.0.0</version.baton>
<version.baton>1.1.0-SNAPSHOT</version.baton>
<version.quarkus.cucumber>0.6.0</version.quarkus.cucumber>
<version.quarkus.cucumber.java>7.4.1</version.quarkus.cucumber.java>

Expand Down
7 changes: 1 addition & 6 deletions foundation/foundation-upgrade/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<dependency>
<groupId>org.technologybrewery.baton</groupId>
<artifactId>baton-maven-plugin</artifactId>
<version>0.2.0</version>
<version>${version.baton}</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
Expand All @@ -56,11 +56,6 @@
<artifactId>toml</artifactId>
<version>3.6.6</version>
</dependency>
<dependency>
<groupId>com.vdurmont</groupId>
<artifactId>semver4j</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* #L%
*/

import com.boozallen.aissemble.upgrade.util.FileUtils;
import org.technologybrewery.baton.util.FileUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -20,7 +20,7 @@
import java.io.IOException;
import java.util.List;

import static com.boozallen.aissemble.upgrade.util.FileUtils.getRegExCaptureGroups;
import static org.technologybrewery.baton.util.FileUtils.getRegExCaptureGroups;

/**
* Baton migration used to migrate the Helm Chart names and/or Helm module names in the Chart.yaml and values.yaml files within a project's deploy folder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* #L%
*/

import com.boozallen.aissemble.upgrade.util.FileUtils;
import org.technologybrewery.baton.util.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.technologybrewery.baton.BatonException;
import org.technologybrewery.baton.util.FileUtils;

import com.boozallen.aissemble.upgrade.util.FileUtils;
import com.boozallen.aissemble.upgrade.util.PythonPackageMigration;
import com.electronwill.nightconfig.core.Config;
import com.electronwill.nightconfig.core.file.FileConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
* #L%
*/

import com.boozallen.aissemble.upgrade.util.FileUtils;
import com.boozallen.aissemble.upgrade.util.MigrationUtils;
import org.technologybrewery.baton.util.FileUtils;
import org.technologybrewery.baton.util.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import static com.boozallen.aissemble.upgrade.util.FileUtils.getRegExCaptureGroups;
import static org.technologybrewery.baton.util.FileUtils.getRegExCaptureGroups;

public class HelmChartsV1Migration extends AbstractAissembleMigration {
public static final Logger logger = LoggerFactory.getLogger(HelmChartsV1Migration.class);
Expand All @@ -38,10 +38,10 @@ protected boolean shouldExecuteOnFile(File file) {
mavenAissembleVersion = getAissembleVersion();

if (mavenAissembleVersion != null) {
ArrayList<String> chartAissembleVersions = getRegExCaptureGroups(extractVersionRegex, file);
List<String> chartAissembleVersions = getRegExCaptureGroups(extractVersionRegex, file);
if (!chartAissembleVersions.isEmpty())
shouldExecute = chartAissembleVersions.stream().anyMatch(chartVersion ->
MigrationUtils.isLessThanVersion(chartVersion, mavenAissembleVersion)
CommonUtils.isLessThanVersion(chartVersion, mavenAissembleVersion)
);
} else {
logger.error("Unable to parse version from current project");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
* #L%
*/

import com.boozallen.aissemble.upgrade.util.FileUtils;
import com.boozallen.aissemble.upgrade.util.MigrationUtils;
import org.technologybrewery.baton.util.FileUtils;
import org.technologybrewery.baton.util.CommonUtils;
import static org.technologybrewery.baton.util.CommonUtils.isLessThanVersion;
import com.google.common.io.Files;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
Expand All @@ -24,7 +25,6 @@
import java.util.HashMap;
import java.util.List;

import static com.boozallen.aissemble.upgrade.util.MigrationUtils.isLessThanVersion;

public class HelmChartsV2Migration extends AbstractAissembleMigration {
public static final Logger logger = LoggerFactory.getLogger(HelmChartsV2Migration.class);
Expand Down Expand Up @@ -125,13 +125,13 @@ private static void writeNewFile(File file, ArrayList<String> newFileContents) t

private String upgradeVersionInString(String line) {
String newLine;
ArrayList<String> captureGroups = FileUtils.getRegExCaptureGroups(
List<String> captureGroups = FileUtils.getRegExCaptureGroups(
VERSION_APP_VERSION_REPLACE_REGEX,
line
);
String currentVersion = getAissembleVersion();
String oldVersion = captureGroups.get(1).replaceAll("['|\"]", "").trim();
String newVersion = MigrationUtils.isLessThanVersion(oldVersion, currentVersion) ? currentVersion : oldVersion;
String newVersion = CommonUtils.isLessThanVersion(oldVersion, currentVersion) ? currentVersion : oldVersion;
newLine = captureGroups.get(0) + "\"" + newVersion + "\"";
return StringUtils.appendIfMissing(newLine,"\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
*/

import com.boozallen.aissemble.upgrade.util.TiltfileUtil;
import static org.technologybrewery.baton.util.FileUtils.replaceInFile;
import static org.technologybrewery.baton.util.CommonUtils.isLessThanVersion;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -20,8 +22,6 @@
import java.io.FileReader;
import java.io.IOException;

import static com.boozallen.aissemble.upgrade.util.MigrationUtils.isLessThanVersion;
import static com.boozallen.aissemble.upgrade.util.FileUtils.replaceInFile;

public class TiltfileMigration extends AbstractAissembleMigration {
public static final String VERSION_REGEX = "(aissemble_version = *['\"])(\\d+\\.\\d+\\.\\d+(?:[\\.\\-\\d+a-zA-Z]*))(['\"])";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.io.IOException;
import java.util.Map;

import static com.boozallen.aissemble.upgrade.util.FileUtils.replaceLiteralInFile;
import static org.technologybrewery.baton.util.FileUtils.replaceLiteralInFile;

/**
Baton migration class to verify whether a migration to the Policy Decision Point (Python) module files is required from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import java.util.Map;

import static com.boozallen.aissemble.upgrade.util.FileUtils.replaceLiteralInFile;
import static org.technologybrewery.baton.util.FileUtils.replaceLiteralInFile;

/**
Baton migration class to verify whether a migration to the python file packages are required from the aiops reference removal from the
Expand Down

This file was deleted.

Loading

0 comments on commit bcd0e80

Please sign in to comment.