bump-repos: Bump all repos from script

Simplify the pipeline code by doing all the bumps.

- Instead of get the repo to bump, make the script bump them all
- Do not bump osbuilder and ksm on stable branches.
- Simplify usage for automation.

Fixes: #443

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
Jose Carlos Venegas Munoz 2019-04-16 14:01:01 -05:00
parent 2c624b12e1
commit 65e55a8b2c
3 changed files with 49 additions and 25 deletions

View File

@ -63,12 +63,7 @@ $ git pull
$ cd ${GOPATH}/src/github.com/kata-containers/packaging/release
$ export NEW_VERSION=X.Y.Z
$ export BRANCH="master"
$ ./update-repository-version.sh -p ksm-throttler "$NEW_VERSION" "$BRANCH"
$ ./update-repository-version.sh -p proxy "$NEW_VERSION" "$BRANCH"
$ ./update-repository-version.sh -p shim "$NEW_VERSION" "$BRANCH"
$ ./update-repository-version.sh -p runtime "$NEW_VERSION" "$BRANCH"
$ ./update-repository-version.sh -p osbuilder "$NEW_VERSION" "$BRANCH"
$ ./update-repository-version.sh -p agent "$NEW_VERSION" "$BRANCH"
$ ./update-repository-version.sh -p "$NEW_VERSION" "$BRANCH"
```
The commands from above will create a github pull request in the Kata projects.
Work with the Kata approvers to verify that the CI works and the PR are merged.

View File

@ -119,7 +119,6 @@ usage() {
Usage:
${script_name} [options] <args>
Args:
<repository-name> : Name of repository to fork and send PR from github.com/${organization}
<new-version> : New version to bump the repository
<target-branch> : The base branch to create to PR
Example:
@ -131,22 +130,52 @@ EOT
exit "$exit_code"
}
while getopts "hp" opt; do
# The tests repository is not included due to does not provide VERSION file.
repos=(
"agent"
"ksm-throttler"
"osbuilder"
"proxy"
"runtime"
"shim"
)
main(){
while getopts "hp" opt; do
case $opt in
h) usage 0 ;;
p) PUSH="true" ;;
esac
done
done
shift $((OPTIND - 1))
shift $((OPTIND - 1))
repo=${1:-}
new_version=${2:-}
target_branch=${3:-}
[ -n "${repo}" ] || (echo "ERROR: repository not provided" && usage 1)
[ -n "${new_version}" ] || (echo "ERROR: no new version" && usage 1)
[ -n "${target_branch}" ] || die "no target branch"
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
pushd "$tmp_dir" >>/dev/null
bump_repo "${repo}" "${new_version}" "${target_branch}"
popd >>/dev/null
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
done
}
main $@

View File

@ -37,7 +37,7 @@ output_should_contain "${out}" "Usage"
OK
echo "Missing version show help"
out=$("${script_dir}/update-repository-version.sh" "runtime" 2>&1) || (($? != 0))
out=$("${script_dir}/update-repository-version.sh" 2>&1) || (($? != 0))
echo "${out}" | grep Usage >>/dev/null
echo "${out}" | grep "no new version" >>/dev/null
OK
@ -49,6 +49,6 @@ OK
echo "Local update version update should work"
new_version=50.0.0
out=$("${script_dir}/update-repository-version.sh" "runtime" "${new_version}" "master" 2>&1)
out=$("${script_dir}/update-repository-version.sh" "${new_version}" "master" 2>&1)
output_should_contain "${out}" "release: Kata Containers ${new_version}"
OK