finos / legend-sdlc

Legend SDLC module
https://legend.finos.org
Apache License 2.0
38 stars 106 forks source link

Hardcoded dependency version for model pom.xml #305

Open aamend opened 2 years ago

aamend commented 2 years ago

Feature Request

Description of Problem:

When packaging legend model to gitlab, we generate a multi module maven project. The project is built using specific legend SDLC and legend engine dependencies where version is hardcoded in the legend SDLC code.

@see: https://github.com/finos/legend-sdlc/blob/master/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/project/ProjectStructureV11Factory.java#L81

@see: https://github.com/finos/legend-sdlc/blob/master/legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/project/ProjectStructureV11Factory.java#L87

        private static final String LEGEND_ENGINE_VERSION = "2.37.0";

As a consequence, model built on a specific version of the runtime would not benefit from the latest runtime features at compile time.

Potential Solutions:

Capture the version of dependencies used for SDLC server and inject those exact version to pom.xml generation. This could be done by creating an application.properties file where versions are injected at compile time

legend-sdlc-server/src/main/resources/legend.properties

org.finos.legend.sdlc       ${legend.sdlc.version}
org.finos.legend.engine     ${legend.engine.version}

legend-sdlc-server/pom.xml

        <resources>
            <resource>
                <directory>/</directory>
                <includes>
                    <include>legend.properties</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>

legend-sdlc-server/src/main/java/org/finos/legend/sdlc/server/project/ProjectStructureV11Factory.java

protected static String getEngineVersion() throws IOException
    {
        Properties properties = new Properties();
        properties.load(MavenProjectStructure.class.getResourceAsStream("/legend.properties"));
        return properties.getProperty("org.finos.legend.engine");
    }
MauricioUyaguari commented 2 years ago

Thanks for raising this issue.

Those legend engine/sdlc versions are actually placeholders. We leverage the maven version plugins to replace the legend sdlc/engine version with the latest released version before running the build on a workspace/release. See https://github.com/finos/legend-sdlc/blob/master/legend-sdlc-server/src/main/resources/org/finos/legend/sdlc/server/gitlab/finos/gitlab-ci-1.yml#L34

If we were to follow your suggestion, we would need to implement a way for users to update to the latest sdlc/engine version, since if a user creates a project at different times they would generate a project with different sdlc/engine versions.

aamend commented 2 years ago

Thanks! I did not know those were updated at compile time. Makes perfect sense. The problem I face is that I have a custom legend engine / pure this artifact depends on (see https://github.com/finos/legend-engine/pull/312). Until that PR is approved, I won't be able to get any CI/CD and must manually update version to compile pure model. Any chance you could help with those active PRs?