bump: version all repos

Instead of have special cases, just
bump all, bumps are check and more if are automated.

CI probbly not, but we can skip if necesary.

Fixes: #744

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
Jose Carlos Venegas Munoz 2019-10-08 18:43:22 +00:00
parent 949d7631d8
commit 2bab82abb9

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,8 +95,11 @@ 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
@ -101,6 +108,7 @@ bump_repo() {
cat VERSION cat VERSION
return 0 return 0
fi fi
fi
info "Creating PR message" info "Creating PR message"
notes_file=notes.md notes_file=notes.md
@ -147,14 +155,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 +176,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 +183,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