mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-27 15:57:09 +00:00
Merge pull request #9489 from BbolroC/install-opa-in-docker
rootfs: Make OPA build working in docker for s390x and pp…
This commit is contained in:
commit
cc22dc33f2
@ -553,10 +553,9 @@ build_opa_from_source()
|
|||||||
local opa_repo_url=$1
|
local opa_repo_url=$1
|
||||||
opa_version="$(get_package_version_from_kata_yaml externals.open-policy-agent.version)"
|
opa_version="$(get_package_version_from_kata_yaml externals.open-policy-agent.version)"
|
||||||
|
|
||||||
if [ ${CROSS_BUILD} == "yes" ]; then
|
export PATH="$PATH:/usr/local/go/bin"
|
||||||
export GOOS="${TARGET_OS}"
|
export GOOS="${TARGET_OS}"
|
||||||
export GOARCH="${TARGET_ARCH}}"
|
[ ${CROSS_BUILD} == "yes" ] && export GOARCH="${TARGET_ARCH}" || export GOARCH="$(uname -m)"
|
||||||
fi
|
|
||||||
|
|
||||||
current_dir="$(pwd)"
|
current_dir="$(pwd)"
|
||||||
pushd $(mktemp -d) &>/dev/null
|
pushd $(mktemp -d) &>/dev/null
|
||||||
@ -565,7 +564,7 @@ build_opa_from_source()
|
|||||||
cd opa
|
cd opa
|
||||||
export WASM_ENABLED=0
|
export WASM_ENABLED=0
|
||||||
export DOCKER_RUNNING=0
|
export DOCKER_RUNNING=0
|
||||||
make ci-go-ci-build-linux-static || return 1
|
make ci-build-linux-static || return 1
|
||||||
|
|
||||||
info "Copy OPA binary to ${current_dir}/opa"
|
info "Copy OPA binary to ${current_dir}/opa"
|
||||||
binary_name="_release/${opa_version##v}/opa_${GOOS}_${GOARCH}_static"
|
binary_name="_release/${opa_version##v}/opa_${GOOS}_${GOARCH}_static"
|
||||||
|
@ -6,6 +6,7 @@ ARG IMAGE_REGISTRY=docker.io
|
|||||||
FROM ${IMAGE_REGISTRY}/ubuntu:@OS_VERSION@
|
FROM ${IMAGE_REGISTRY}/ubuntu:@OS_VERSION@
|
||||||
@SET_PROXY@
|
@SET_PROXY@
|
||||||
|
|
||||||
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
# makedev tries to mknod from postinst
|
# makedev tries to mknod from postinst
|
||||||
RUN [ -x /usr/bin/systemd-detect-virt ] || ( echo "echo docker" >/usr/bin/systemd-detect-virt && chmod +x /usr/bin/systemd-detect-virt )
|
RUN [ -x /usr/bin/systemd-detect-virt ] || ( echo "echo docker" >/usr/bin/systemd-detect-virt && chmod +x /usr/bin/systemd-detect-virt )
|
||||||
# hadolint ignore=DL3009,SC2046
|
# hadolint ignore=DL3009,SC2046
|
||||||
@ -29,7 +30,9 @@ RUN apt-get update && \
|
|||||||
multistrap \
|
multistrap \
|
||||||
musl-tools \
|
musl-tools \
|
||||||
protobuf-compiler \
|
protobuf-compiler \
|
||||||
xz-utils
|
xz-utils && \
|
||||||
|
( go_version="@GO_VERSION@" && [ "${go_version}" = "" ] || ( \
|
||||||
|
echo "Installing go @GO_VERSION@" && curl -sSL "https://golang.org/dl/go@GO_VERSION@.linux-@ARCH@.tar.gz" | tar -xz -C /usr/local ))
|
||||||
# aarch64 requires this name -- link for all
|
# aarch64 requires this name -- link for all
|
||||||
RUN if [ ! -f "/usr/bin/$(uname -m)-linux-musl-gcc" ]; then ln -s /usr/bin/musl-gcc "/usr/bin/$(uname -m)-linux-musl-gcc"; fi
|
RUN if [ ! -f "/usr/bin/$(uname -m)-linux-musl-gcc" ]; then ln -s /usr/bin/musl-gcc "/usr/bin/$(uname -m)-linux-musl-gcc"; fi
|
||||||
|
|
||||||
|
@ -237,6 +237,7 @@ RUN . /root/.cargo/env; cargo install cargo-when
|
|||||||
sed \
|
sed \
|
||||||
-e "s#@OS_VERSION@#${OS_VERSION:-}#g" \
|
-e "s#@OS_VERSION@#${OS_VERSION:-}#g" \
|
||||||
-e "s#@ARCH@#$ARCH#g" \
|
-e "s#@ARCH@#$ARCH#g" \
|
||||||
|
-e "s#@GO_VERSION@#$GO_VERSION#g" \
|
||||||
-e "s#@INSTALL_RUST@#${install_rust//$'\n'/\\n}#g" \
|
-e "s#@INSTALL_RUST@#${install_rust//$'\n'/\\n}#g" \
|
||||||
-e "s#@SET_PROXY@#${set_proxy:-}#g" \
|
-e "s#@SET_PROXY@#${set_proxy:-}#g" \
|
||||||
Dockerfile.in > Dockerfile
|
Dockerfile.in > Dockerfile
|
||||||
|
@ -47,7 +47,8 @@ build_initrd() {
|
|||||||
AGENT_POLICY="${AGENT_POLICY:-}" \
|
AGENT_POLICY="${AGENT_POLICY:-}" \
|
||||||
PULL_TYPE="${PULL_TYPE:-default}" \
|
PULL_TYPE="${PULL_TYPE:-default}" \
|
||||||
COCO_GUEST_COMPONENTS_TARBALL="${COCO_GUEST_COMPONENTS_TARBALL:-}" \
|
COCO_GUEST_COMPONENTS_TARBALL="${COCO_GUEST_COMPONENTS_TARBALL:-}" \
|
||||||
PAUSE_IMAGE_TARBALL="${PAUSE_IMAGE_TARBALL:-}"
|
PAUSE_IMAGE_TARBALL="${PAUSE_IMAGE_TARBALL:-}" \
|
||||||
|
GO_VERSION="${GO_VERSION:-}"
|
||||||
mv "kata-containers-initrd.img" "${install_dir}/${artifact_name}"
|
mv "kata-containers-initrd.img" "${install_dir}/${artifact_name}"
|
||||||
(
|
(
|
||||||
cd "${install_dir}"
|
cd "${install_dir}"
|
||||||
@ -69,7 +70,8 @@ build_image() {
|
|||||||
AGENT_POLICY="${AGENT_POLICY:-}" \
|
AGENT_POLICY="${AGENT_POLICY:-}" \
|
||||||
PULL_TYPE="${PULL_TYPE:-default}" \
|
PULL_TYPE="${PULL_TYPE:-default}" \
|
||||||
COCO_GUEST_COMPONENTS_TARBALL="${COCO_GUEST_COMPONENTS_TARBALL:-}" \
|
COCO_GUEST_COMPONENTS_TARBALL="${COCO_GUEST_COMPONENTS_TARBALL:-}" \
|
||||||
PAUSE_IMAGE_TARBALL="${PAUSE_IMAGE_TARBALL:-}"
|
PAUSE_IMAGE_TARBALL="${PAUSE_IMAGE_TARBALL:-}" \
|
||||||
|
GO_VERSION="${GO_VERSION:-}"
|
||||||
mv -f "kata-containers.img" "${install_dir}/${artifact_name}"
|
mv -f "kata-containers.img" "${install_dir}/${artifact_name}"
|
||||||
if [ -e "root_hash.txt" ]; then
|
if [ -e "root_hash.txt" ]; then
|
||||||
cp root_hash.txt "${install_dir}/"
|
cp root_hash.txt "${install_dir}/"
|
||||||
|
@ -315,6 +315,11 @@ install_image() {
|
|||||||
if [ "${variant}" == "confidential" ]; then
|
if [ "${variant}" == "confidential" ]; then
|
||||||
export COCO_GUEST_COMPONENTS_TARBALL="$(get_coco_guest_components_tarball_path)"
|
export COCO_GUEST_COMPONENTS_TARBALL="$(get_coco_guest_components_tarball_path)"
|
||||||
export PAUSE_IMAGE_TARBALL="$(get_pause_image_tarball_path)"
|
export PAUSE_IMAGE_TARBALL="$(get_pause_image_tarball_path)"
|
||||||
|
# GO_VERSION should be exported to install the package in ubuntu-rootfs-osbuilder
|
||||||
|
# This is necessary for installing opa from the source for s390x and ppc64le
|
||||||
|
if [ "${AGENT_POLICY}" == "yes" ] && [ "${ARCH}" == "s390x" -o "${ARCH}" == "ppc64le" ]; then
|
||||||
|
export GO_VERSION=$(get_from_kata_deps "languages.golang.meta.newest-version")
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
os_name="$(get_from_kata_deps "assets.image.architecture.${ARCH}.name")"
|
os_name="$(get_from_kata_deps "assets.image.architecture.${ARCH}.name")"
|
||||||
@ -384,6 +389,11 @@ install_initrd() {
|
|||||||
if [ "${variant}" == "confidential" ]; then
|
if [ "${variant}" == "confidential" ]; then
|
||||||
export COCO_GUEST_COMPONENTS_TARBALL="$(get_coco_guest_components_tarball_path)"
|
export COCO_GUEST_COMPONENTS_TARBALL="$(get_coco_guest_components_tarball_path)"
|
||||||
export PAUSE_IMAGE_TARBALL="$(get_pause_image_tarball_path)"
|
export PAUSE_IMAGE_TARBALL="$(get_pause_image_tarball_path)"
|
||||||
|
# GO_VERSION should be exported to install the package in ubuntu-rootfs-osbuilder
|
||||||
|
# This is necessary for installing opa from the source for s390x and ppc64le
|
||||||
|
if [ "${AGENT_POLICY}" == "yes" ] && [ "${ARCH}" == "s390x" -o "${ARCH}" == "ppc64le" ]; then
|
||||||
|
export GO_VERSION=$(get_from_kata_deps "languages.golang.meta.newest-version")
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
os_name="$(get_from_kata_deps "assets.initrd.architecture.${ARCH}.name")"
|
os_name="$(get_from_kata_deps "assets.initrd.architecture.${ARCH}.name")"
|
||||||
|
Loading…
Reference in New Issue
Block a user