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,6 +130,18 @@ EOT
exit "$exit_code" exit "$exit_code"
} }
# 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 while getopts "hp" opt; do
case $opt in case $opt in
h) usage 0 ;; h) usage 0 ;;
@ -140,13 +151,31 @@ done
shift $((OPTIND - 1)) shift $((OPTIND - 1))
repo=${1:-} declare -A bump_stable
new_version=${2:-} # ksm-throttler is a project with low activity
target_branch=${3:-} # Also it has low interdependency with other Kata projects.
[ -n "${repo}" ] || (echo "ERROR: repository not provided" && usage 1) # Lets keep this as a single branch to simplify maintenance.
[ -n "${new_version}" ] || (echo "ERROR: no new version" && usage 1) bump_stable[ksm-throttler]=no
[ -n "${target_branch}" ] || die "no target branch" # 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 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
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