opensearch-project / opensearch-sdk-java

OpenSearch SDK to build and run extensions
Apache License 2.0
28 stars 58 forks source link

[BUG] 1.x doesn't build against latest 2.x snapshot #924

Open dbwiddis opened 1 year ago

dbwiddis commented 1 year ago

What is the bug?

OpenSearch version check logic on 1.x branch is impossible to meet both cases.

main branch:

buildscript {
    ext {
        opensearch_version = System.getProperty("opensearch.version", "3.0.0-SNAPSHOT")
        isSnapshot = "true" == System.getProperty("build.snapshot", "true")
        buildVersionQualifier = System.getProperty("build.version_qualifier", "")
    }

1.x branch:

buildscript {
    ext {
        opensearch_version = System.getProperty("opensearch.version", "2.9.0")
        isSnapshot = "true" == System.getProperty("build.snapshot", "true")
        if (isSnapshot) {
            opensearch_version += "-SNAPSHOT"
        }
        buildVersionQualifier = System.getProperty("build.version_qualifier", "")
    }

The released version is always a version behind the snapshot version (for example, 2.9.0 is released, 2.10.0-SNAPSHOT is latest).

How can one reproduce the bug?

Run a github action requiring 2.10.0 changes: it fails with current code (above) but if we just change version to 2.10.0, then there is no such release that it will ever build against (until the 2.10.0 release, at which time we'll have 2.11.0-SNAPSHOT).

What is the expected behavior?

1.x actions build against the latest snapshot version

Do you have any additional context?

See for example https://github.com/opensearch-project/opensearch-sdk-java/actions/runs/5741412861/job/15561744611?pr=920

I believe there are version options such as "2+" that will get the latest 2.x version, and that can be filtered to allow or exclude snapshots.

dbwiddis commented 1 year ago

We should change version to 2.+ to get the "latest" 2.x version. This will include snapshots.

When we don't want snapshots we can use Component Selection rules to reject the snapshots: https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.ComponentSelectionRules.html