Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #745 from jcvenegas/release-1.9-improvments
Browse files Browse the repository at this point in the history
Release 1.9 improvements
  • Loading branch information
chavafg authored Oct 8, 2019
2 parents f195f7f + 7b4b1d7 commit d4997e6
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions release/update-repository-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ trap 'handle_error $LINENO' ERR
get_changes() {
local current_version=$1
[ -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
# better fail and write the error in the PR
Expand Down Expand Up @@ -91,15 +95,19 @@ bump_repo() {
git checkout "origin/${target_branch}" -b "${branch}"

# All repos we build should have a VERSION file
[ -f "VERSION" ] || die "VERSION file not found "
current_version="$(cat ./VERSION | grep -v '#')"

info "Updating VERSION file"
echo "${new_version}" >VERSION
if git diff --exit-code; then
info "${repo} already in version ${new_version}"
cat VERSION
return 0
if [ ! -f "VERSION" ]; then
current_version="new"
echo "${new_version}" >VERSION
else
current_version="$(grep -v '#' ./VERSION)"

info "Updating VERSION file"
echo "${new_version}" >VERSION
if git diff --exit-code; then
info "${repo} already in version ${new_version}"
cat VERSION
return 0
fi
fi

info "Creating PR message"
Expand All @@ -112,7 +120,15 @@ $(get_changes "$current_version")
EOT
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"
commit_msg="$(generate_commit $new_version $current_version)"
git commit -s -m "${commit_msg}"
Expand Down Expand Up @@ -147,14 +163,15 @@ EOT
exit "$exit_code"
}

# The tests repository is not included due to does not provide VERSION file.
repos=(
"agent"
"ksm-throttler"
"osbuilder"
"packaging"
"proxy"
"runtime"
"shim"
"tests"
)

main(){
Expand All @@ -167,27 +184,13 @@ main(){

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:-}
target_branch=${2:-}
[ -n "${new_version}" ] || { echo "ERROR: no new version" && usage 1; }
[ -n "${target_branch}" ] || die "no target branch"
for repo in "${repos[@]}"
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
bump_repo "${repo}" "${new_version}" "${target_branch}"
popd >>/dev/null
Expand Down

0 comments on commit d4997e6

Please sign in to comment.