release: support kick off release in current branch
Currently when triggering release, it always pull remote repo and checkout main branch. Any changes which are merged into the target release branch (e.g. release-3.5) will be ignored. It isn't convenient for test, including in github workflow and local environment. So we need to support triggering release in current branch. Note: --current-branch should only be called with DRY_RUN=true Signed-off-by: Benjamin Wang <wachao@vmware.com>
This commit is contained in:
@ -410,14 +410,16 @@ function assert_no_git_modifications {
|
||||
# - no differencing commits in relation to the origin/$branch
|
||||
function git_assert_branch_in_sync {
|
||||
local branch
|
||||
branch=$(run git rev-parse --abbrev-ref HEAD)
|
||||
# TODO: When git 2.22 popular, change to:
|
||||
# branch=$(git branch --show-current)
|
||||
branch=$(run git rev-parse --abbrev-ref HEAD)
|
||||
log_callout "Verify the current branch '${branch}' is clean"
|
||||
if [[ $(run git status --porcelain --untracked-files=no) ]]; then
|
||||
log_error "The workspace in '$(pwd)' for branch: ${branch} has uncommitted changes"
|
||||
log_error "Consider cleaning up / renaming this directory or (cd $(pwd) && git reset --hard)"
|
||||
return 2
|
||||
fi
|
||||
log_callout "Verify the current branch '${branch}' is in sync with the 'origin/${branch}'"
|
||||
if [ -n "${branch}" ]; then
|
||||
ref_local=$(run git rev-parse "${branch}")
|
||||
ref_origin=$(run git rev-parse "origin/${branch}")
|
||||
|
Reference in New Issue
Block a user