Merge pull request #8375 from zvonkok/opa-binary-fix

arm64: agent_policy build always pulls amd64 opa binary
This commit is contained in:
Zvonko Kaiser 2024-01-29 15:10:10 +01:00 committed by GitHub
commit a9348fa35b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 13 deletions

View File

@ -719,12 +719,20 @@ EOF
# OPA should be built from the cached source code instead of downloading # OPA should be built from the cached source code instead of downloading
# this binary. # this binary.
# #
local opa_repo_url="$(get_package_version_from_kata_yaml externals.open-policy-agent.url)"
local opa_version="$(get_package_version_from_kata_yaml externals.open-policy-agent.version)"
if [ "$ARCH" == "ppc64le" ] || [ "$ARCH" == "s390x" ]; then if [ "$ARCH" == "ppc64le" ] || [ "$ARCH" == "s390x" ]; then
opa_repo_url="$(get_package_version_from_kata_yaml externals.open-policy-agent.url)"
info "Building OPA binary from source at ${opa_repo_url}" info "Building OPA binary from source at ${opa_repo_url}"
build_opa_from_source "${opa_repo_url}" || die "Failed to build OPA" build_opa_from_source "${opa_repo_url}" || die "Failed to build OPA"
else else
opa_bin_url="$(get_package_version_from_kata_yaml externals.open-policy-agent.meta.binary)" local opa_binary_arch
case ${ARCH} in
x86_64) opa_binary_arch="amd64" ;;
aarch64) opa_binary_arch="arm64" ;;
*) die "Unsupported architecture for the OPA binary" ;;
esac
local opa_bin_url="${opa_repo_url}/releases/download/${opa_version}/opa_linux_${opa_binary_arch}_static"
info "Downloading OPA binary from ${opa_bin_url}" info "Downloading OPA binary from ${opa_bin_url}"
curl --fail -L "${opa_bin_url}" -o opa || die "Failed to download OPA" curl --fail -L "${opa_bin_url}" -o opa || die "Failed to download OPA"
fi fi

View File

@ -297,17 +297,6 @@ externals:
description: "Open Policy Agent" description: "Open Policy Agent"
url: "https://github.com/open-policy-agent/opa" url: "https://github.com/open-policy-agent/opa"
version: "v0.55.0" version: "v0.55.0"
meta:
# - If an OPA package is available for the Guest image distro, that
# package is used instead of the binary below.
#
# - TODO: if an OPA package is not available for the Guest image distro,
# Kata should cache the OPA source code, toolchain information, etc.
# OPA should be built from the cached source code instead of downloading
# this binary.
#
# yamllint disable-line rule:line-length
binary: "https://github.com/open-policy-agent/opa/releases/download/v0.55.0/opa_linux_amd64_static"
ovmf: ovmf:
description: "Firmware, implementation of UEFI for virtual machines." description: "Firmware, implementation of UEFI for virtual machines."