mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-09 20:58:55 +00:00
Merge pull request #256 from marcov/fix-versions
Update versions.txt content and detect versions misalignment
This commit is contained in:
@@ -25,15 +25,18 @@ export BUILD_DISTROS=${BUILD_DISTROS:-xUbuntu_16.04}
|
|||||||
export AUTHOR="${AUTHOR:-user}"
|
export AUTHOR="${AUTHOR:-user}"
|
||||||
export AUTHOR_EMAIL="${AUTHOR_EMAIL:-user@example.com}"
|
export AUTHOR_EMAIL="${AUTHOR_EMAIL:-user@example.com}"
|
||||||
|
|
||||||
usage() {
|
die() {
|
||||||
msg="${1:-}"
|
local msg="${1:-}"
|
||||||
exit_code=$"${2:-0}"
|
local print_usage=$"${2:-}"
|
||||||
if [ -n "${msg}" ]; then
|
if [ -n "${msg}" ]; then
|
||||||
local logPrefix=""
|
echo -e "ERROR: ${msg}\n"
|
||||||
[ ${exit_code} != "0" ] && logPrefix="ERROR: "
|
|
||||||
echo -e "${logPrefix}${msg}\n"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ -n "${print_usage}" ] && usage 1
|
||||||
|
}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
exit_code=$"${1:-0}"
|
||||||
cat <<EOT
|
cat <<EOT
|
||||||
Usage:
|
Usage:
|
||||||
${script_name} [-h | --help] <kata-branch> [PROJ1 PROJ2 ... ]
|
${script_name} [-h | --help] <kata-branch> [PROJ1 PROJ2 ... ]
|
||||||
@@ -56,13 +59,13 @@ EOT
|
|||||||
main() {
|
main() {
|
||||||
case "${1:-}" in
|
case "${1:-}" in
|
||||||
"-h"|"--help")
|
"-h"|"--help")
|
||||||
usage "" "0"
|
usage
|
||||||
;;
|
;;
|
||||||
-*)
|
-*)
|
||||||
usage "Invalid option: ${1:-}" "1"
|
die "Invalid option: ${1:-}" "1"
|
||||||
;;
|
;;
|
||||||
"")
|
"")
|
||||||
usage "missing branch" "1"
|
die "missing branch" "1"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
branch="${1:-}"
|
branch="${1:-}"
|
||||||
@@ -74,8 +77,10 @@ main() {
|
|||||||
[ "${#projectsList[@]}" = "0" ] && projectsList=("${OBS_PKGS_PROJECTS[@]}")
|
[ "${#projectsList[@]}" = "0" ] && projectsList=("${OBS_PKGS_PROJECTS[@]}")
|
||||||
|
|
||||||
pushd "${script_dir}" >>/dev/null
|
pushd "${script_dir}" >>/dev/null
|
||||||
|
local compare_result="$(./gen_versions_txt.sh --compare ${branch})"
|
||||||
|
[[ "$compare_result" =~ different ]] && die "$compare_result -- you need to run gen_versions_txt.sh"
|
||||||
for p in "${projectsList[@]}"; do
|
for p in "${projectsList[@]}"; do
|
||||||
[ -d "$p" ] || usage "$p is not a valid project directory" "1"
|
[ -d "$p" ] || die "$p is not a valid project directory"
|
||||||
update_cmd="./update.sh"
|
update_cmd="./update.sh"
|
||||||
if [ -n "${PUSH}" ]; then
|
if [ -n "${PUSH}" ]; then
|
||||||
# push to obs
|
# push to obs
|
||||||
|
@@ -12,16 +12,22 @@ set -o pipefail
|
|||||||
|
|
||||||
readonly script_name="$(basename "${BASH_SOURCE[0]}")"
|
readonly script_name="$(basename "${BASH_SOURCE[0]}")"
|
||||||
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
readonly versions_txt="versions.txt"
|
||||||
project="kata-containers"
|
project="kata-containers"
|
||||||
ARCH=${ARCH:-$(go env GOARCH)}
|
ARCH=${ARCH:-$(go env GOARCH)}
|
||||||
|
|
||||||
source "${script_dir}/../scripts/lib.sh"
|
source "${script_dir}/../scripts/lib.sh"
|
||||||
|
|
||||||
|
get_kata_version() {
|
||||||
|
local branch="$1"
|
||||||
|
curl -SsL "https://raw.githubusercontent.com/${project}/runtime/${branch}/VERSION"
|
||||||
|
}
|
||||||
|
|
||||||
gen_version_file() {
|
gen_version_file() {
|
||||||
local branch="$1"
|
local branch="$1"
|
||||||
[ -n "${branch}" ] || exit 1
|
[ -n "${branch}" ] || exit 1
|
||||||
|
|
||||||
local kata_version=$(curl --silent -L "https://raw.githubusercontent.com/${project}/runtime/${branch}/VERSION")
|
local kata_version=$(get_kata_version "${branch}")
|
||||||
kata_runtime_hash=$(get_kata_hash_from_tag "runtime" "${kata_version}")
|
kata_runtime_hash=$(get_kata_hash_from_tag "runtime" "${kata_version}")
|
||||||
kata_proxy_hash=$(get_kata_hash_from_tag "proxy" "${kata_version}")
|
kata_proxy_hash=$(get_kata_hash_from_tag "proxy" "${kata_version}")
|
||||||
kata_shim_hash=$(get_kata_hash_from_tag "shim" "${kata_version}")
|
kata_shim_hash=$(get_kata_hash_from_tag "shim" "${kata_version}")
|
||||||
@@ -46,10 +52,11 @@ gen_version_file() {
|
|||||||
# - is not a valid char for rpmbuild
|
# - is not a valid char for rpmbuild
|
||||||
# see https://github.com/semver/semver/issues/145
|
# see https://github.com/semver/semver/issues/145
|
||||||
kata_version=${kata_version/-/\~}
|
kata_version=${kata_version/-/\~}
|
||||||
cat >versions.txt <<EOT
|
cat > "$versions_txt" <<EOT
|
||||||
|
|
||||||
# This is a generated file from ${script_name}
|
# This is a generated file from ${script_name}
|
||||||
|
|
||||||
|
kata_version=${kata_version}
|
||||||
|
|
||||||
kata_runtime_version=${kata_version}
|
kata_runtime_version=${kata_version}
|
||||||
kata_runtime_hash=${kata_runtime_hash}
|
kata_runtime_hash=${kata_runtime_hash}
|
||||||
|
|
||||||
@@ -82,20 +89,60 @@ go_checksum=${golang_sha256}
|
|||||||
EOT
|
EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
die() {
|
||||||
|
local msg="${1:-}"
|
||||||
|
local print_usage=$"${2:-}"
|
||||||
|
if [ -n "${msg}" ]; then
|
||||||
|
echo -e "ERROR: ${msg}\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -n "${print_usage}" ] && usage 1
|
||||||
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
msg="${1:-}"
|
exit_code=$"${1:-0}"
|
||||||
exit_code=$"${2:-0}"
|
|
||||||
cat <<EOT
|
cat <<EOT
|
||||||
${msg}
|
|
||||||
Usage:
|
Usage:
|
||||||
${script_name} <kata-branch>
|
${script_name} [--compare | -h | --help] <kata-branch>
|
||||||
|
|
||||||
|
Generate a ${versions_txt} file, containing version numbers and commit hashes
|
||||||
|
of all the kata components under the git branch <kata-branch>.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
-h, --help Print this help.
|
||||||
|
--compare Only compare the kata version at branch <kata-branch> with the
|
||||||
|
one in ${versions_txt} and leave the file untouched.
|
||||||
EOT
|
EOT
|
||||||
exit "${exit_code}"
|
exit "${exit_code}"
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
local compareOnly=
|
||||||
|
|
||||||
|
case "${1:-}" in
|
||||||
|
"-h"|"--help")
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
--compare)
|
||||||
|
compareOnly=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
die "Invalid option: ${1:-}" "1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
local branch="${1:-}"
|
local branch="${1:-}"
|
||||||
[ -n "${branch}" ] || usage "missing branch" "1"
|
[ -n "${branch}" ] || die "No branch specified" "1"
|
||||||
|
|
||||||
|
if [ -n "$compareOnly" ]; then
|
||||||
|
source "./${versions_txt}" || exit 1
|
||||||
|
[ -n "${kata_version}" ] || die "${version_file} does not contain a valid kata_version variable"
|
||||||
|
[ "$(get_kata_version $branch)" = "${kata_version}" ] && compare_result="matches" || compare_result="is different from"
|
||||||
|
echo "${kata_version} in ${versions_txt} ${compare_result} the version at branch ${branch}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
gen_version_file "${branch}"
|
gen_version_file "${branch}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,23 +1,24 @@
|
|||||||
|
|
||||||
# This is a generated file from gen_versions_txt.sh
|
# This is a generated file from gen_versions_txt.sh
|
||||||
|
|
||||||
kata_runtime_version=1.3.0
|
kata_version=1.4.0
|
||||||
kata_runtime_hash=a786643d0b3c0195deeb6ef5d4c2a161009a80aa
|
|
||||||
|
|
||||||
kata_proxy_version=1.3.0
|
kata_runtime_version=1.4.0
|
||||||
kata_proxy_hash=6ddb006ad3f709cab018af9dc0bf9e756c3ce2cd
|
kata_runtime_hash=21f005948717eb4fd232f7f3eb6d4fd3f93b6387
|
||||||
|
|
||||||
kata_shim_version=1.3.0
|
kata_proxy_version=1.4.0
|
||||||
kata_shim_hash=5fbf1f0919ce0bb1f2b7e85692cdf3058023926f
|
kata_proxy_hash=e1856c20778348562581d7364d7b22642c594fe5
|
||||||
|
|
||||||
kata_agent_version=1.3.0
|
kata_shim_version=1.4.0
|
||||||
kata_agent_hash=042c3ebd71c2ca425aa0c70fadcbf6370116659b
|
kata_shim_hash=b02868bfcd086ebc25a36aa7c9ff8ddf74429b72
|
||||||
|
|
||||||
kata_ksm_throttler_version=1.3.0
|
kata_agent_version=1.4.0
|
||||||
kata_ksm_throttler_hash=6e903fb19378a1a6132f8d3a43b65ee9c1643673
|
kata_agent_hash=0ff30063f7e71eb0f48d60c21156cd18b8a58024
|
||||||
|
|
||||||
|
kata_ksm_throttler_version=1.4.0
|
||||||
|
kata_ksm_throttler_hash=1212de221aac7fe0092e2ce2ac18cf794ecf8c89
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
kata_osbuilder_version=1.3.0
|
kata_osbuilder_version=1.4.0
|
||||||
|
|
||||||
qemu_lite_version=2.11.0
|
qemu_lite_version=2.11.0
|
||||||
qemu_lite_hash=f88622805677163b04498dcba35ceca0183b1318
|
qemu_lite_hash=f88622805677163b04498dcba35ceca0183b1318
|
||||||
@@ -28,5 +29,5 @@ qemu_vanilla_hash=0982a56a551556c704dc15752dabf57b4be1c640
|
|||||||
kernel_version=4.14.67
|
kernel_version=4.14.67
|
||||||
|
|
||||||
# Golang
|
# Golang
|
||||||
go_version=1.10.2
|
go_version=1.11.1
|
||||||
go_checksum=4b677d698c65370afa33757b6954ade60347aaca310ea92a63ed717d7cb0c2ff
|
go_checksum=2871270d8ff0c8c69f161aaae42f9f28739855ff5c5204752a8d92a1c9f63993
|
||||||
|
Reference in New Issue
Block a user