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 $ cd ${GOPATH}/src/github.com/kata-containers/packaging/release
$ export NEW_VERSION=X.Y.Z $ export NEW_VERSION=X.Y.Z
$ export BRANCH="master" $ export BRANCH="master"
$ ./update-repository-version.sh -p ksm-throttler "$NEW_VERSION" "$BRANCH" $ ./update-repository-version.sh -p "$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"
``` ```
The commands from above will create a github pull request in the Kata projects. 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. Work with the Kata approvers to verify that the CI works and the PR are merged.

View File

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

View File

@ -37,7 +37,7 @@ output_should_contain "${out}" "Usage"
OK OK
echo "Missing version show help" 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 Usage >>/dev/null
echo "${out}" | grep "no new version" >>/dev/null echo "${out}" | grep "no new version" >>/dev/null
OK OK
@ -49,6 +49,6 @@ OK
echo "Local update version update should work" echo "Local update version update should work"
new_version=50.0.0 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}" output_should_contain "${out}" "release: Kata Containers ${new_version}"
OK OK