mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-11 21:02:34 +00:00
Merge pull request #9825 from microsoft/mahuber/main
osbuilder: allow rootfs builds w/o git or version file deps
This commit is contained in:
commit
33d08a8417
@ -15,7 +15,7 @@ PROJECT_COMPONENT = kata-agent
|
|||||||
TARGET = $(PROJECT_COMPONENT)
|
TARGET = $(PROJECT_COMPONENT)
|
||||||
|
|
||||||
VERSION_FILE := ./VERSION
|
VERSION_FILE := ./VERSION
|
||||||
VERSION := $(shell grep -v ^\# $(VERSION_FILE))
|
VERSION := $(shell grep -v ^\# $(VERSION_FILE) 2>/dev/null || echo "unknown")
|
||||||
COMMIT_NO := $(shell git rev-parse HEAD 2>/dev/null || true)
|
COMMIT_NO := $(shell git rev-parse HEAD 2>/dev/null || true)
|
||||||
COMMIT := $(if $(shell git status --porcelain --untracked-files=no 2>/dev/null || true),${COMMIT_NO}-dirty,${COMMIT_NO})
|
COMMIT := $(if $(shell git status --porcelain --untracked-files=no 2>/dev/null || true),${COMMIT_NO}-dirty,${COMMIT_NO})
|
||||||
COMMIT_MSG = $(if $(COMMIT),$(COMMIT),unknown)
|
COMMIT_MSG = $(if $(COMMIT),$(COMMIT),unknown)
|
||||||
|
@ -417,7 +417,7 @@ SOURCES := \
|
|||||||
Cargo.toml
|
Cargo.toml
|
||||||
|
|
||||||
VERSION_FILE := ./VERSION
|
VERSION_FILE := ./VERSION
|
||||||
VERSION := $(shell grep -v ^\# $(VERSION_FILE))
|
VERSION := $(shell grep -v ^\# $(VERSION_FILE) 2>/dev/null || echo "unknown")
|
||||||
COMMIT_NO := $(shell git rev-parse HEAD 2>/dev/null || true)
|
COMMIT_NO := $(shell git rev-parse HEAD 2>/dev/null || true)
|
||||||
COMMIT := $(if $(shell git status --porcelain --untracked-files=no 2>/dev/null || true),${COMMIT_NO}-dirty,${COMMIT_NO})
|
COMMIT := $(if $(shell git status --porcelain --untracked-files=no 2>/dev/null || true),${COMMIT_NO}-dirty,${COMMIT_NO})
|
||||||
COMMIT_MSG = $(if $(COMMIT),$(COMMIT),unknown)
|
COMMIT_MSG = $(if $(COMMIT),$(COMMIT),unknown)
|
||||||
|
@ -13,7 +13,7 @@ TARGET = $(PROJECT_COMPONENT)
|
|||||||
INSTALL_PATH = $(HOME)/.cargo
|
INSTALL_PATH = $(HOME)/.cargo
|
||||||
|
|
||||||
VERSION_FILE := ./VERSION
|
VERSION_FILE := ./VERSION
|
||||||
export VERSION := $(shell grep -v ^\# $(VERSION_FILE))
|
export VERSION := $(shell grep -v ^\# $(VERSION_FILE) 2>/dev/null || echo "unknown")
|
||||||
COMMIT_NO := $(shell git rev-parse HEAD 2>/dev/null || true)
|
COMMIT_NO := $(shell git rev-parse HEAD 2>/dev/null || true)
|
||||||
COMMIT_NO_SHORT := $(shell git rev-parse --short HEAD 2>/dev/null || true)
|
COMMIT_NO_SHORT := $(shell git rev-parse --short HEAD 2>/dev/null || true)
|
||||||
export COMMIT := $(if $(shell git status --porcelain --untracked-files=no 2>/dev/null || true),${COMMIT_NO}-dirty,${COMMIT_NO})
|
export COMMIT := $(if $(shell git status --porcelain --untracked-files=no 2>/dev/null || true),${COMMIT_NO}-dirty,${COMMIT_NO})
|
||||||
|
@ -7,9 +7,10 @@
|
|||||||
TARGET = kata-log-parser
|
TARGET = kata-log-parser
|
||||||
SOURCES = $(shell find . 2>&1 | grep -E '.*\.go$$')
|
SOURCES = $(shell find . 2>&1 | grep -E '.*\.go$$')
|
||||||
|
|
||||||
VERSION := ${shell cat ./VERSION}
|
VERSION_FILE := ./VERSION
|
||||||
COMMIT_NO := $(shell git rev-parse HEAD 2> /dev/null || true)
|
VERSION := $(shell grep -v ^\# $(VERSION_FILE) 2>/dev/null || echo "unknown")
|
||||||
COMMIT := $(if $(shell git status --porcelain --untracked-files=no),"${COMMIT_NO}-dirty","${COMMIT_NO}")
|
COMMIT_NO := $(shell git rev-parse HEAD 2>/dev/null || true)
|
||||||
|
COMMIT := $(if $(shell git status --porcelain --untracked-files=no 2>/dev/null || true),"${COMMIT_NO}-dirty","${COMMIT_NO}")
|
||||||
|
|
||||||
BINDIR := $(GOPATH)/bin
|
BINDIR := $(GOPATH)/bin
|
||||||
DESTTARGET := $(abspath $(BINDIR)/$(TARGET))
|
DESTTARGET := $(abspath $(BINDIR)/$(TARGET))
|
||||||
|
@ -23,9 +23,9 @@ TARGET_IMAGE := $(IMAGES_BUILD_DEST)/kata-containers.img
|
|||||||
TARGET_INITRD := $(IMAGES_BUILD_DEST)/kata-containers-initrd.img
|
TARGET_INITRD := $(IMAGES_BUILD_DEST)/kata-containers-initrd.img
|
||||||
|
|
||||||
VERSION_FILE := ./VERSION
|
VERSION_FILE := ./VERSION
|
||||||
VERSION := $(shell grep -v ^\# $(VERSION_FILE))
|
VERSION := $(shell grep -v ^\# $(VERSION_FILE) 2>/dev/null || echo "unknown")
|
||||||
COMMIT_NO := $(shell git rev-parse HEAD 2> /dev/null || true)
|
COMMIT_NO := $(shell git rev-parse HEAD 2>/dev/null || true)
|
||||||
COMMIT := $(if $(shell git status --porcelain --untracked-files=no),${COMMIT_NO}-dirty,${COMMIT_NO})
|
COMMIT := $(if $(shell git status --porcelain --untracked-files=no 2>/dev/null || true),${COMMIT_NO}-dirty,${COMMIT_NO})
|
||||||
VERSION_COMMIT := $(if $(COMMIT),$(VERSION)-$(COMMIT),$(VERSION))
|
VERSION_COMMIT := $(if $(COMMIT),$(VERSION)-$(COMMIT),$(VERSION))
|
||||||
|
|
||||||
ifeq ($(filter $(BUILD_METHOD),$(BUILD_METHOD_LIST)),)
|
ifeq ($(filter $(BUILD_METHOD),$(BUILD_METHOD_LIST)),)
|
||||||
|
@ -395,12 +395,6 @@ build_rootfs_distro()
|
|||||||
mkdir -p ${ROOTFS_DIR}
|
mkdir -p ${ROOTFS_DIR}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# need to detect rustc's version too?
|
|
||||||
detect_rust_version ||
|
|
||||||
die "Could not detect the required rust version for AGENT_VERSION='${AGENT_VERSION:-main}'."
|
|
||||||
|
|
||||||
echo "Required rust version: $RUST_VERSION"
|
|
||||||
|
|
||||||
if [ "${SELINUX}" == "yes" ]; then
|
if [ "${SELINUX}" == "yes" ]; then
|
||||||
if [ "${AGENT_INIT}" == "yes" ]; then
|
if [ "${AGENT_INIT}" == "yes" ]; then
|
||||||
die "Guest SELinux with the agent init is not supported yet"
|
die "Guest SELinux with the agent init is not supported yet"
|
||||||
|
@ -181,7 +181,8 @@ create_summary_file()
|
|||||||
[ "$AGENT_INIT" = yes ] && agent="${init}"
|
[ "$AGENT_INIT" = yes ] && agent="${init}"
|
||||||
|
|
||||||
local -r agentdir="${script_dir}/../../../"
|
local -r agentdir="${script_dir}/../../../"
|
||||||
local -r agent_version=$(cat ${agentdir}/VERSION)
|
local agent_version=$(cat ${agentdir}/VERSION 2> /dev/null)
|
||||||
|
[ -z "$agent_version" ] && agent_version="unknown"
|
||||||
|
|
||||||
cat >"$file"<<-EOF
|
cat >"$file"<<-EOF
|
||||||
---
|
---
|
||||||
@ -224,14 +225,23 @@ generate_dockerfile()
|
|||||||
|
|
||||||
[ -n "${http_proxy:-}" ] && readonly set_proxy="RUN sed -i '$ a proxy="${http_proxy:-}"' /etc/dnf/dnf.conf /etc/yum.conf; true"
|
[ -n "${http_proxy:-}" ] && readonly set_proxy="RUN sed -i '$ a proxy="${http_proxy:-}"' /etc/dnf/dnf.conf /etc/yum.conf; true"
|
||||||
|
|
||||||
# Rust agent
|
# Only install Rust if agent needs to be built
|
||||||
readonly install_rust="
|
local install_rust=""
|
||||||
|
|
||||||
|
if [ ! -z "${AGENT_SOURCE_BIN}" ] ; then
|
||||||
|
if [ "$RUST_VERSION" == "null" ]; then
|
||||||
|
detect_rust_version || \
|
||||||
|
die "Could not detect the required rust version for AGENT_VERSION='${AGENT_VERSION:-main}'."
|
||||||
|
fi
|
||||||
|
install_rust="
|
||||||
ENV http_proxy=${http_proxy:-}
|
ENV http_proxy=${http_proxy:-}
|
||||||
ENV https_proxy=${http_proxy:-}
|
ENV https_proxy=${http_proxy:-}
|
||||||
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSLf | \
|
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSLf | \
|
||||||
sh -s -- -y --default-toolchain ${RUST_VERSION} -t ${rustarch}-unknown-linux-${LIBC}
|
sh -s -- -y --default-toolchain ${RUST_VERSION} -t ${rustarch}-unknown-linux-${LIBC}
|
||||||
RUN . /root/.cargo/env; cargo install cargo-when
|
RUN . /root/.cargo/env; cargo install cargo-when
|
||||||
"
|
"
|
||||||
|
fi
|
||||||
|
|
||||||
pushd "${dir}"
|
pushd "${dir}"
|
||||||
|
|
||||||
sed \
|
sed \
|
||||||
|
Loading…
Reference in New Issue
Block a user