diff --git a/.github/workflows/test_bwc.yml b/.github/workflows/test_bwc.yml index 3f113f177..b5f2e2d16 100644 --- a/.github/workflows/test_bwc.yml +++ b/.github/workflows/test_bwc.yml @@ -3,20 +3,12 @@ on: push: branches: - "**" - - "!main" pull_request: branches: - "**" - - "!main" jobs: - Get-CI-Image-Tag: - uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main - with: - product: opensearch - - Build-ad-linux: - needs: Get-CI-Image-Tag + Build-ff-linux: strategy: matrix: java: [11,17,21] @@ -24,38 +16,30 @@ jobs: name: Test Flow Framework BWC runs-on: ubuntu-latest - container: - # using the same image which is used by opensearch-build team to build the OpenSearch Distribution - # this image tag is subject to change as more dependencies and updates will arrive over time - image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }} - # need to switch to root so that github actions can install runner binary on container without permission issues. - options: --user root steps: - name: Setup Java ${{ matrix.java }} - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: ${{ matrix.java }} - name: Checkout Flow Framework - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Assemble flow-framework + - name: Assemble Flow Framework run: | plugin_version=`./gradlew properties -q | grep "opensearch_build:" | awk '{print $2}'` - chown -R 1000:1000 `pwd` echo plugin_version $plugin_version - su `id -un 1000` -c "./gradlew assemble" + ./gradlew assemble echo "Creating ./src/test/resources/org/opensearch/flowframework/bwc/flow-framework/$plugin_version ..." - su `id -un 1000` -c "mkdir -p ./src/test/resources/org/opensearch/flowframework/bwc/flow-framework/$plugin_version" + mkdir -p ./src/test/resources/org/opensearch/flowframework/bwc/flow-framework/$plugin_version echo "Copying ./build/distributions/*.zip to ./src/test/resources/org/opensearch/flowframework/bwc/flow-framework/$plugin_version ..." ls ./build/distributions/ - su `id -un 1000` -c "cp ./build/distributions/*.zip ./src/test/resources/org/opensearch/flowframework/bwc/flow-framework/$plugin_version" + cp ./build/distributions/*.zip ./src/test/resources/org/opensearch/flowframework/bwc/flow-framework/$plugin_version echo "Copied ./build/distributions/*.zip to ./src/test/resources/org/opensearch/flowframework/bwc/flow-framework/$plugin_version ..." ls ./src/test/resources/org/opensearch/flowframework/bwc/flow-framework/$plugin_version - name: Run Flow Framework Backwards Compatibility Tests run: | echo "Running backwards compatibility tests ..." - chown -R 1000:1000 `pwd` - su `id -un 1000` -c "./gradlew bwcTestSuite -Dtests.security.manager=false" + ./gradlew bwcTestSuite -Dtests.security.manager=false diff --git a/build.gradle b/build.gradle index b78e4c172..b840d4f51 100644 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,7 @@ import java.nio.file.Paths buildscript { ext { opensearch_version = System.getProperty("opensearch.version", "3.0.0-SNAPSHOT") + bwcVersionShort = "2.12.0" buildVersionQualifier = System.getProperty("build.version_qualifier", "") isSnapshot = "true" == System.getProperty("build.snapshot", "true") version_tokens = opensearch_version.tokenize('-') @@ -32,6 +33,9 @@ buildscript { baseName = "ffBwcCluster" bwcFilePath = "src/test/resources/org/opensearch/flowframework/bwc/" bwcFlowFrameworkPath = bwcFilePath + "flowframework/" + + opensearch_major_version = opensearch_version.split("\\.")[0] + bwc_major_version = bwcVersionShort.split("\\.")[0] } repositories { @@ -518,13 +522,18 @@ List> plugins = [ // This results in a mixed cluster with 2 nodes on the old version and 1 upgraded node. // This is also used as a one third upgraded cluster for a rolling upgrade. task "${baseName}#mixedClusterTask"(type: StandaloneRestIntegTestTask) { - useCluster testClusters."${baseName}0" dependsOn "${baseName}#oldVersionClusterTask0" - doFirst { - testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins) - } - filter { + useCluster testClusters."${baseName}0" + // Only do mixed cluster tasks on same major version + if (bwc_major_version != opensearch_major_version) { + ignoreFailures = true + } else { + doFirst { + testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins) + } + filter { includeTestsMatching "org.opensearch.flowframework.bwc.*IT" + } } systemProperty 'tests.rest.bwcsuite', 'mixed_cluster' systemProperty 'tests.rest.bwcsuite_round', 'first' @@ -539,11 +548,16 @@ task "${baseName}#mixedClusterTask"(type: StandaloneRestIntegTestTask) { task "${baseName}#twoThirdsUpgradedClusterTask"(type: StandaloneRestIntegTestTask) { dependsOn "${baseName}#mixedClusterTask" useCluster testClusters."${baseName}0" - doFirst { - testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins) - } - filter { + // Only do mixed cluster tasks on same major version + if (bwc_major_version != opensearch_major_version) { + ignoreFailures = true + } else { + doFirst { + testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins) + } + filter { includeTestsMatching "org.opensearch.flowframework.bwc.*IT" + } } systemProperty 'tests.rest.bwcsuite', 'mixed_cluster' systemProperty 'tests.rest.bwcsuite_round', 'second' @@ -558,11 +572,16 @@ task "${baseName}#twoThirdsUpgradedClusterTask"(type: StandaloneRestIntegTestTas task "${baseName}#rollingUpgradeClusterTask"(type: StandaloneRestIntegTestTask) { dependsOn "${baseName}#twoThirdsUpgradedClusterTask" useCluster testClusters."${baseName}0" - doFirst { - testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins) - } - filter { + // Only do mixed cluster tasks on same major version + if (bwc_major_version != opensearch_major_version) { + ignoreFailures = true + } else { + doFirst { + testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins) + } + filter { includeTestsMatching "org.opensearch.flowframework.bwc.*IT" + } } mustRunAfter "${baseName}#mixedClusterTask" systemProperty 'tests.rest.bwcsuite', 'mixed_cluster' @@ -581,7 +600,7 @@ task "${baseName}#fullRestartClusterTask"(type: StandaloneRestIntegTestTask) { testClusters."${baseName}1".upgradeAllNodesAndPluginsToNextVersion(plugins) } filter { - includeTestsMatching "org.opensearch.flowframework.bwc.*IT" + includeTestsMatching "org.opensearch.flowframework.bwc.*IT" } systemProperty 'tests.rest.bwcsuite', 'upgraded_cluster' systemProperty 'tests.plugin_bwc_version', bwcVersion @@ -593,6 +612,7 @@ task "${baseName}#fullRestartClusterTask"(type: StandaloneRestIntegTestTask) { task bwcTestSuite(type: StandaloneRestIntegTestTask) { exclude '**/*Test*' exclude '**/*IT*' + dependsOn tasks.named("${baseName}#mixedClusterTask") dependsOn tasks.named("${baseName}#rollingUpgradeClusterTask") dependsOn tasks.named("${baseName}#fullRestartClusterTask")