mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-05 03:26:37 +00:00
releases: Remove scripts that won't be used anymore
Those are not needed anymore as we're automating our release process around GitHub actions. Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
parent
e714c37521
commit
a85481110a
@ -1,239 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
tmp_dir=$(mktemp -d -t tag-repos-tmp.XXXXXXXXXX)
|
||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
script_name="$(basename "${BASH_SOURCE[0]}")"
|
||||
OWNER=${OWNER:-"kata-containers"}
|
||||
PROJECT="Kata Containers"
|
||||
PUSH="${PUSH:-"false"}"
|
||||
branch="main"
|
||||
readonly URL_RAW_FILE="https://raw.githubusercontent.com/${OWNER}"
|
||||
#The runtime version is used as reference of latest release
|
||||
# This is set to the right value later.
|
||||
kata_version=""
|
||||
# Set if a new stable branch is created
|
||||
stable_branch=""
|
||||
|
||||
source "${script_dir}/../scripts/lib.sh"
|
||||
|
||||
function usage() {
|
||||
|
||||
cat <<EOF
|
||||
Usage: ${script_name} [options] <args>
|
||||
This script creates a new release for ${PROJECT}.
|
||||
It tags and create release for:
|
||||
EOF
|
||||
for r in "${repos[@]}"; do
|
||||
echo " - ${r}"
|
||||
done
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Args:
|
||||
status : Get Current ${PROJECT} tags status
|
||||
pre-release <target-version>: Takes a version to check all the components match with it (but not the runtime)
|
||||
tag : Create tags for ${PROJECT}
|
||||
|
||||
Options:
|
||||
-b <branch>: branch were will check the version.
|
||||
-h : Show this help
|
||||
-p : push tags
|
||||
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
finish() {
|
||||
rm -rf "$tmp_dir"
|
||||
}
|
||||
|
||||
trap finish EXIT
|
||||
|
||||
die() {
|
||||
echo >&2 "ERROR: $*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
info() {
|
||||
echo "INFO: $*"
|
||||
}
|
||||
|
||||
repos=(
|
||||
"kata-containers"
|
||||
)
|
||||
|
||||
|
||||
# The pre-release option at the check_versions function receives
|
||||
# the runtime VERSION in order to check all the components match with it,
|
||||
# this has the purpose that all the components have the same version before
|
||||
# merging the runtime version
|
||||
check_versions() {
|
||||
version_to_check=${1:-}
|
||||
if [ -z "${version_to_check}" ];then
|
||||
info "Query the version from latest runtime in branch ${branch}"
|
||||
else
|
||||
kata_version="${version_to_check}"
|
||||
fi
|
||||
|
||||
info "Tagging ${PROJECT} with version ${kata_version}"
|
||||
info "Check all repos has version ${kata_version} in VERSION file"
|
||||
|
||||
for repo in "${repos[@]}"; do
|
||||
if [ ! -z "${version_to_check}" ] && [ "${repo}" == "runtime" ]; then
|
||||
info "Not checking runtime because we want the rest of repos are in ${version_to_check}"
|
||||
continue
|
||||
fi
|
||||
repo_version=$(curl -Ls "${URL_RAW_FILE}/${repo}/${branch}/VERSION" | grep -v -P "^#")
|
||||
info "${repo} is in $repo_version"
|
||||
[ "${repo_version}" == "${kata_version}" ] || die "${repo} is not in version ${kata_version}"
|
||||
done
|
||||
}
|
||||
|
||||
do_tag(){
|
||||
local tag=${1:-}
|
||||
[ -n "${tag}" ] || die "No tag not provided"
|
||||
if git rev-parse -q --verify "refs/tags/${tag}"; then
|
||||
info "$repo already has tag"
|
||||
else
|
||||
info "Creating tag ${tag} for ${repo}"
|
||||
git tag -a "${tag}" -s -m "${PROJECT} release ${tag}"
|
||||
fi
|
||||
}
|
||||
|
||||
tag_repos() {
|
||||
|
||||
info "Creating tag ${kata_version} in all repos"
|
||||
for repo in "${repos[@]}"; do
|
||||
git clone --quiet "https://github.com/${OWNER}/${repo}.git"
|
||||
pushd "${repo}" >>/dev/null
|
||||
git fetch origin
|
||||
git checkout "${branch}"
|
||||
version_from_file=$(cat ./VERSION)
|
||||
info "Check VERSION file has ${kata_version}"
|
||||
if [ "${version_from_file}" != "${kata_version}" ];then
|
||||
die "mismatch: VERSION file (${version_from_file}) and runtime version ${kata_version}"
|
||||
else
|
||||
echo "OK"
|
||||
fi
|
||||
git fetch origin --tags
|
||||
tag="$kata_version"
|
||||
if [[ "packaging" == "${repo}" ]];then
|
||||
do_tag "${tag}-kernel-config"
|
||||
fi
|
||||
|
||||
do_tag "${tag}"
|
||||
|
||||
if [ "${branch}" == "main" ]; then
|
||||
if echo "${tag}" | grep -oP '.*-rc0$'; then
|
||||
info "This is a rc0 for main - creating stable branch"
|
||||
stable_branch=$(echo ${tag} | awk 'BEGIN{FS=OFS="."}{print $1 "." $2}')
|
||||
stable_branch="stable-${stable_branch}"
|
||||
info "creating branch ${stable_branch} for ${repo}"
|
||||
git checkout -b "${stable_branch}" "${branch}"
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
popd >>/dev/null
|
||||
done
|
||||
}
|
||||
|
||||
push_tags() {
|
||||
info "Pushing tags to repos"
|
||||
get_gh
|
||||
for repo in "${repos[@]}"; do
|
||||
pushd "${repo}" >>/dev/null
|
||||
${gh_cli} repo set-default "${OWNER}/${repo}"
|
||||
if [ $(${gh_cli} config get git_protocol) = ssh ]; then
|
||||
git remote set-url --push origin "git@github.com:${OWNER}/${repo}.git"
|
||||
fi
|
||||
tag="$kata_version"
|
||||
if [[ "packaging" == "${repo}" ]];then
|
||||
ktag="${tag}-kernel-config"
|
||||
info "Push tag ${ktag} for ${repo}"
|
||||
git push origin "${ktag}"
|
||||
fi
|
||||
info "Push tag ${tag} for ${repo}"
|
||||
git push origin "${tag}"
|
||||
create_github_release "${PWD}" "${tag}"
|
||||
if [ "${stable_branch}" != "" ]; then
|
||||
info "Pushing stable ${stable_branch} branch for ${repo}"
|
||||
git push origin ${stable_branch}
|
||||
fi
|
||||
popd >>/dev/null
|
||||
done
|
||||
}
|
||||
|
||||
create_github_release() {
|
||||
repo_dir=${1:-}
|
||||
tag=${2:-}
|
||||
[ -d "${repo_dir}" ] || die "No repository directory"
|
||||
[ -n "${tag}" ] || die "No tag specified"
|
||||
if ! "${gh_cli}" release view "${tag}"; then
|
||||
info "Creating Github release"
|
||||
if [[ "$tag" =~ "-rc" ]]; then
|
||||
rc_args="-p"
|
||||
fi
|
||||
rc_args=${rc_args:-}
|
||||
pushd "${repo_dir}"
|
||||
"${gh_cli}" release create ${rc_args} --title "${PROJECT} ${tag}" "${tag}" --notes ""
|
||||
popd
|
||||
else
|
||||
info "Github release already created"
|
||||
fi
|
||||
}
|
||||
|
||||
main () {
|
||||
while getopts "b:hp" opt; do
|
||||
case $opt in
|
||||
b) branch="${OPTARG}" ;;
|
||||
h) usage && exit 0 ;;
|
||||
p) PUSH="true" ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
subcmd=${1:-""}
|
||||
shift || true
|
||||
kata_version=$(curl -Ls "${URL_RAW_FILE}/kata-containers/${branch}/VERSION" | grep -v -P "^#")
|
||||
|
||||
[ -z "${subcmd}" ] && usage && exit 0
|
||||
|
||||
pushd "${tmp_dir}" >>/dev/null
|
||||
|
||||
case "${subcmd}" in
|
||||
status)
|
||||
check_versions
|
||||
;;
|
||||
pre-release)
|
||||
local target_version=${1:-}
|
||||
[ -n "${target_version}" ] || die "No version provided"
|
||||
check_versions "${target_version}"
|
||||
;;
|
||||
tag)
|
||||
check_versions
|
||||
tag_repos
|
||||
if [ "${PUSH}" == "true" ]; then
|
||||
push_tags
|
||||
else
|
||||
info "tags not pushed, use -p option to push the tags"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
usage && die "Invalid argument ${subcmd}"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
popd >>/dev/null
|
||||
}
|
||||
main "$@"
|
@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
echo "Check tag_repos.sh show help"
|
||||
./release/tag_repos.sh | grep Usage
|
||||
|
||||
echo "Check tag_repos.sh -h option"
|
||||
./release/tag_repos.sh -h | grep Usage
|
||||
|
||||
echo "Check tag_repos.sh status"
|
||||
./release/tag_repos.sh status | grep kata-containers
|
||||
|
||||
echo "Check tag_repos.sh pre-release"
|
||||
./release/tag_repos.sh pre-release $(curl -sL https://raw.githubusercontent.com/kata-containers/kata-containers/main/VERSION) | grep "Not checking runtime"
|
||||
|
||||
echo "Check tag_repos.sh pre-release with invalid information"
|
||||
./release/tag_repos.sh pre-release 1000000 | grep "ERROR" || true
|
||||
|
@ -1,339 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly script_name="$(basename "${BASH_SOURCE[0]}")"
|
||||
|
||||
readonly tmp_dir=$(mktemp -t -d pr-bump.XXXX)
|
||||
OWNER="${OWNER:-kata-containers}"
|
||||
readonly organization="$OWNER"
|
||||
PUSH="false"
|
||||
GOPATH=${GOPATH:-${HOME}/go}
|
||||
|
||||
source "${script_dir}/../scripts/lib.sh"
|
||||
|
||||
cleanup() {
|
||||
[ -d "${tmp_dir}" ] && rm -rf "${tmp_dir}"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
handle_error() {
|
||||
local exit_code="${?}"
|
||||
local line_number="${1:-}"
|
||||
echo "Failed at $line_number: ${BASH_COMMAND}"
|
||||
exit "${exit_code}"
|
||||
}
|
||||
trap 'handle_error $LINENO' ERR
|
||||
|
||||
get_changes() {
|
||||
local current_version="$1"
|
||||
[ -n "${current_version}" ] || die "current version not provided"
|
||||
|
||||
# If for some reason there is not a tag this could fail
|
||||
# better fail and write the error in the PR
|
||||
if ! changes=$(git log --oneline "${current_version}..HEAD"); then
|
||||
echo "failed to get logs"
|
||||
fi
|
||||
if [ "${changes}" == "" ]; then
|
||||
echo "Version bump no changes"
|
||||
return
|
||||
fi
|
||||
|
||||
# list all PRs merged from $current_version to HEAD
|
||||
git log --merges "${current_version}..HEAD" | awk '/Merge pull/{getline; getline;print }' | while read pr; do
|
||||
echo "- ${pr}"
|
||||
done
|
||||
|
||||
echo ""
|
||||
|
||||
# list all commits added in this new version.
|
||||
git log --oneline "${current_version}..HEAD" --no-merges
|
||||
}
|
||||
|
||||
generate_kata_deploy_commit() {
|
||||
local new_version="$1"
|
||||
[ -n "$new_version" ] || die "no new version"
|
||||
|
||||
printf "release: Adapt kata-deploy for %s" "${new_version}"
|
||||
|
||||
printf "\n
|
||||
kata-deploy files must be adapted to a new release. The cases where it
|
||||
happens are when the release goes from -> to:
|
||||
* main -> stable:
|
||||
* kata-deploy-stable / kata-cleanup-stable: are removed
|
||||
|
||||
* stable -> stable:
|
||||
* kata-deploy / kata-cleanup: bump the release to the new one.
|
||||
|
||||
There are no changes when doing an alpha release, as the files on the
|
||||
\"main\" branch always point to the \"latest\" and \"stable\" tags."
|
||||
}
|
||||
|
||||
generate_revert_kata_deploy_commit() {
|
||||
local new_version="$1"
|
||||
[ -n "$new_version" ] || die "no new version"
|
||||
|
||||
printf "release: Revert kata-deploy changes after %s release" "${new_version}"
|
||||
|
||||
printf "\n
|
||||
As %s has been released, let's switch the kata-deploy / kata-cleanup
|
||||
tags back to \"latest\", and re-add the kata-deploy-stable and the
|
||||
kata-cleanup-stable files." "${new_version}"
|
||||
}
|
||||
|
||||
generate_commit() {
|
||||
local new_version="$1"
|
||||
local current_version="$2"
|
||||
|
||||
[ -n "$new_version" ] || die "no new version"
|
||||
[ -n "$current_version" ] || die "no current version"
|
||||
|
||||
printf "release: Kata Containers %s\n\n" "${new_version}"
|
||||
|
||||
get_changes "$current_version"
|
||||
}
|
||||
|
||||
bump_repo() {
|
||||
local repo="${1:-}"
|
||||
local new_version="${2:-}"
|
||||
local target_branch="${3:-}"
|
||||
[ -n "${repo}" ] || die "repository not provided"
|
||||
[ -n "${new_version}" ] || die "no new version"
|
||||
[ -n "${target_branch}" ] || die "no target branch"
|
||||
local remote_repo="${organization}/${repo}"
|
||||
local remote_github="https://github.com/${remote_repo}.git"
|
||||
info "Update $repo to version $new_version"
|
||||
|
||||
info "remote: ${remote_github}"
|
||||
|
||||
git clone --quiet "${remote_github}"
|
||||
|
||||
pushd "${repo}" >>/dev/null
|
||||
|
||||
local kata_deploy_dir="tools/packaging/kata-deploy"
|
||||
local kata_deploy_base="${kata_deploy_dir}/kata-deploy/base"
|
||||
local kata_cleanup_base="${kata_deploy_dir}/kata-cleanup/base"
|
||||
local kata_deploy_yaml="${kata_deploy_base}/kata-deploy.yaml"
|
||||
local kata_cleanup_yaml="${kata_cleanup_base}/kata-cleanup.yaml"
|
||||
local kata_deploy_stable_yaml="${kata_deploy_base}/kata-deploy-stable.yaml"
|
||||
local kata_cleanup_stable_yaml="${kata_cleanup_base}/kata-cleanup-stable.yaml"
|
||||
|
||||
local tests_dir="tests"
|
||||
local kubernetes_tests_dir="${tests_dir}/integration/kubernetes"
|
||||
local kubernetes_tests_runner="${kubernetes_tests_dir}/gha-run.sh"
|
||||
local kata_deploy_tests_dir="${tests_dir}/functional/kata-deploy"
|
||||
local kata_deploy_tests_runner="${kata_deploy_tests_dir}/kata-deploy.bats"
|
||||
|
||||
branch="${new_version}-branch-bump"
|
||||
git fetch origin "${target_branch}"
|
||||
git checkout "origin/${target_branch}" -b "${branch}"
|
||||
|
||||
local current_version="$(egrep -v '^(#|$)' ./VERSION)"
|
||||
|
||||
info "Updating VERSION file"
|
||||
echo "${new_version}" >VERSION
|
||||
if git diff --exit-code; then
|
||||
info "${repo} already in version ${new_version}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "${repo}" == "kata-containers" ]; then
|
||||
# Here there are 3 scenarios of what we can do, based on
|
||||
# which branch we're targetting:
|
||||
#
|
||||
# 1) [main] ------> [main] NO-OP
|
||||
# "alpha0" "alpha1"
|
||||
#
|
||||
# +----------------+----------------+
|
||||
# | from | to |
|
||||
# -------------------+----------------+----------------+
|
||||
# kata-deploy | "latest" | "latest" |
|
||||
# -------------------+----------------+----------------+
|
||||
# kata-deploy-stable | "stable | "stable" |
|
||||
# -------------------+----------------+----------------+
|
||||
#
|
||||
#
|
||||
# 2) [main] ------> [stable] Update kata-deploy and
|
||||
# "alpha2" "rc0" get rid of kata-deploy-stable
|
||||
#
|
||||
# +----------------+----------------+
|
||||
# | from | to |
|
||||
# -------------------+----------------+----------------+
|
||||
# kata-deploy | "latest" | "latest" |
|
||||
# -------------------+----------------+----------------+
|
||||
# kata-deploy-stable | "stable" | REMOVED |
|
||||
# -------------------+----------------+----------------+
|
||||
#
|
||||
#
|
||||
# 3) [stable] ------> [stable] Update kata-deploy
|
||||
# "x.y.z" "x.y.(z+1)"
|
||||
#
|
||||
# +----------------+----------------+
|
||||
# | from | to |
|
||||
# -------------------+----------------+----------------+
|
||||
# kata-deploy | "x.y.z" | "x.y.(z+1)" |
|
||||
# -------------------+----------------+----------------+
|
||||
# kata-deploy-stable | NON-EXISTENT | NON-EXISTENT |
|
||||
# -------------------+----------------+----------------+
|
||||
|
||||
local registry="quay.io/kata-containers/kata-deploy"
|
||||
|
||||
info "Updating kata-deploy / kata-cleanup image tags"
|
||||
local version_to_replace="${current_version}"
|
||||
local replacement="${new_version}"
|
||||
local need_commit=false
|
||||
if [ "${target_branch}" == "main" ];then
|
||||
if [[ "${new_version}" =~ "rc" ]]; then
|
||||
## We are bumping from alpha to RC, should drop kata-deploy-stable yamls.
|
||||
git rm "${kata_deploy_stable_yaml}"
|
||||
git rm "${kata_cleanup_stable_yaml}"
|
||||
|
||||
need_commit=true
|
||||
fi
|
||||
elif [[ ! "${new_version}" =~ "rc" ]]; then
|
||||
## We are on a stable branch and creating new stable releases.
|
||||
## Need to change kata-deploy / kata-cleanup to use the stable tags.
|
||||
if [[ "${version_to_replace}" =~ "rc" ]]; then
|
||||
## Coming from "rcX" so from the latest tag.
|
||||
version_to_replace="latest"
|
||||
fi
|
||||
sed -i "s#${registry}:${version_to_replace}#${registry}:${replacement}#g" "${kata_deploy_yaml}"
|
||||
sed -i "s#${registry}:${version_to_replace}#${registry}:${replacement}#g" "${kata_cleanup_yaml}"
|
||||
|
||||
sed -i "s#${registry}:${version_to_replace}#${registry}:${replacement}#g" "${kubernetes_tests_runner}"
|
||||
sed -i "s#${registry}:${version_to_replace}#${registry}:${replacement}#g" "${kata_deploy_tests_runner}"
|
||||
|
||||
git diff
|
||||
|
||||
git add "${kata_deploy_yaml}"
|
||||
git add "${kata_cleanup_yaml}"
|
||||
git add "${kubernetes_tests_runner}"
|
||||
git add "${kata_deploy_tests_runner}"
|
||||
|
||||
need_commit=true
|
||||
fi
|
||||
|
||||
if [ "${need_commit}" == "true" ]; then
|
||||
info "Creating the commit with the kata-deploy changes"
|
||||
local commit_msg="$(generate_kata_deploy_commit $new_version)"
|
||||
git commit -s -m "${commit_msg}"
|
||||
local kata_deploy_commit="$(git rev-parse HEAD)"
|
||||
fi
|
||||
fi
|
||||
|
||||
info "Creating PR message"
|
||||
local pr_title="# Kata Containers ${new_version}"
|
||||
local notes_file="${tmp_dir}/notes.md"
|
||||
cat <<EOF >"${notes_file}"
|
||||
$(get_changes "$current_version")
|
||||
|
||||
EOF
|
||||
printf "%s\n\n" "${pr_title}"
|
||||
cat "${notes_file}"
|
||||
|
||||
if (echo "${current_version}" | grep "alpha") && (echo "${new_version}" | grep -v "alpha");then
|
||||
info "update move from alpha, check if new version is rc0"
|
||||
if echo "$new_version" | grep -v "rc0"; then
|
||||
die "bump should be from alpha to rc0"
|
||||
fi
|
||||
info "OK"
|
||||
fi
|
||||
|
||||
git add VERSION
|
||||
info "Creating commit with new changes"
|
||||
commit_msg="$(generate_commit $new_version $current_version)"
|
||||
git commit -s -m "${commit_msg}"
|
||||
|
||||
if [[ ${PUSH} == "true" ]]; then
|
||||
get_gh
|
||||
gh_id=$(${gh_cli} auth status --hostname github.com | awk 'match($0, /Logged in to github.com as ([^ ]+)/, line) { print substr($0, line[1, "start"], line[1, "length"]) }')
|
||||
info "Forking remote"
|
||||
${gh_cli} repo set-default "${remote_repo}"
|
||||
${gh_cli} repo fork --remote --remote-name=fork
|
||||
info "Push to fork"
|
||||
git push fork -f "${branch}"
|
||||
info "Create PR"
|
||||
out=""
|
||||
out=$(LC_ALL=C LANG=C "${gh_cli}" pr create --base "${target_branch}" --title "${pr_title}" --body-file "${notes_file}" --head "${gh_id}:${branch}" 2>&1) || echo "$out" | grep "already exists"
|
||||
fi
|
||||
|
||||
if [ "${repo}" == "kata-containers" ] && [ "${target_branch}" == "main" ] && [[ "${new_version}" =~ "rc" ]]; then
|
||||
reverting_kata_deploy_changes_branch="revert-kata-deploy-changes-after-${new_version}-release"
|
||||
git checkout -b "${reverting_kata_deploy_changes_branch}"
|
||||
|
||||
git revert --no-edit ${kata_deploy_commit} >>/dev/null
|
||||
commit_msg="$(generate_revert_kata_deploy_commit $new_version)"
|
||||
info "Creating the commit message reverting the kata-deploy changes"
|
||||
git commit --amend -s -m "${commit_msg}"
|
||||
|
||||
pr_title=$(echo "${commit_msg}" | head -1)
|
||||
echo "${commit_msg}" | tail -n +3 >"${notes_file}"
|
||||
echo "" >>"${notes_file}"
|
||||
echo "Only merge this commit after ${new_version} release is successfully tagged!" >>"${notes_file}"
|
||||
|
||||
if [[ ${PUSH} == "true" ]]; then
|
||||
info "Push \"${reverting_kata_deploy_changes_branch}\" to fork"
|
||||
git push fork -f "${reverting_kata_deploy_changes_branch}"
|
||||
info "Create \"${reverting_kata_deploy_changes_branch}\" PR"
|
||||
out=""
|
||||
out=$(LC_ALL=C LANG=C "${gh_cli}" pr create --base "${target_branch}" --title "${pr_title}" --body-file "${notes_file}" --head "${gh_id}:${reverting_kata_deploy_changes_branch}" 2>&1) || echo "$out" | grep "already exists"
|
||||
fi
|
||||
fi
|
||||
|
||||
popd >>/dev/null
|
||||
}
|
||||
|
||||
usage() {
|
||||
exit_code="$1"
|
||||
cat <<EOF
|
||||
Usage:
|
||||
${script_name} [options] <args>
|
||||
Args:
|
||||
<new-version> : New version to bump the repository
|
||||
<target-branch> : The base branch to create to PR
|
||||
Example:
|
||||
${script_name} 1.10
|
||||
Options
|
||||
-h : Show this help
|
||||
-p : create a PR
|
||||
EOF
|
||||
exit "$exit_code"
|
||||
}
|
||||
|
||||
repos=(
|
||||
"kata-containers"
|
||||
)
|
||||
|
||||
main(){
|
||||
while getopts "hp" opt; do
|
||||
case $opt in
|
||||
h) usage 0 ;;
|
||||
p) PUSH="true" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
|
||||
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
|
||||
pushd "$tmp_dir" >>/dev/null
|
||||
bump_repo "${repo}" "${new_version}" "${target_branch}"
|
||||
popd >>/dev/null
|
||||
done
|
||||
|
||||
}
|
||||
main $@
|
@ -1,54 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
#Copyright (c) 2018 Intel Corporation
|
||||
#
|
||||
#SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
out=""
|
||||
|
||||
handle_error() {
|
||||
echo "not ok"
|
||||
echo "output: ${out}"
|
||||
}
|
||||
|
||||
OK() {
|
||||
echo "ok"
|
||||
}
|
||||
output_should_contain() {
|
||||
local output="$1"
|
||||
local text_to_find="$2"
|
||||
[ -n "$output" ]
|
||||
[ -n "$text_to_find" ]
|
||||
echo "${output}" | grep "${text_to_find}"
|
||||
}
|
||||
|
||||
trap handle_error ERR
|
||||
|
||||
echo "Missing args show help"
|
||||
out=$("${script_dir}/update-repository-version.sh" 2>&1) || (($? != 0))
|
||||
echo "${out}" | grep Usage >>/dev/null
|
||||
output_should_contain "${out}" "Usage"
|
||||
OK
|
||||
|
||||
echo "Missing version show help"
|
||||
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
|
||||
|
||||
echo "help option"
|
||||
out=$("${script_dir}/update-repository-version.sh" -h)
|
||||
output_should_contain "${out}" "Usage"
|
||||
OK
|
||||
|
||||
echo "Local update version update should work"
|
||||
new_version="50.0.0-rc0"
|
||||
out=$("${script_dir}/update-repository-version.sh" "${new_version}" "main" 2>&1)
|
||||
output_should_contain "${out}" "release: Kata Containers ${new_version}"
|
||||
OK
|
Loading…
Reference in New Issue
Block a user