From b6f14052917c1f7979a4ff47546b46e4d868cd69 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 26 Aug 2020 15:15:17 -0400 Subject: [PATCH] Replace hard coded KNNLib versions with wildcards --- elasticsearch/docker/templates/Dockerfile.j2 | 5 +++-- .../linux_distributions/opendistro-tar-build.sh | 2 +- .../opendistro-tar-install.sh | 2 +- .../linux_distributions/scripts/preInstall.sh | 17 ----------------- 4 files changed, 5 insertions(+), 21 deletions(-) delete mode 100644 elasticsearch/linux_distributions/scripts/preInstall.sh diff --git a/elasticsearch/docker/templates/Dockerfile.j2 b/elasticsearch/docker/templates/Dockerfile.j2 index de63b6a0b..558c0d3e6 100644 --- a/elasticsearch/docker/templates/Dockerfile.j2 +++ b/elasticsearch/docker/templates/Dockerfile.j2 @@ -81,7 +81,8 @@ RUN java -version # Compile the C-library for kNN USER 1000 RUN set -ex; \ - export KNN_VERSION=`.github/scripts/plugin_tag.sh opendistro-for-elasticsearch/k-NN $(echo {{version_tag}} | sed -E "s/.[0-9]+$//g")` \ + + export KNN_VERSION=`git ls-remote --tags "https://github.com/opendistro-for-elasticsearch/k-NN" v* | grep $(echo {{version_tag}} | sed -E "s/.[0-9]+$//g") | grep -oh "v[0-9.]*" | sort | tail -n 1` \ \ && git ls-remote --tags https://github.com/opendistro-for-elasticsearch/k-NN.git v* \ \ @@ -184,7 +185,7 @@ RUN mkdir -p /usr/share/supervisor/performance_analyzer/ && \ WORKDIR /usr/share/elasticsearch COPY --from=prep_es_files --chown=1000:0 /usr/share/elasticsearch /usr/share/elasticsearch -COPY --from=prep_es_files /tmp/jni/libKNNIndexV1_7_3_6.so /usr/lib +COPY --from=prep_es_files /tmp/jni/libKNNIndex*.so /usr/lib ENV PATH /usr/share/elasticsearch/bin:$PATH diff --git a/elasticsearch/linux_distributions/opendistro-tar-build.sh b/elasticsearch/linux_distributions/opendistro-tar-build.sh index 0379fe4d0..f510d2c05 100755 --- a/elasticsearch/linux_distributions/opendistro-tar-build.sh +++ b/elasticsearch/linux_distributions/opendistro-tar-build.sh @@ -76,7 +76,7 @@ echo "downloading $knnlib_latest" aws s3 cp "s3://artifacts.opendistroforelasticsearch.amazon.com/${knnlib_latest}" ./ unzip opendistro-knnlib*.zip mkdir -p $PACKAGE_NAME-$OD_VERSION/plugins/opendistro-knn/knn-lib/ -mv opendistro-knnlib*/libKNNIndexV1_7_3_6.so $PACKAGE_NAME-$OD_VERSION/plugins/opendistro-knn/knn-lib/ +mv -v opendistro-knnlib*/libKNNIndex*.so $PACKAGE_NAME-$OD_VERSION/plugins/opendistro-knn/knn-lib/ # Tar generation echo "generating tar" diff --git a/elasticsearch/linux_distributions/opendistro-tar-install.sh b/elasticsearch/linux_distributions/opendistro-tar-install.sh index 76827a9db..8f92e580b 100755 --- a/elasticsearch/linux_distributions/opendistro-tar-install.sh +++ b/elasticsearch/linux_distributions/opendistro-tar-install.sh @@ -43,7 +43,7 @@ echo "done plugins" ##Check KNN lib existence in ES TAR distribution echo "Checking kNN library" -FILE=$ES_KNN_LIB_DIR/libKNNIndexV1_7_3_6.so +FILE=`ls $ES_KNN_LIB_DIR/libKNNIndex*.so` if test -f "$FILE"; then echo "FILE EXISTS $FILE" else diff --git a/elasticsearch/linux_distributions/scripts/preInstall.sh b/elasticsearch/linux_distributions/scripts/preInstall.sh deleted file mode 100644 index ab1e13eb6..000000000 --- a/elasticsearch/linux_distributions/scripts/preInstall.sh +++ /dev/null @@ -1,17 +0,0 @@ -echo "Fetching kNN library" -FILE=/usr/lib/libKNNIndexV1_7_3_6.so -if [ -f "$FILE" ] -then - echo "$FILE exist: removing $FILE" - sudo rm $FILE -fi -FILE=/libKNNIndexV1_7_3_6.zip -if [ -f "$FILE" ] -then - echo "$FILE exist: removing $FILE" - sudo rm $FILE -fi -wget https://d3g5vo6xdbdb9a.cloudfront.net/downloads/k-NN-lib/libKNNIndexV1_7_3_6.zip \ -&& unzip libKNNIndexV1_7_3_6.zip \ -&& mv libKNNIndexV1_7_3_6.so /usr/lib \ -&& rm libKNNIndexV1_7_3_6.zip