Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install k-NN plugin for unreleased OpenSearch integration tests #241

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 39 additions & 11 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ jobs:
for plugin in ${PluginList[*]}; do
./gradlew :plugins:$plugin:assemble
done

- name: Determine OpenSearch distribution path and version
shell: bash -eo pipefail {0}
run: |
distribution=`ls -1 $PWD/opensearch/distribution/archives/linux-tar/build/distributions/opensearch-*.tar.gz | head -1`
version=`basename $distribution | cut -d'-' -f3,4`
echo "OPENSEARCH_DISTRIBUTION=$distribution" >> $GITHUB_ENV
echo "OPENSEARCH_VERSION=$version" >> $GITHUB_ENV

- name: Restore or Build OpenSearch Security
uses: ./client/.github/actions/cached-git-build
Expand All @@ -150,22 +158,42 @@ jobs:
path: opensearch-security
cached_paths: |
./opensearch-security/build/distributions/opensearch-security-*-SNAPSHOT.zip
build_script: ./gradlew assemble
build_script: ./gradlew assemble -Dopensearch.version=$OPENSEARCH_VERSION

- name: Restore or Build OpenSearch k-NN
uses: ./client/.github/actions/cached-git-build
with:
repository: opensearch-project/k-NN
ref: ${{ matrix.opensearch_ref }}
path: opensearch-knn
cached_paths: |
./opensearch-knn/build/distributions/opensearch-knn-*-SNAPSHOT.zip
build_script: |
sudo apt-get install -y libopenblas-dev libomp-dev
./gradlew buildJniLib assemble -Dopensearch.version=$OPENSEARCH_VERSION
distributions=./build/distributions
lib_dir=$distributions/lib
mkdir $lib_dir
cp -v $(ldconfig -p | grep libgomp | cut -d ' ' -f 4) $lib_dir
cp -v ./jni/release/libopensearchknn_* $lib_dir
ls -l $lib_dir
cd $distributions
zip -ur opensearch-knn-*.zip lib

- name: Determine OpenSearch distribution path
- name: Copy OpenSearch plugins
shell: bash -eo pipefail {0}
run: |
distribution=`ls -1 $PWD/opensearch/distribution/archives/linux-tar/build/distributions/opensearch-*.tar.gz | head -1`
version=`basename $distribution | cut -d'-' -f3,4`
echo "OPENSEARCH_DISTRIBUTION=$distribution" >> $GITHUB_ENV
echo "OPENSEARCH_VERSION=$version" >> $GITHUB_ENV

mkdir -p $OPENSEARCH_PLUGINS_DIRECTORY
cp ./opensearch/plugins/*/build/distributions/*-$version.zip $OPENSEARCH_PLUGINS_DIRECTORY/
cp -v ./opensearch/plugins/*/build/distributions/*-$OPENSEARCH_VERSION.zip $OPENSEARCH_PLUGINS_DIRECTORY/

plugins=("opensearch-knn" "opensearch-security")
for plugin in ${plugins[*]}; do
if [[ -d "./$plugin" ]]; then
cp -v ./$plugin/build/distributions/$plugin-*-SNAPSHOT.zip $OPENSEARCH_PLUGINS_DIRECTORY/
fi
done

if [[ -d "./opensearch-security" ]]; then
cp ./opensearch-security/build/distributions/opensearch-security-*-SNAPSHOT.zip $OPENSEARCH_PLUGINS_DIRECTORY/
fi
ls -l $OPENSEARCH_PLUGINS_DIRECTORY

- run: "./build.sh integrate ${{ env.OPENSEARCH_VERSION }} readonly,writable random:test_only_one --report"
name: Integration Tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private static Dictionary<string, string> EnvVars(NodeConfiguration config)
if (!string.IsNullOrWhiteSpace(config.FileSystem.OpenSearchHome))
environmentVariables.Add("OPENSEARCH_HOME", config.FileSystem.OpenSearchHome);

var knnLibDir = Path.Combine(config.FileSystem.OpenSearchHome, "plugins", "opensearch-knn", config.Version.Major >= 2 ? "lib" : "knnlib");
var knnLibDir = Path.Combine(config.FileSystem.OpenSearchHome, "plugins", "opensearch-knn", config.Version >= "1.3.10" ? "lib" : "knnlib");
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
AppendPathEnvVar("JAVA_LIBRARY_PATH", knnLibDir);
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,7 @@ public OpenSearchPlugin(string plugin, Func<OpenSearchVersion, bool> isValid = n
public static OpenSearchPlugin StoreSMB { get; } = new("store-smb");

public static OpenSearchPlugin DeleteByQuery { get; } = new("delete-by-query", version => version < "1.0.0");

public static OpenSearchPlugin Knn { get; } = new("opensearch-knn");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace Tests.Core.ManagedOpenSearch.Clusters
{
public class ReadOnlyCluster : ClientTestClusterBase
{
public ReadOnlyCluster() : base(MapperMurmur3, Security) { }
public ReadOnlyCluster() : base(Knn, MapperMurmur3, Security) { }

protected override void SeedNode() => new DefaultSeeder(Client).SeedNode();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ private static ClientTestClusterConfiguration CreateConfiguration() =>
new(
AnalysisIcu, AnalysisKuromoji, AnalysisNori, AnalysisPhonetic,
IngestAttachment, IngestGeoIp,
Knn,
MapperMurmur3,
Security)
{
Expand Down
Loading