mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Modernize release script:
- making sure the DRY_RUN mode can finish e2e, so e.g. commits to local copy of repository are OK in dry-run (while git pushes are NOT). - better interaction with ./test_lib.sh script. - more consistent logging - bringing back s390x architecture that on go 1.14.3 seems to work as expected.
This commit is contained in:
@@ -7,7 +7,11 @@ if [[ "$(go list)" != "${ROOT_MODULE}/v3" ]]; then
|
||||
exit 255
|
||||
fi
|
||||
|
||||
ETCD_ROOT_DIR=$(go list -f '{{.Dir}}' "${ROOT_MODULE}/v3")
|
||||
function set_root_dir {
|
||||
ETCD_ROOT_DIR=$(go list -f '{{.Dir}}' "${ROOT_MODULE}/v3")
|
||||
}
|
||||
|
||||
set_root_dir
|
||||
|
||||
#### Convenient IO methods #####
|
||||
|
||||
@@ -20,6 +24,7 @@ COLOR_MAGENTA='\033[95m'
|
||||
COLOR_BOLD='\033[1m'
|
||||
COLOR_NONE='\033[0m' # No Color
|
||||
|
||||
|
||||
function log_error {
|
||||
>&2 echo -n -e "${COLOR_BOLD}${COLOR_RED}"
|
||||
>&2 echo "$@"
|
||||
@@ -162,6 +167,15 @@ function module_dirs() {
|
||||
echo "api pkg raft client/v2 client/v3 server etcdctl tests ."
|
||||
}
|
||||
|
||||
# maybe_run [cmd...] runs given command depending on the DRY_RUN flag.
|
||||
function maybe_run() {
|
||||
if ${DRY_RUN}; then
|
||||
log_warning -e "# DRY_RUN:\n % ${*}"
|
||||
else
|
||||
run "${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
function modules() {
|
||||
modules=(
|
||||
"${ROOT_MODULE}/api/v3"
|
||||
@@ -344,14 +358,18 @@ function git_assert_branch_in_sync {
|
||||
branch=$(git branch --show-current)
|
||||
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."
|
||||
log_error "Consider cleaning up / renaming this directory or (cd $(pwd) && git reset --hard)"
|
||||
return 2
|
||||
fi
|
||||
ref_local=$(run git rev-parse "${branch}")
|
||||
ref_origin=$(run git rev-parse "origin/${branch}")
|
||||
if [ "x${ref_local}" != "x${ref_origin}" ]; then
|
||||
log_error "In workspace '$(pwd)' the branch: ${branch} diverges from the origin."
|
||||
log_error "Consider cleaning up / renaming this directory."
|
||||
return 2
|
||||
if [ -n "${branch}" ]; then
|
||||
ref_local=$(run git rev-parse "${branch}")
|
||||
ref_origin=$(run git rev-parse "origin/${branch}")
|
||||
if [ "x${ref_local}" != "x${ref_origin}" ]; then
|
||||
log_error "In workspace '$(pwd)' the branch: ${branch} diverges from the origin."
|
||||
log_error "Consider cleaning up / renaming this directory or (cd $(pwd) && git reset --hard origin/${branch})"
|
||||
return 2
|
||||
fi
|
||||
else
|
||||
log_warning "Cannot verify consistency with the origin, as git is on detached branch."
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user