Merge pull request #745 from jcvenegas/release-1.9-improvments

Release 1.9 improvements
This commit is contained in:
Salvador Fuentes
2019-10-08 15:22:43 -05:00
committed by GitHub

View File

@@ -36,6 +36,10 @@ trap 'handle_error $LINENO' ERR
get_changes() { get_changes() {
local current_version=$1 local current_version=$1
[ -n "${current_version}" ] || die "current version not provided" [ -n "${current_version}" ] || die "current version not provided"
if [ "${current_version}" == "new" ];then
echo "Starting to version this repository"
return
fi
# If for some reason there is not a tag this could fail # If for some reason there is not a tag this could fail
# better fail and write the error in the PR # better fail and write the error in the PR
@@ -91,15 +95,19 @@ bump_repo() {
git checkout "origin/${target_branch}" -b "${branch}" git checkout "origin/${target_branch}" -b "${branch}"
# All repos we build should have a VERSION file # All repos we build should have a VERSION file
[ -f "VERSION" ] || die "VERSION file not found " if [ ! -f "VERSION" ]; then
current_version="$(cat ./VERSION | grep -v '#')" current_version="new"
echo "${new_version}" >VERSION
else
current_version="$(grep -v '#' ./VERSION)"
info "Updating VERSION file" info "Updating VERSION file"
echo "${new_version}" >VERSION echo "${new_version}" >VERSION
if git diff --exit-code; then if git diff --exit-code; then
info "${repo} already in version ${new_version}" info "${repo} already in version ${new_version}"
cat VERSION cat VERSION
return 0 return 0
fi
fi fi
info "Creating PR message" info "Creating PR message"
@@ -112,7 +120,15 @@ $(get_changes "$current_version")
EOT EOT
cat "${notes_file}" cat "${notes_file}"
git add -u if (echo "${current_version}" | grep "alpha") && (echo "${new_version}" | grep -v "alpha");then
info "update move from alpha, check if new version is rc0"
if echo "$new_version" | grep -v "rc0"; then
die "bump should be from alph to rc0"
fi
info "OK"
fi
git add VERSION
info "Creating commit with new changes" info "Creating commit with new changes"
commit_msg="$(generate_commit $new_version $current_version)" commit_msg="$(generate_commit $new_version $current_version)"
git commit -s -m "${commit_msg}" git commit -s -m "${commit_msg}"
@@ -147,14 +163,15 @@ EOT
exit "$exit_code" exit "$exit_code"
} }
# The tests repository is not included due to does not provide VERSION file.
repos=( repos=(
"agent" "agent"
"ksm-throttler" "ksm-throttler"
"osbuilder" "osbuilder"
"packaging"
"proxy" "proxy"
"runtime" "runtime"
"shim" "shim"
"tests"
) )
main(){ main(){
@@ -167,15 +184,6 @@ main(){
shift $((OPTIND - 1)) shift $((OPTIND - 1))
declare -A bump_stable
# ksm-throttler is a project with low activity
# Also it has low interdependency with other Kata projects.
# Lets keep this as a single branch to simplify maintenance.
bump_stable[ksm-throttler]=no
# The image format is not likely to happen, unless a breaking change happens
# If image format breaks Kata major version should change 1.X to 2.X
# Lets keep this as a single branch to simplify maintenance.
bump_stable[osbuilder]=no
new_version=${1:-} new_version=${1:-}
target_branch=${2:-} target_branch=${2:-}
@@ -183,11 +191,6 @@ main(){
[ -n "${target_branch}" ] || die "no target branch" [ -n "${target_branch}" ] || die "no target branch"
for repo in "${repos[@]}" for repo in "${repos[@]}"
do do
echo "Bump ${repo} has stable : ${bump_stable[$repo]:-yes}"
if [ ${bump_stable[$repo]:-yes} == "no" ] && [[ ${target_branch} =~ .*stable-.* ]] ;then
echo "Not stable branch supported"
continue
fi
pushd "$tmp_dir" >>/dev/null pushd "$tmp_dir" >>/dev/null
bump_repo "${repo}" "${new_version}" "${target_branch}" bump_repo "${repo}" "${new_version}" "${target_branch}"
popd >>/dev/null popd >>/dev/null