boozallen / aissemble

Booz Allen's lean manufacturing approach for holistically designing, developing and fielding AI solutions across the engineering lifecycle from data processing to model building, tuning, and training to secure operational deployment
Other
34 stars 8 forks source link

BUG: Delta Spark migrations fail for some YAML & POM files #442

Closed ewilkins-csi closed 3 weeks ago

ewilkins-csi commented 3 weeks ago

Description

The migration to update YAML files with the new delta-spark dependencies as part of the Java 17 upgrade does not gracefully handle YAML files that do not have maps/objects as their root. (I.e. a YAML file which is a list.)

Steps to Reproduce

  1. Create a new project from the 1.10.0-SNAPSHOT archetype
  2. Add a yaml file that is a list, e.g.:
    - name: test1
      desc: "A test item"
    - name: test2
      desc: "Another test item"
  3. Run the build: mvn clean install

Expected Behavior

The migration should simply skip the inapplicable YAML file and finish successfully.

Actual Behavior

The build fails at the root project.

Additional Context

Error:

Execution default of goal org.technologybrewery.baton:baton-maven-plugin:1.1.1:baton-migrate failed: Could not complete migrations!: class java.util.ArrayList cannot be cast to class java.util.Map (java.util.ArrayList and java.util.Map are in module java.base of loader 'bootstrap')

Stack trace:

Caused by: java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.util.Map (java.util.ArrayList and java.util.Map are in module java.base of loader 'bootstrap')
    at com.boozallen.aissemble.upgrade.util.YamlUtils.loadYaml (YamlUtils.java:46)
    at com.boozallen.aissemble.upgrade.migration.v1_10_0.DeltaSparkYamlMigration.shouldExecuteOnFile (DeltaSparkYamlMigration.java:38)
    at org.technologybrewery.baton.AbstractMigration.execute (AbstractMigration.java:73)
    at org.technologybrewery.baton.BatonMojo.performMigration (BatonMojo.java:226)
    at org.technologybrewery.baton.BatonMojo.execute (BatonMojo.java:180)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)

Definition of Done

Test Steps

  1. Create a new project from the 1.10.0-SNAPSHOT archetype
  2. Add a yaml file that is a list, e.g.:
    - name: test1
      desc: "A test item"
    - name: test2
      desc: "Another test item"
  3. Update the root pom.xml to remove the dependencyManagement section and add the following to the dependencies section:
        <dependency>
          <groupId>io.delta</groupId>
          <artifactId>delta-core_2.12</artifactId>
          <version>2.4.0</version>
        </dependency>
  4. Run the build: mvn clean install
  5. Validate that the build completes successfully
  6. Validate that the delta-core dependency has been updated to delta-spark in the root pom.xml
ewilkins-csi commented 3 weeks ago

OTS/DoD with @carter-cundiff

csun-cpointe commented 3 weeks ago

Test passed!!

Verified build success Screenshot 2024-10-28 at 3 43 15 PM

Verified delta-core dependency has been updated to delta-spark in the root pom.xml Screenshot 2024-10-28 at 3 43 57 PM