Skip to content

Commit

Permalink
bump-repos: Bump all repos from script
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jcvenegas committed May 3, 2019
1 parent 2c624b1 commit 65e55a8
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 28 deletions.
7 changes: 1 addition & 6 deletions release/release.md
Expand Up @@ -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.
Expand Down
69 changes: 49 additions & 20 deletions release/update-repository-version.sh
Expand Up @@ -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:
Expand All @@ -131,22 +130,52 @@ EOT
exit "$exit_code"
}

while getopts "hp" opt; do
case $opt in
h) usage 0 ;;
p) PUSH="true" ;;
esac
done

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"

pushd "$tmp_dir" >>/dev/null
bump_repo "${repo}" "${new_version}" "${target_branch}"
popd >>/dev/null
# 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

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
done

}
main $@
4 changes: 2 additions & 2 deletions release/update-repository-version_test.sh
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 65e55a8

Please sign in to comment.