mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-19 01:39:48 +00:00
Merge pull request #141 from jcvenegas/release-multi-branch
release: support release branches.
This commit is contained in:
commit
6a18753dfe
@ -15,10 +15,10 @@ script_name="$(basename "${BASH_SOURCE[0]}")"
|
|||||||
OWNER=${OWNER:-"kata-containers"}
|
OWNER=${OWNER:-"kata-containers"}
|
||||||
PROJECT="Kata Containers"
|
PROJECT="Kata Containers"
|
||||||
PUSH="${PUSH:-"false"}"
|
PUSH="${PUSH:-"false"}"
|
||||||
commit="master"
|
branch="master"
|
||||||
readonly URL_RAW_FILE="https://raw.githubusercontent.com/${OWNER}"
|
readonly URL_RAW_FILE="https://raw.githubusercontent.com/${OWNER}"
|
||||||
#The runtime version is used as reference of latest release
|
#The runtime version is used as reference of latest release
|
||||||
readonly kata_version=$(curl -Ls "${URL_RAW_FILE}/runtime/${commit}/VERSION" | grep -v -P "^#")
|
readonly kata_version=$(curl -Ls "${URL_RAW_FILE}/runtime/${branch}/VERSION" | grep -v -P "^#")
|
||||||
|
|
||||||
source "${script_dir}/../scripts/lib.sh"
|
source "${script_dir}/../scripts/lib.sh"
|
||||||
|
|
||||||
@ -40,6 +40,7 @@ status : Get Current ${PROJECT} tags status
|
|||||||
tag : Create tags for ${PROJECT}
|
tag : Create tags for ${PROJECT}
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
-b <branch>: branch were will check the version.
|
||||||
-h : Show this help
|
-h : Show this help
|
||||||
-p : push tags
|
-p : push tags
|
||||||
|
|
||||||
@ -77,7 +78,7 @@ check_versions() {
|
|||||||
info "Check all repos has version ${kata_version} in VERSION file"
|
info "Check all repos has version ${kata_version} in VERSION file"
|
||||||
|
|
||||||
for repo in "${repos[@]}"; do
|
for repo in "${repos[@]}"; do
|
||||||
repo_version=$(curl -Ls "${URL_RAW_FILE}/${repo}/${commit}/VERSION" | grep -v -P "^#")
|
repo_version=$(curl -Ls "${URL_RAW_FILE}/${repo}/${branch}/VERSION" | grep -v -P "^#")
|
||||||
info "${repo} is in $repo_version"
|
info "${repo} is in $repo_version"
|
||||||
[ "${repo_version}" == "${kata_version}" ] || die "${repo} is not in version ${kata_version}"
|
[ "${repo_version}" == "${kata_version}" ] || die "${repo} is not in version ${kata_version}"
|
||||||
done
|
done
|
||||||
@ -130,8 +131,9 @@ create_github_release() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts "hp" opt; do
|
while getopts "b:hp" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
|
b) branch="${OPTARG}" ;;
|
||||||
h) usage && exit 0 ;;
|
h) usage && exit 0 ;;
|
||||||
p) PUSH="true" ;;
|
p) PUSH="true" ;;
|
||||||
esac
|
esac
|
||||||
|
@ -59,11 +59,13 @@ generate_commit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bump_repo() {
|
bump_repo() {
|
||||||
repo=$1
|
local repo="${1:-}"
|
||||||
new_version=$2
|
local new_version="${2:-}"
|
||||||
|
local target_branch="${3:-}"
|
||||||
[ -n "${repo}" ] || die "repository not provided"
|
[ -n "${repo}" ] || die "repository not provided"
|
||||||
[ -n "$new_version" ] || die "no new version"
|
[ -n "${new_version}" ] || die "no new version"
|
||||||
remote_github="https://github.com/${organization}/${repo}.git"
|
[ -n "${target_branch}" ] || die "no target branch"
|
||||||
|
local remote_github="https://github.com/${organization}/${repo}.git"
|
||||||
info "Update $repo to version $new_version"
|
info "Update $repo to version $new_version"
|
||||||
|
|
||||||
info "remote: ${remote_github}"
|
info "remote: ${remote_github}"
|
||||||
@ -88,7 +90,8 @@ EOT
|
|||||||
info "Updating VERSION file"
|
info "Updating VERSION file"
|
||||||
echo "${new_version}" >VERSION
|
echo "${new_version}" >VERSION
|
||||||
branch="${new_version}-branch-bump"
|
branch="${new_version}-branch-bump"
|
||||||
git checkout -b "${branch}" master
|
git fetch origin "${target_branch}"
|
||||||
|
git checkout "origin/${target_branch}" -b "${branch}"
|
||||||
git add -u
|
git add -u
|
||||||
info "Creating commit with new changes"
|
info "Creating commit with new changes"
|
||||||
commit_msg="$(generate_commit $new_version $current_version)"
|
commit_msg="$(generate_commit $new_version $current_version)"
|
||||||
@ -102,7 +105,7 @@ EOT
|
|||||||
${hub_bin} push fork -f "${branch}"
|
${hub_bin} push fork -f "${branch}"
|
||||||
info "Create PR"
|
info "Create PR"
|
||||||
out=""
|
out=""
|
||||||
out=$("${hub_bin}" pull-request -F "${notes_file}" 2>&1) || echo "$out" | grep "A pull request already exists"
|
out=$("${hub_bin}" pull-request -b "${target_branch}" -F "${notes_file}" 2>&1) || echo "$out" | grep "A pull request already exists"
|
||||||
fi
|
fi
|
||||||
popd >>/dev/null
|
popd >>/dev/null
|
||||||
}
|
}
|
||||||
@ -115,6 +118,7 @@ Usage:
|
|||||||
Args:
|
Args:
|
||||||
<repository-name> : Name of repository to fork and send PR from github.com/${organization}
|
<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
|
||||||
Example:
|
Example:
|
||||||
${script_name} 1.10
|
${script_name} 1.10
|
||||||
Options
|
Options
|
||||||
@ -135,9 +139,11 @@ shift $((OPTIND - 1))
|
|||||||
|
|
||||||
repo=${1:-}
|
repo=${1:-}
|
||||||
new_version=${2:-}
|
new_version=${2:-}
|
||||||
|
target_branch=${3:-}
|
||||||
[ -n "${repo}" ] || (echo "ERROR: repository not provided" && usage 1)
|
[ -n "${repo}" ] || (echo "ERROR: repository not provided" && usage 1)
|
||||||
[ -n "$new_version" ] || (echo "ERROR: no new version" && usage 1)
|
[ -n "${new_version}" ] || (echo "ERROR: no new version" && usage 1)
|
||||||
|
[ -n "${target_branch}" ] || die "no target branch"
|
||||||
|
|
||||||
pushd "$tmp_dir" >>/dev/null
|
pushd "$tmp_dir" >>/dev/null
|
||||||
bump_repo "${repo}" "${new_version}"
|
bump_repo "${repo}" "${new_version}" "${target_branch}"
|
||||||
popd >>/dev/null
|
popd >>/dev/null
|
||||||
|
@ -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" "runtime" 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} 2>&1)
|
out=$("${script_dir}/update-repository-version.sh" "runtime" "${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
|
||||||
|
Loading…
Reference in New Issue
Block a user