mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 00:07:16 +00:00
bump: Do not fail is not possible to get logs
Sometimes get logs could fail, for example when a tag does not exit, instead of fail just log the error in the PR. Fixes: #609 Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
parent
212b219e9e
commit
896ed41c7f
@ -25,11 +25,23 @@ cleanup() {
|
||||
|
||||
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"
|
||||
|
||||
changes=$(git log --oneline "${current_version}..HEAD") || die "failed to get logs"
|
||||
# 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
|
||||
@ -84,6 +96,11 @@ bump_repo() {
|
||||
|
||||
info "Updating VERSION file"
|
||||
echo "${new_version}" >VERSION
|
||||
if git diff --exit-code; then
|
||||
info "${repo} already in version ${new_version}"
|
||||
cat VERSION
|
||||
return 0
|
||||
fi
|
||||
|
||||
info "Creating PR message"
|
||||
notes_file=notes.md
|
||||
@ -140,7 +157,6 @@ repos=(
|
||||
"shim"
|
||||
)
|
||||
|
||||
|
||||
main(){
|
||||
while getopts "hp" opt; do
|
||||
case $opt in
|
||||
|
Loading…
Reference in New Issue
Block a user