mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-09 20:07:49 +00:00
Merge pull request #3909 from fidencio/wip/clh-allow-testing-a-specific-pr
static-build,clh: Add the ability to build from a PR
This commit is contained in:
commit
d9cd8cde2b
@ -22,6 +22,8 @@ source "${script_dir}/../../scripts/lib.sh"
|
||||
|
||||
cloud_hypervisor_repo="${cloud_hypervisor_repo:-}"
|
||||
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
|
||||
info "Get cloud_hypervisor information from runtime versions.yaml"
|
||||
@ -31,8 +33,13 @@ if [ -z "$cloud_hypervisor_repo" ]; then
|
||||
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"
|
||||
if [ -n "$cloud_hypervisor_pr" ]; then
|
||||
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() {
|
||||
info "Download cloud-hypervisor version: ${cloud_hypervisor_version}"
|
||||
@ -50,8 +57,19 @@ build_clh_from_source() {
|
||||
repo_dir="${repo_dir//.git}"
|
||||
[ -d "${repo_dir}" ] || git clone "${cloud_hypervisor_repo}"
|
||||
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
|
||||
info "Build cloud-hypervisor enabling the following features: ${features}"
|
||||
./scripts/dev_cli.sh build --release --libc musl --features "${features}"
|
||||
|
Loading…
Reference in New Issue
Block a user