mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-02 00:02:01 +00:00
static-build,clh: Add the ability to build from a PR
Right now it doesn't do much for us, as we're always building from a specific version. However, this opens the possibility for us to add a CI, similar to the one we have for CRI-O, for testing against each cloud-hypervisor PR, on the cloud-hypervisor branch. Fixes: #3908 Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
parent
bc3f63bf0a
commit
ebec6903b8
@ -22,6 +22,8 @@ source "${script_dir}/../../scripts/lib.sh"
|
|||||||
|
|
||||||
cloud_hypervisor_repo="${cloud_hypervisor_repo:-}"
|
cloud_hypervisor_repo="${cloud_hypervisor_repo:-}"
|
||||||
cloud_hypervisor_version="${cloud_hypervisor_version:-}"
|
cloud_hypervisor_version="${cloud_hypervisor_version:-}"
|
||||||
|
cloud_hypervisor_pr="${cloud_hypervisor_pr:-}"
|
||||||
|
cloud_hypervisor_pull_ref_branch="${cloud_hypervisor_pull_ref_branch:-main}"
|
||||||
|
|
||||||
if [ -z "$cloud_hypervisor_repo" ]; then
|
if [ -z "$cloud_hypervisor_repo" ]; then
|
||||||
info "Get cloud_hypervisor information from runtime versions.yaml"
|
info "Get cloud_hypervisor information from runtime versions.yaml"
|
||||||
@ -31,8 +33,13 @@ if [ -z "$cloud_hypervisor_repo" ]; then
|
|||||||
fi
|
fi
|
||||||
[ -n "$cloud_hypervisor_repo" ] || die "failed to get cloud_hypervisor repo"
|
[ -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}")
|
if [ -n "$cloud_hypervisor_pr" ]; then
|
||||||
[ -n "$cloud_hypervisor_version" ] || die "failed to get cloud_hypervisor version"
|
force_build_from_source=true
|
||||||
|
cloud_hypervisor_version="PR $cloud_hypervisor_pr"
|
||||||
|
else
|
||||||
|
[ -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"
|
||||||
|
fi
|
||||||
|
|
||||||
pull_clh_released_binary() {
|
pull_clh_released_binary() {
|
||||||
info "Download cloud-hypervisor version: ${cloud_hypervisor_version}"
|
info "Download cloud-hypervisor version: ${cloud_hypervisor_version}"
|
||||||
@ -50,8 +57,19 @@ build_clh_from_source() {
|
|||||||
repo_dir="${repo_dir//.git}"
|
repo_dir="${repo_dir//.git}"
|
||||||
[ -d "${repo_dir}" ] || git clone "${cloud_hypervisor_repo}"
|
[ -d "${repo_dir}" ] || git clone "${cloud_hypervisor_repo}"
|
||||||
pushd "${repo_dir}"
|
pushd "${repo_dir}"
|
||||||
git fetch || true
|
|
||||||
git checkout "${cloud_hypervisor_version}"
|
if [ -n "${cloud_hypervisor_pr}" ]; then
|
||||||
|
local pr_branch="PR_${cloud_hypervisor_pr}"
|
||||||
|
git fetch origin "pull/${cloud_hypervisor_pr}/head:${pr_branch}" || return 1
|
||||||
|
git checkout "${pr_branch}"
|
||||||
|
git rebase "origin/${cloud_hypervisor_pull_ref_branch}"
|
||||||
|
|
||||||
|
git log --oneline main~1..HEAD
|
||||||
|
else
|
||||||
|
git fetch || true
|
||||||
|
git checkout "${cloud_hypervisor_version}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "${features}" ]; then
|
if [ -n "${features}" ]; then
|
||||||
info "Build cloud-hypervisor enabling the following features: ${features}"
|
info "Build cloud-hypervisor enabling the following features: ${features}"
|
||||||
./scripts/dev_cli.sh build --release --libc musl --features "${features}"
|
./scripts/dev_cli.sh build --release --libc musl --features "${features}"
|
||||||
|
Loading…
Reference in New Issue
Block a user