Files
kata-containers/obs-packaging/build_all.sh
Jose Carlos Venegas Munoz 1a751c5214 obs: docker-build: move osc file creation.
We need to create the osc file before enter the container.
If build_all.sh is executed without a container and osc
is intalled osc will ask for setup but in the container
fails do to a missing tty.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2018-08-28 11:31:26 -05:00

68 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
[ -z "${DEBUG}" ] || set -o xtrace
set -o errexit
set -o nounset
set -o pipefail
readonly script_name="$(basename "${BASH_SOURCE[0]}")"
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=scripts/obs-docker.sh
source "${script_dir}/scripts/obs-pkgs.sh"
PUSH=${PUSH:-""}
LOCAL=${LOCAL:-""}
PUSH_TO_OBS=""
export BUILD_DISTROS=${BUILD_DISTROS:-xUbuntu_16.04}
# Packaging use this variable instead of use git user value
# On CI git user is not set
export AUTHOR="${AUTHOR:-user}"
export AUTHOR_EMAIL="${AUTHOR_EMAIL:-user@example.com}"
usage() {
msg="${1:-}"
exit_code=$"${2:-0}"
cat <<EOT
${msg}
Usage:
${script_name} <kata-branch>
EOT
exit "${exit_code}"
}
main() {
local branch="${1:-}"
[ -n "${branch}" ] || usage "missing branch" "1"
pushd "${script_dir}"
for p in "${OBS_PKGS_PROJECTS[@]}"; do
if [[ "$GO_ARCH" != "amd64" && "$p" == "qemu-lite" ]]; then
echo "Skipping packaging qemu-lite as its only for amd64 arch"
continue
fi
pushd "$p" >>/dev/null
update_cmd="./update.sh"
if [ -n "${PUSH}" ]; then
# push to obs
update_cmd+=" -p"
elif [ -n "${LOCAL}" ]; then
# local build
update_cmd+=" -l"
fi
echo "update ${p}"
bash -c "${update_cmd} ${branch}"
popd >>/dev/null
done
popd
}
main $@