Add support for building armada image

Follow-up to https://review.opendev.org/c/starlingx/integ/+/845752.
As explained in the mentioned commit we need to build the armada
container image using the sources provided there.
Add support for that.

Partial-Bug: 1978409
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: I26e8117272a6925ea429be10be91ce20f6b71c8b
This commit is contained in:
Dan Voiculeasa 2022-06-14 23:23:08 +03:00
parent 0783ec950b
commit 537bffe16e
3 changed files with 62 additions and 0 deletions

View File

@ -1,2 +1,3 @@
kubernetes/armada
kubernetes/plugins/intel-device-plugin kubernetes/plugins/intel-device-plugin
kubernetes/plugins/sriov-network-device-plugin kubernetes/plugins/sriov-network-device-plugin

View File

@ -0,0 +1,7 @@
BUILDER=script
LABEL=armada-image
SOURCE_REPO=https://github.com/airshipit/armada
SOURCE_REF=ddbdd7256c20f138737f6cbd772312f7a19f58b8
COMMAND=bash
SCRIPT=build-armada-image.sh
ARGS="armada-image"

View File

@ -0,0 +1,54 @@
#!/bin/bash
################################################################################
# Copyright (c) 2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
################################################################################
PROJECT=$1
IMAGE_TAG=$2
if [ -z "${IMAGE_TAG}" ]; then
echo "image tag must be specified. build ${PROJECT} Aborting..." >&2
exit 1
fi
# Copy patches from:
# https://opendev.org/starlingx/integ/src/branch/master/kubernetes/armada/debian/deb_folder/patches
tmp_dir=$(mktemp -d -t armada-XXXXXXXXXX --tmpdir=/tmp)
pushd ${tmp_dir}
git clone https://opendev.org/starlingx/integ/
if [ $? -ne 0 ]; then
echo "Failed to clone patches for ${PROJECT}. Aborting..." >&2
exit 1
fi
popd
cp -r ${tmp_dir}/integ/kubernetes/armada/debian/deb_folder/patches .
rm -rf ${tmp_dir}
# Apply patches
pushd patches
cat series | xargs -n 1 git am
if [ $? -ne 0 ]; then
echo "Failed to apply patches for ${PROJECT}. Aborting..." >&2
exit 1
fi
popd
# Use Makefile to build images
make images
if [ $? -ne 0 ]; then
echo "Failed to make ${PROJECT} image. Aborting..." >&2
exit 1
fi
RETVAL=0
docker tag quay.io/airshipit/armada:latest-ubuntu_bionic "${IMAGE_TAG}"
if [ $? -ne 0 ]; then
echo "Failed to tag ${PROJECT} with ${IMAGE_TAG}. Aborting..." >&2
RETVAL=1
fi
docker rmi quay.io/airshipit/armada:latest-ubuntu_bionic
exit ${RETVAL}