mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-26 15:32:30 +00:00
rootfs-builder: add functions to run before and after the container
Define `before_starting_container` and `after_stopping_container` functions, these functions run before and after the container that builds the rootfs respectively. Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
c9d4e2c4b0
commit
3c36ce8139
@ -400,6 +400,9 @@ build_rootfs_distro()
|
||||
done
|
||||
fi
|
||||
|
||||
before_starting_container
|
||||
trap after_stopping_container EXIT
|
||||
|
||||
#Make sure we use a compatible runtime to build rootfs
|
||||
# In case Clear Containers Runtime is installed we dont want to hit issue:
|
||||
#https://github.com/clearcontainers/runtime/issues/828
|
||||
|
@ -12,18 +12,19 @@
|
||||
#
|
||||
# BIN_AGENT: Name of the Kata-Agent binary
|
||||
#
|
||||
# REPO_URL: URL to distribution repository ( should be configured in
|
||||
# REPO_URL: URL to distribution repository ( should be configured in
|
||||
# config.sh file)
|
||||
#
|
||||
# Any other configuration variable for a specific distro must be added
|
||||
# Any other configuration variable for a specific distro must be added
|
||||
# and documented on its own config.sh
|
||||
#
|
||||
#
|
||||
# - Expected result
|
||||
#
|
||||
# rootfs_dir populated with rootfs pkgs
|
||||
# It must provide a binary in /sbin/init
|
||||
#
|
||||
# Note: For some distros, the build_rootfs() function provided in scripts/lib.sh
|
||||
# Note: For some distros, the build_rootfs(), before_starting_container()
|
||||
# and after_starting_container() functions provided in scripts/lib.sh
|
||||
# will suffice. If a new distro is introduced with a special requirement,
|
||||
# then, a rootfs_builder/<distro>/rootfs_lib.sh file should be created
|
||||
# using this template.
|
||||
@ -52,3 +53,19 @@ build_rootfs() {
|
||||
# Populate ROOTFS_DIR
|
||||
# Must provide /sbin/init and /bin/${BIN_AGENT}
|
||||
}
|
||||
|
||||
before_starting_container() {
|
||||
# Run the following tasks before starting the container that builds the rootfs.
|
||||
# For example:
|
||||
# * Create a container
|
||||
# * Create a volume
|
||||
return 0
|
||||
}
|
||||
|
||||
after_stopping_container() {
|
||||
# Run the following tasks after stoping the container that builds the rootfs.
|
||||
# For example:
|
||||
# * Delete a container
|
||||
# * Delete a volume
|
||||
return 0
|
||||
}
|
||||
|
@ -421,3 +421,11 @@ detect_musl_version()
|
||||
|
||||
[ "$?" == "0" ] && [ "$MUSL_VERSION" != "null" ]
|
||||
}
|
||||
|
||||
before_starting_container() {
|
||||
return 0
|
||||
}
|
||||
|
||||
after_stopping_container() {
|
||||
return 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user