Skip to content
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
5 changes: 2 additions & 3 deletions Dockerfile.redhat
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; \
cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DCMAKE_CXX_FLAGS=" ${SDL_OPS} ${LTO_CXX_FLAGS} " -DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DENABLE_SYSTEM_ICU="True" -DBUILD_TOKENIZERS=OFF -DENABLE_SAMPLES=OFF -DENABLE_TOOLS=OFF -DENABLE_TESTS=OFF -DENABLE_XGRAMMAR=ON -S ./ -B ./build/ ; \
cmake --build ./build/ --parallel $JOBS && cp /openvino_genai/build/openvino_genai/lib*.so* /opt/intel/openvino/runtime/lib/intel64/ ; \
cp -r /openvino_genai/src/cpp/include/* /opt/intel/openvino/runtime/include/ ; \
cp /openvino_genai/build/src/cpp/openvino/genai/version.hpp /opt/intel/openvino/runtime/include/openvino/genai/ ; \
if ! [[ $debug_bazel_flags == *"_py_off"* ]]; then \
cp -r /openvino_genai/build/openvino_genai/*py* /opt/intel/openvino/python/ ; \
fi
Expand Down Expand Up @@ -306,8 +307,6 @@ ARG minitrace_flags

# Set OVMS version strings
RUN bash -c "sed -i -e 's|REPLACE_PROJECT_VERSION|${PROJECT_VERSION}|g' /ovms/src/version.hpp" && \
if [ "$ov_use_binary" = "1" ] ; then sed -i -e "s#REPLACE_OPENVINO_NAME#$(find /opt/intel/ -maxdepth 1 -mindepth 1 -type d | grep openvino | grep -Eo '[0-9]{4}.[0-9].[0-9].[^_]+')#g" /ovms/src/version.hpp ; fi && \
if [ "$ov_use_binary" == "0" ] ; then sed -i -e "s#REPLACE_OPENVINO_NAME#$(git --git-dir /openvino/.git log -n 1 | head -n 1 | cut -d' ' -f2 | head -c 12)#g" /ovms/src/version.hpp ; fi && \
bash -c "sed -i -e 's|REPLACE_BAZEL_BUILD_FLAGS|${debug_bazel_flags}${minitrace_flags}|g' /ovms/src/version.hpp"

# Custom Nodes
Expand Down Expand Up @@ -336,7 +335,7 @@ RUN /ovms/bazel-bin/src/ovms --version && /ovms/bazel-bin/src/ovms
COPY release_files/thirdparty-licenses/ /ovms/release_files/thirdparty-licenses/
COPY release_files/LICENSE /ovms/release_files/LICENSE
COPY client /client
RUN python3.12 -c "import json; m={'PROJECT_VERSION':'${PROJECT_VERSION}','OPENVINO backend':'$(/ovms/bazel-bin/src/ovms --version | grep backend | cut -d' ' -f3)', \
RUN python3.12 -c "import json; m={'PROJECT_VERSION':'${PROJECT_VERSION}','OPENVINO backend':'$(/ovms/bazel-bin/src/ovms --version | grep 'OpenVINO backend' | cut -d' ' -f3)', \
'BAZEL_BUILD_FLAGS':'${debug_bazel_flags}${minitrace_flags}}','BASE_IMAGE':'${BASE_IMAGE}' }; \
print(json.dumps(m,indent=4))" > /ovms/release_files/metadata.json

Expand Down
5 changes: 2 additions & 3 deletions Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ RUN if [ "$ov_use_binary" == "0" ]; then \
cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DCMAKE_CXX_FLAGS="${SDL_OPS}" -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DENABLE_SYSTEM_ICU="True" -DBUILD_TOKENIZERS=OFF -DENABLE_SAMPLES=OFF -DENABLE_TOOLS=OFF -DENABLE_TESTS=OFF -DENABLE_XGRAMMAR=ON -S ./ -B ./build/ ; \
cmake --build ./build/ --parallel $JOBS && cp /openvino_genai/build/openvino_genai/lib*.so* /opt/intel/openvino/runtime/lib/intel64/ ; \
cp -r /openvino_genai/src/cpp/include/* /opt/intel/openvino/runtime/include/ ; \
cp /openvino_genai/build/src/cpp/openvino/genai/version.hpp /opt/intel/openvino/runtime/include/openvino/genai/ ; \
if ! [[ $debug_bazel_flags == *"py_off"* ]]; then \
cp -r /openvino_genai/build/openvino_genai/*py* /opt/intel/openvino/python/ ; \
fi ; \
Expand Down Expand Up @@ -301,8 +302,6 @@ ARG minitrace_flags
ENV PYTHONPATH=/opt/intel/openvino/python:/ovms/bazel-bin/src/python/binding
# Set OVMS version strings
RUN bash -c "sed -i -e 's|REPLACE_PROJECT_VERSION|${PROJECT_VERSION}|g' /ovms/src/version.hpp" && \
if [ "$ov_use_binary" == "1" ] ; then sed -i -e "s#REPLACE_OPENVINO_NAME#$(find /opt/intel/ -maxdepth 1 -mindepth 1 -type d | grep openvino | grep -Eo '[0-9]{4}.[0-9].[0-9].[^_]+')#g" /ovms/src/version.hpp ; fi && \
if [ "$ov_use_binary" == "0" ] ; then sed -i -e "s#REPLACE_OPENVINO_NAME#$(git --git-dir /openvino/.git log -n 1 | head -n 1 | cut -d' ' -f2 | head -c 12)#g" /ovms/src/version.hpp ; fi && \
bash -c "sed -i -e 's|REPLACE_BAZEL_BUILD_FLAGS|${debug_bazel_flags}${minitrace_flags}|g' /ovms/src/version.hpp"

WORKDIR /patchelf
Expand Down Expand Up @@ -337,7 +336,7 @@ RUN if [ "$FUZZER_BUILD" == "0" ]; then /ovms/bazel-bin/src/ovms --version && /o
COPY release_files/thirdparty-licenses/ /ovms/release_files/thirdparty-licenses/
COPY release_files/LICENSE /ovms/release_files/LICENSE
COPY client /client
RUN python3 -c "import json; m={'PROJECT_VERSION':'${PROJECT_VERSION}','OPENVINO backend':'$(/ovms/bazel-bin/src/ovms --version | grep backend | cut -d' ' -f3)', \
RUN python3 -c "import json; m={'PROJECT_VERSION':'${PROJECT_VERSION}','OPENVINO backend':'$(/ovms/bazel-bin/src/ovms --version | grep 'OpenVINO backend' | cut -d' ' -f3)', \
'BAZEL_BUILD_FLAGS':'${debug_bazel_flags}${minitrace_flags}','BASE_IMAGE':'${BASE_IMAGE}' }; \
print(json.dumps(m,indent=4))" > /ovms/release_files/metadata.json
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
Expand Down
2 changes: 1 addition & 1 deletion src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ ovms_cc_library(
name = "libovms_version",
hdrs = ["version.hpp"],
srcs = [],
deps = [],
deps = ["//third_party:openvino",],
visibility = ["//visibility:public",],
)
ovms_cc_library(
Expand Down
4 changes: 3 additions & 1 deletion src/capi_frontend/capi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,9 @@ DLL_PUBLIC OVMS_Status* OVMS_ServerMetadata(OVMS_Server* server, OVMS_Metadata**
doc->SetObject();
doc->AddMember("name", PROJECT_NAME, doc->GetAllocator());
doc->AddMember("version", PROJECT_VERSION, doc->GetAllocator());
doc->AddMember("ov_version", OPENVINO_NAME, doc->GetAllocator());
rapidjson::Value ovVersion;
ovVersion.SetString(OPENVINO_NAME, doc->GetAllocator());
doc->AddMember("ov_version", std::move(ovVersion), doc->GetAllocator());
*metadata = reinterpret_cast<OVMS_Metadata*>(doc);
return nullptr;
}
Expand Down
3 changes: 2 additions & 1 deletion src/cli_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ std::variant<bool, std::pair<int, std::string>> CLIParser::parse(int argc, char*
std::stringstream ss;
try {
options = std::make_unique<cxxopts::Options>(argv[0], "OpenVINO Model Server");
auto configOptions = std::make_unique<cxxopts::Options>("ovms --model_name <MODEL_NAME> --add_to_config <CONFIG_PATH> --model_repository_path <MODEL_REPO_PATH> \n ovms --model_path <MODEL_PATH> --model_name <MODEL_NAME> --add_to_config <CONFIG_PATH> \n ovms --remove_from_config <CONFIG_PATH> --model_name <MODEL_NAME>", "config management commands:");
auto configOptions = std::make_unique<cxxopts::Options>("ovms --model_name <MODEL_NAME> --add_to_config --config_path <CONFIG_PATH> --model_repository_path <MODEL_REPO_PATH> \n ovms --model_path <MODEL_PATH> --model_name <MODEL_NAME> --add_to_config --config_path <CONFIG_PATH> \n ovms --remove_from_config --config_path <CONFIG_PATH> --model_name <MODEL_NAME>", "config management commands:");
// Adding this option to parse unrecognised options in another parser
options->allow_unrecognised_options();

Expand Down Expand Up @@ -444,6 +444,7 @@ std::variant<bool, std::pair<int, std::string>> CLIParser::parse(int argc, char*
std::string project_version(PROJECT_VERSION);
ss << project_name + " " + project_version << std::endl;
ss << "OpenVINO backend " << OPENVINO_NAME << std::endl;
ss << "OpenVINO GenAI backend " << GENAI_NAME << std::endl;
ss << "Bazel build flags: " << BAZEL_BUILD_FLAGS << std::endl;
#pragma warning(pop)
return std::make_pair(OVMS_EX_OK, ss.str());
Expand Down
9 changes: 7 additions & 2 deletions src/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************

#include <openvino/openvino.hpp>
#include <openvino/genai/version.hpp>

#ifndef SRC_VERSION_HPP_
#define SRC_VERSION_HPP_
#define PROJECT_NAME "OpenVINO Model Server"
#define PROJECT_VERSION "REPLACE_PROJECT_VERSION"
#define OPENVINO_NAME "REPLACE_OPENVINO_NAME"
#define OPENVINO_NAME ov::get_openvino_version().buildNumber
#define GENAI_NAME ov::genai::get_version().buildNumber
#define BAZEL_BUILD_FLAGS "REPLACE_BAZEL_BUILD_FLAGS"
#endif // SRC_VERSION_HPP_"
#endif // SRC_VERSION_HPP_
5 changes: 5 additions & 0 deletions windows_install_build_dependencies.bat
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ git checkout %OV_SOURCE_BRANCH%
if !errorlevel! neq 0 exit /b !errorlevel!
git submodule update --init --recursive
if !errorlevel! neq 0 exit /b !errorlevel!
git pull --recurse-submodules
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OV_SOURCE_BRANCH defaults to a specific commit SHA (detached HEAD). Running git pull in detached HEAD will fail ("You are not currently on a branch") and is also ignored here (no errorlevel check). Consider removing this pull, or only pulling when %OV_SOURCE_BRANCH% is an actual branch name; for pinned SHAs, git fetch + git checkout is sufficient and keeps builds reproducible.

Suggested change
git pull --recurse-submodules
for /f "delims=" %%i in ('git symbolic-ref --short -q HEAD 2^>nul') do set "GIT_CURRENT_BRANCH=%%i"
if defined GIT_CURRENT_BRANCH (
git pull --recurse-submodules
)

Copilot uses AI. Check for mistakes.
IF /I NOT EXIST build (
mkdir build
)
Expand All @@ -271,6 +272,7 @@ cd %BAZEL_SHORT_PATH%\openvino_tokenizers_src
git fetch origin
git checkout %TOKENIZER_SOURCE_BRANCH%
if !errorlevel! neq 0 exit /b !errorlevel!
git pull --recurse-submodules
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TOKENIZER_SOURCE_BRANCH defaults to a commit SHA, so this git pull will fail in detached HEAD and its failure is currently ignored (no errorlevel check). If the intent is to stay pinned, drop the pull; if the intent is to track a branch, gate the pull on being on a branch and ensure failure stops the script.

Suggested change
git pull --recurse-submodules
for /f "delims=" %%h in ('git rev-parse --abbrev-ref HEAD') do set "GIT_BRANCH=%%h"
IF /I NOT "!GIT_BRANCH!"=="HEAD" (
git pull --recurse-submodules
if !errorlevel! neq 0 exit /b !errorlevel!
)

Copilot uses AI. Check for mistakes.
IF /I NOT EXIST build (
mkdir build
)
Expand All @@ -292,6 +294,7 @@ cd %BAZEL_SHORT_PATH%\openvino_genai_src
git fetch origin
git checkout %GENAI_SOURCE_BRANCH%
if !errorlevel! neq 0 exit /b !errorlevel!
git pull --recurse-submodules
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GENAI_SOURCE_BRANCH defaults to a commit SHA, which puts the repo in detached HEAD; git pull will fail in that state and the script does not check errorlevel afterwards. Recommend removing this pull (fetch+checkout already refreshes) or performing a deterministic update (e.g., fetch then reset/checkout the requested ref) with proper error handling.

Suggested change
git pull --recurse-submodules

Copilot uses AI. Check for mistakes.
IF /I NOT EXIST build (
mkdir build
)
Expand All @@ -302,6 +305,8 @@ cmake --build . --config Release --verbose -j
if !errorlevel! neq 0 exit /b !errorlevel!
cmake --install . --config Release --prefix %BAZEL_SHORT_PATH%\openvino
if !errorlevel! neq 0 exit /b !errorlevel!
copy src\cpp\openvino\genai\version.hpp %BAZEL_SHORT_PATH%\openvino\runtime\include\openvino\genai\
if !errorlevel! neq 0 exit /b !errorlevel!

echo [INFO] OpenVINO from source installed: %BAZEL_SHORT_PATH%\openvino
cd !BACK_CWD!
Expand Down
29 changes: 2 additions & 27 deletions windows_set_ovms_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,7 @@ def replace_in_file(file_path, old_string, new_string):
file.seek(0)
file.write(contents)
file.truncate()

def get_openvino_name_bin(openvino_dir):
openvino_name = "Unknown"
# read file openvino_dir\openvino\runtime\version.txt
version_file_path = os.path.join(openvino_dir, "openvino", "runtime", "version.txt")
if os.path.exists(version_file_path):
with open(version_file_path, 'r') as version_file:
for line in version_file:
match = WIN_OV_VERSION_REGEX.search(line)
if match:
openvino_name = line.strip('\n')
break
return openvino_name

def get_openvino_name_src(openvino_dir):
src_dir = os.path.join(openvino_dir, "openvino_src")
# get version using git
command = "git -C {} rev-parse --short HEAD".format(src_dir)
output = subprocess.check_output(command, shell=True, text=True)
return output.rstrip()

def get_ovms_sha():
command = "git rev-parse --short HEAD"
output = subprocess.check_output(command, shell=True, text=True)
Expand All @@ -88,15 +69,9 @@ def main():
openvino_dir = sys.argv[2]
print('Provided openvino directory: ' + openvino_dir)

if os.environ.get('OV_USE_BINARY', '1') == '1':
print('Getting openvino version from binary package')
openvino_name = get_openvino_name_bin(openvino_dir)
else:
openvino_name = get_openvino_name_src(openvino_dir)
print('Using openvino source build, setting version to ' + openvino_name)

version_file_path = os.path.join(os.getcwd(), VERSION_FILE)
replace_in_file(version_file_path, "REPLACE_PROJECT_VERSION", check_get_product_version() + "." + get_ovms_sha())
replace_in_file(version_file_path, "REPLACE_OPENVINO_NAME", openvino_name)
replace_in_file(version_file_path, "REPLACE_BAZEL_BUILD_FLAGS", bazel_bld_flags)

if __name__ == '__main__':
Expand Down