Files
app-intel-device-plugins/intel-device-plugins-images/debian/build-intel-device-plugins-image.sh
Md Irshad Sheikh 731631f43d Build intel device plugin images
Currently, app-intel-device-plugins uses upstream images.
As a result, bug fix patches cannot be applied and must
wait for an upstream release.

In this commit, support has been added to build the images using
the upstream source code after applying the required patches.

The following fix has been applied over the Intel Device Plugins
upstream version v0.32.1:
https://github.com/intel/intel-device-plugins-for-kubernetes/pull/2074

Note: This review only introduces the build mechanism. Other changes,
      such as tagging the newly built images and updating Helm charts,
      will be done in separate reviews.

TEST PLAN:

PASS: Build the images using build-stx-images.sh script successfully.
      Invoked this script to build images as follows.
      ./build-stx-images.sh --base msheikh/stx-debian:DEV --no-pull-base \
      --wheels $MY_WORKSPACE/std/build-wheels-debian-stable/stx-debian-stable-wheels.tar \
      --only image_name

Story: 2011407
Task: 52420

Change-Id: Ia482ea893206a0ef6c067dbf347ea00a4d0e5190
Signed-off-by: Md Irshad Sheikh <mdirshad.sheikh@windriver.com>
2025-07-03 03:03:56 -04:00

168 lines
4.0 KiB
Bash

#!/bin/sh
#
# Copyright (c) 2025 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
IMAGE=$1
IMAGE_TAG=$2
export CONTAINER_TOOL=docker
BUILD_TAG=dev-debian-stable-build
INTEL=intel
INTEL_OPERATOR=intel-deviceplugin-operator
INTEL_QAT=intel-qat-plugin
INTEL_GPU=intel-gpu-plugin
INTEL_GPU_INIT=intel-gpu-initcontainer
INTEL_DSA=intel-dsa-plugin
INTEL_IDXD_INIT=intel-idxd-config-initcontainer
echo "=============== build script ================"
echo image: "${IMAGE}"
echo image_tag: "${IMAGE_TAG}"
pwd
if [ -z "${IMAGE_TAG}" ]; then
echo "Image tag must be specified. build ${IMAGE} Aborting..." >&2
exit 1
fi
build_intel_operator_image() {
export INTEL_OPERATOR_IMAGE=$1
echo "intel_operator_image: ${INTEL_OPERATOR_IMAGE}"
pwd
make $INTEL_OPERATOR TAG=$BUILD_TAG
docker tag $INTEL/$INTEL_OPERATOR:$BUILD_TAG $IMAGE_TAG
docker rmi $INTEL/$INTEL_OPERATOR:$BUILD_TAG
if [ $? -ne 0 ]; then
echo "${INTEL_OPERATOR_IMAGE} image build failed"
exit 1
fi
echo "${INTEL_OPERATOR_IMAGE} image build done"
return 0
}
build_intel_qat_image() {
export INTEL_QAT_IMAGE=$1
echo "intel_qat_image: ${INTEL_QAT_IMAGE}"
pwd
make $INTEL_QAT TAG=$BUILD_TAG
docker tag $INTEL/$INTEL_QAT:$BUILD_TAG $IMAGE_TAG
docker rmi $INTEL/$INTEL_QAT:$BUILD_TAG
if [ $? -ne 0 ]; then
echo "${INTEL_QAT_IMAGE} image build failed"
exit 1
fi
echo "${INTEL_QAT_IMAGE} image build done"
return 0
}
build_intel_gpu_image() {
export INTEL_GPU_IMAGE=$1
echo "intel_gpu_image: ${INTEL_GPU_IMAGE}"
pwd
make $INTEL_GPU TAG=$BUILD_TAG
docker tag $INTEL/$INTEL_GPU:$BUILD_TAG $IMAGE_TAG
docker rmi $INTEL/$INTEL_GPU:$BUILD_TAG
if [ $? -ne 0 ]; then
echo "${INTEL_GPU_IMAGE} image build failed"
exit 1
fi
echo "${INTEL_GPU_IMAGE} image build done"
return 0
}
build_intel_gpu_init_image() {
export INTEL_GPU_INIT_IMAGE=$1
echo "intel_gpu_init_image: ${INTEL_GPU_INIT_IMAGE}"
pwd
make $INTEL_GPU_INIT TAG=$BUILD_TAG
docker tag $INTEL/$INTEL_GPU_INIT:$BUILD_TAG $IMAGE_TAG
docker rmi $INTEL/$INTEL_GPU_INIT:$BUILD_TAG
if [ $? -ne 0 ]; then
echo "${INTEL_GPU_INIT_IMAGE} image build failed"
exit 1
fi
echo "${INTEL_GPU_INIT_IMAGE} image build done"
return 0
}
build_intel_dsa_image() {
export INTEL_DSA_IMAGE=$1
echo "intel_dsa_image: ${INTEL_DSA_IMAGE}"
pwd
make $INTEL_DSA TAG=$BUILD_TAG
docker tag $INTEL/$INTEL_DSA:$BUILD_TAG $IMAGE_TAG
docker rmi $INTEL/$INTEL_DSA:$BUILD_TAG
if [ $? -ne 0 ]; then
echo "${INTEL_DSA_IMAGE} image build failed"
exit 1
fi
echo "${INTEL_DSA_IMAGE} image build done"
return 0
}
build_intel_idxd_config_init_image() {
export INTEL_IDXD_IMAGE=$1
echo "intel_idxd_config_init_image: ${INTEL_IDXD_IMAGE}"
pwd
make $INTEL_IDXD_INIT TAG=$BUILD_TAG
docker tag $INTEL/$INTEL_IDXD_INIT:$BUILD_TAG $IMAGE_TAG
docker rmi $INTEL/$INTEL_IDXD_INIT:$BUILD_TAG
if [ $? -ne 0 ]; then
echo "${INTEL_IDXD_IMAGE} image build failed"
exit 1
fi
echo "${INTEL_IDXD_IMAGE} image build done"
return 0
}
case ${IMAGE} in
intel_operator)
echo "Build image: ${INTEL_OPERATOR}"
build_intel_operator_image "${IMAGE_TAG}"
;;
intel_qat)
echo "build image: ${INTEL_QAT}"
build_intel_qat_image "${IMAGE_TAG}"
;;
intel_gpu)
echo "build image: ${INTEL_GPU}"
build_intel_gpu_image "${IMAGE_TAG}"
;;
intel_gpu_init)
echo "build image: ${INTEL_GPU_INIT}"
build_intel_gpu_init_image "${IMAGE_TAG}"
;;
intel_dsa)
echo "build image: ${INTEL_DSA}"
build_intel_dsa_image "${IMAGE_TAG}"
;;
intel_idxd_config_init)
echo "build image: ${INTEL_IDXD_INIT}"
build_intel_idxd_config_init_image "${IMAGE_TAG}"
;;
*)
echo "Unsupported ARGS in ${image_build_file}: ${IMAGE}" >&2
exit 1
;;
esac
exit 0