Files
kata-containers/static-build/cloud-hypervisor/build-static-clh.sh
Archana Shinde 9377c5d5ca release: Fix bug in how version is determined for actions
Althought, we changed the script "gen_versions_txt.sh" to accept a tag
rather than a branch, this change is not sufficient.
This script generates the right version file based on a tag, but
function `get_from_kata_deps` does not use this, and ends up using the
master branch instead. This is because this function looks at an env
variable called $BRANCH and ends up using master branch if the variable
is not defined.

Pass the tag/new version to the build scripts, so that this tag is
passed along to `get_from_kata_dep`.
With this change, the correct version information is consumed by the
build scripts for the various hypervisors and kernel.

Fixes #831

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2019-12-03 17:56:03 -08:00

42 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
#
# Copyright (c) 2019 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
set -o errexit
set -o nounset
set -o pipefail
script_dir=$(dirname $(readlink -f "$0"))
kata_version="${kata_version:-}"
source "${script_dir}/../../scripts/lib.sh"
cloud_hypervisor_repo="${cloud_hypervisor_repo:-}"
cloud_hypervisor_version="${cloud_hypervisor_version:-}"
if [ -z "$cloud_hypervisor_repo" ]; then
info "Get cloud_hypervisor information from runtime versions.yaml"
cloud_hypervisor_url=$(get_from_kata_deps "assets.hypervisor.cloud_hypervisor.url" "${kata_version}")
[ -n "$cloud_hypervisor_url" ] || die "failed to get cloud_hypervisor url"
cloud_hypervisor_repo="${cloud_hypervisor_url}.git"
fi
[ -n "$cloud_hypervisor_repo" ] || die "failed to get cloud_hypervisor repo"
[ -n "$cloud_hypervisor_version" ] || cloud_hypervisor_version=$(get_from_kata_deps "assets.hypervisor.cloud_hypervisor.version" "${kata_version}")
[ -n "$cloud_hypervisor_version" ] || die "failed to get cloud_hypervisor version"
info "Build ${cloud_hypervisor_repo} version: ${cloud_hypervisor_version}"
repo_dir=$(basename "${cloud_hypervisor_repo}")
repo_dir="${repo_dir//.git}"
[ -d "${repo_dir}" ] || git clone "${cloud_hypervisor_repo}"
cd "${repo_dir}"
git fetch || true
git checkout "${cloud_hypervisor_version}"
"${script_dir}/docker-build/build.sh"
rm -f cloud-hypervisor
cp ./target/release/cloud-hypervisor .