mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #11641 from natefoo/release-process-overhaul
Overhaul make-based release process
This commit is contained in:
@@ -200,14 +200,15 @@ RELEASE_ISSUE_TEMPLATE = string.Template("""
|
||||
|
||||
- [X] **Prep**
|
||||
|
||||
- [X] ~~Create this release issue ``make release-issue RELEASE_CURR=${version}``.~~
|
||||
- [X] ~~Create this release issue ``make release-issue``.~~
|
||||
- [X] ~~Set freeze date (${freeze_date}).~~
|
||||
|
||||
- [ ] **Branch Release (on or around ${freeze_date})**
|
||||
|
||||
- [ ] Ensure all [blocking milestone PRs](https://github.com/galaxyproject/galaxy/pulls?q=is%3Aopen+is%3Apr+milestone%3A${version}) have been merged, delayed, or closed.
|
||||
|
||||
make release-check-blocking-prs RELEASE_CURR=${version}
|
||||
make release-check-blocking-prs
|
||||
|
||||
- [ ] Merge the latest release into dev and push upstream.
|
||||
|
||||
make release-merge-stable-to-next RELEASE_PREVIOUS=release_${previous_version}
|
||||
@@ -215,12 +216,13 @@ RELEASE_ISSUE_TEMPLATE = string.Template("""
|
||||
|
||||
- [ ] Create and push release branch:
|
||||
|
||||
make release-create-rc RELEASE_CURR=${version} RELEASE_NEXT=${next_version}
|
||||
make release-create-rc
|
||||
|
||||
- [ ] Open PRs from your fork of branch ``version-${version}`` to upstream ``release_${version}`` and of ``version-${next_version}.dev`` to ``dev``.
|
||||
- [ ] Update ``MILESTONE_NUMBER`` in the [ maintenance bot](https://github.com/galaxyproject/galaxy/blob/dev/.github/workflows/maintenance_bot.yaml) to `${next_version}` so it properly tags new PRs.
|
||||
- [ ] Update ``MILESTONE_NUMBER`` in the [maintenance bot](https://github.com/galaxyproject/galaxy/blob/dev/.github/workflows/maintenance_bot.yaml) to `${next_version}` so it properly tags new PRs.
|
||||
|
||||
- [ ] **Issue Review Timeline Notes**
|
||||
|
||||
- [ ] Ensure any security fixes will be ready prior to ${freeze_date} + 1 week, to allow time for notification prior to release.
|
||||
- [ ] Ensure ownership of outstanding bugfixes and track progress during freeze.
|
||||
|
||||
@@ -265,11 +267,11 @@ RELEASE_ISSUE_TEMPLATE = string.Template("""
|
||||
- [ ] Ensure all PRs merged into the pre-release branch during the freeze have [milestones attached](https://github.com/galaxyproject/galaxy/pulls?q=is%3Apr+is%3Aclosed+base%3Arelease_{version}+is%3Amerged+no%3Amilestone) and that they are the not [${next_version} milestones](https://github.com/galaxyproject/galaxy/pulls?q=is%3Apr+is%3Aclosed+base%3Arelease_{version}+is%3Amerged+milestone%3A{next_version})
|
||||
- [ ] Ensure release notes include all PRs added during the freeze by re-running the release note bootstrapping:
|
||||
|
||||
make release-bootstrap-history RELEASE_CURR=${version}
|
||||
make release-bootstrap-history
|
||||
- [ ] Ensure previous release is merged into current. [GitHub branch comparison](https://github.com/galaxyproject/galaxy/compare/release_${version}...release_${previous_version})
|
||||
- [ ] Create and push release tag:
|
||||
|
||||
make release-create RELEASE_CURR=${version}
|
||||
make release-create
|
||||
|
||||
- [ ] Add the branch `*/release_{version}` to Jenkins documentation build [configuration matrix](https://jenkins.galaxyproject.org/job/galaxy-sphinx-by-branch/configure).
|
||||
- [ ] Trigger the [branch documentation build](https://jenkins.galaxyproject.org/job/galaxy-sphinx-by-branch/)
|
||||
@@ -294,7 +296,7 @@ RELEASE_ISSUE_TEMPLATE = string.Template("""
|
||||
- [ ] **Prepare for next release**
|
||||
|
||||
- [ ] Close milestone ``${version}`` and ensure milestone ``${next_version}`` exists.
|
||||
- [ ] Create release issue for next version ``make release-issue RELEASE_CURR=${next_version}``.
|
||||
- [ ] Create release issue for next version ``make release-issue``.
|
||||
- [ ] Schedule committer meeting to discuss re-alignment of priorities.
|
||||
- [ ] Close this issue.
|
||||
""")
|
||||
@@ -314,21 +316,6 @@ GROUPPED_TAGS = OrderedDict([
|
||||
# https://api.github.com/repos/galaxyproject/galaxy/compare/release_15.05...dev
|
||||
|
||||
|
||||
def print_next_minor_version():
|
||||
minor_version_str = None
|
||||
with open(GALAXY_VERSION_FILE) as f:
|
||||
for line in f:
|
||||
result = re.match(r'VERSION_MINOR = "(.*)"', line)
|
||||
if result:
|
||||
minor_version_str = result.group(1)
|
||||
break
|
||||
try:
|
||||
minor_version = int(minor_version_str)
|
||||
except (TypeError, ValueError):
|
||||
minor_version = 0
|
||||
print(minor_version + 1)
|
||||
|
||||
|
||||
def release_issue(argv):
|
||||
release_name = argv[2]
|
||||
previous_release = _previous_release(release_name)
|
||||
@@ -511,10 +498,6 @@ def main(argv, seen_prs=None):
|
||||
newest_release = None
|
||||
seen_prs = seen_prs or set()
|
||||
|
||||
if argv[1] == "--print-next-minor-version":
|
||||
print_next_minor_version()
|
||||
return
|
||||
|
||||
if argv[1] == "--check-blocking-prs":
|
||||
check_blocking_prs(argv)
|
||||
return
|
||||
|
||||
Executable
+623
@@ -0,0 +1,623 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
shopt -s extglob
|
||||
|
||||
# TODO: upload packages
|
||||
# TODO: set dev version in 21.01 (+ 20.09?) branches
|
||||
|
||||
: ${VENV:=.venv}
|
||||
: ${FORK_REMOTE:=origin}
|
||||
: ${UPSTREAM_REMOTE:=upstream}
|
||||
: ${UPSTREAM_REMOTE_URL:=git@github.com:galaxyproject/galaxy.git}
|
||||
: ${DEV_BRANCH:=dev}
|
||||
: ${STABLE_BRANCH:=master}
|
||||
|
||||
# Vars for local releases
|
||||
: ${RELEASE_LOCAL_TAG:=local}
|
||||
: ${RELEASE_LOCAL_COMMIT:=$(git rev-parse --short HEAD)}
|
||||
: ${RELEASE_LOCAL_VERSION:=${RELEASE_LOCAL_TAG}$(date -u +%Y%m%dT%H%M%SZ).${RELEASE_LOCAL_COMMIT}}
|
||||
|
||||
# Only use this for dev/testing/CI to ignore forward merge conflicts, skip confirmation and package builds, etc.
|
||||
: ${TEST_MODE:=false}
|
||||
|
||||
VERIFY_PACKAGES=(wheel packaging)
|
||||
|
||||
BRANCH_CURR=$(git branch --show-current)
|
||||
|
||||
: ${RELEASE_CURR:=$(grep '^VERSION_MAJOR' lib/galaxy/version.py | sed -E -e "s/^[^'\"]*['\"]([^'\"]*)['\"]$/\1/")}
|
||||
RELEASE_NEXT=
|
||||
RELEASE_CURR_MINOR=
|
||||
RELEASE_CURR_MINOR_NEXT=
|
||||
RELEASE_CURR_MINOR_NEXT_DEV=
|
||||
RELEASE_TYPE=
|
||||
PACKAGE_VERSION=
|
||||
|
||||
declare -a CLEAN_BRANCHES
|
||||
declare -a CLEAN_TAGS
|
||||
CLEAN_BRANCHES=()
|
||||
CLEAN_TAGS=()
|
||||
|
||||
declare -a PUSH_BRANCHES
|
||||
PUSH_BRANCHES=()
|
||||
|
||||
WORKING_DIR_CLEAN=false
|
||||
ERROR=false
|
||||
|
||||
NEXT_RELEASE_TEMPLATE="import datetime; print((datetime.datetime.strptime('RELEASE_CURR', '%y.%m').date() + datetime.timedelta(days=(31 * 4))).strftime('%y.%m'))"
|
||||
PACKAGE_VERSION_TEMPLATE="import packaging.version; print('.'.join(map(str, packaging.version.parse('VERSION').release)))"
|
||||
PACKAGE_DEV_VERSION_TEMPLATE="import packaging.version; print(packaging.version.parse('VERSION'))"
|
||||
|
||||
|
||||
while getopts ":clr:" opt; do
|
||||
case "$opt" in
|
||||
c)
|
||||
RELEASE_TYPE='rc'
|
||||
;;
|
||||
r)
|
||||
RELEASE_CURR="$OPTARG"
|
||||
;;
|
||||
l)
|
||||
RELEASE_TYPE='local'
|
||||
;;
|
||||
*)
|
||||
echo "usage: $(basename "$0") [-c (force rc)] [-l (local release)] [-r release version]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
function trap_handler() {
|
||||
{ set +x; } 2>/dev/null
|
||||
local file
|
||||
$ERROR && log_func=log_error || log_func=log
|
||||
$log_func "Cleaning up..."
|
||||
if $WORKING_DIR_CLEAN; then
|
||||
log_exec git reset -- .
|
||||
log_exec git checkout -- .
|
||||
fi
|
||||
[ "$(git branch --show-current)" == "$BRANCH_CURR" ] || log_exec git checkout "$BRANCH_CURR"
|
||||
[ "${#CLEAN_BRANCHES[@]}" -eq 0 ] || git branch -D "${CLEAN_BRANCHES[@]}"
|
||||
$ERROR && exit 1 || exit 0
|
||||
}
|
||||
|
||||
|
||||
function trap_handler_err() {
|
||||
ERROR=true
|
||||
for tag in "${CLEAN_TAGS[@]}"; do
|
||||
log_exec git tag -d "$tag"
|
||||
done
|
||||
trap_handler
|
||||
}
|
||||
|
||||
|
||||
function trap_handler_ok() {
|
||||
# if $ERROR is true then the trap handler already ran
|
||||
$ERROR || trap_handler
|
||||
}
|
||||
|
||||
|
||||
trap "trap_handler_err" SIGTERM SIGINT ERR
|
||||
trap "trap_handler_ok" EXIT
|
||||
|
||||
|
||||
function log() {
|
||||
[ -t 0 ] && echo -e '\033[1;32m#' "$@" '\033[0m' 1>&2 || echo '#' "$@" 1>&2
|
||||
}
|
||||
|
||||
|
||||
function log_warning() {
|
||||
[ -t 0 ] && echo -e '\033[1;33mWARNING:' "$@" '\033[0m' 1>&2 || echo 'WARNING:' "$@" 1>&2
|
||||
}
|
||||
|
||||
|
||||
function log_error() {
|
||||
[ -t 0 ] && echo -e '\033[1;31mERROR:' "$@" '\033[0m' 1>&2 || echo 'ERROR:' "$@" 1>&2
|
||||
}
|
||||
|
||||
|
||||
function log_debug() {
|
||||
echo "####" "$@" 1>&2
|
||||
}
|
||||
|
||||
|
||||
function log_exec() {
|
||||
local rc
|
||||
set -x
|
||||
"$@"
|
||||
{ rc=$?; set +x; } 2>/dev/null
|
||||
return $rc
|
||||
}
|
||||
|
||||
|
||||
function fork_owner() {
|
||||
local url=$(git remote get-url "$FORK_REMOTE")
|
||||
case "$url" in
|
||||
https://github.com/*)
|
||||
echo "$url" | awk -F/ '{print $4}'
|
||||
;;
|
||||
git@github.com:*)
|
||||
echo "$url" | awk -F: '{print $2}' | awk -F/ '{print $1}'
|
||||
;;
|
||||
file:///*)
|
||||
echo '__DEV_TEST_USER__'
|
||||
;;
|
||||
*)
|
||||
log_error "Cannot parse remote '$FORK_REMOTE' url for owner username: $url"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
function ensure_upstream() {
|
||||
if ! git remote -v | grep -E "^${UPSTREAM_REMOTE}\s+" >/dev/null; then
|
||||
log_warning "Remote ${UPSTREAM_REMOTE} does not exist, will be added with URL: ${UPSTREAM_REMOTE_URL}"
|
||||
log_exec git remote add "$UPSTREAM_REMOTE" "$UPSTREAM_REMOTE_URL"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function ensure_prereqs() {
|
||||
local pip_list
|
||||
log "Checking for uncommitted local modifications..."
|
||||
log_exec git diff --stat --exit-code || { log_error "Some files have changes"; exit 1; }
|
||||
WORKING_DIR_CLEAN=true
|
||||
log "Checking for required packages..."
|
||||
if [ -z "${VIRTUAL_ENV:-}" ]; then
|
||||
[ -d "$VENV" ] || { log_error "Missing venv, please create: ${VENV}"; exit 1; }
|
||||
. "${VENV}/bin/activate"
|
||||
fi
|
||||
pip_list=$(log_exec "${VENV}/bin/pip" list)
|
||||
for package in ${VERIFY_PACKAGES[@]}; do
|
||||
echo "$pip_list" | grep -E "^${package}\s+" || { log_error "Package '${package}' missing from venv: ${VENV}" ; exit 1; }
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function user_verify_release() {
|
||||
log "Release Details"
|
||||
local future
|
||||
case "${RELEASE_NEXT:-}" in
|
||||
'')
|
||||
future="${RELEASE_CURR}.${RELEASE_CURR_MINOR_NEXT_DEV}"
|
||||
;;
|
||||
*)
|
||||
future="${RELEASE_NEXT}.dev0"
|
||||
;;
|
||||
esac
|
||||
cat <<EOF
|
||||
Release Type: ${RELEASE_TYPE}
|
||||
Major Version: ${RELEASE_CURR}
|
||||
Minor Version: ${RELEASE_CURR_MINOR_NEXT}
|
||||
Package Version: ${PACKAGE_VERSION}
|
||||
Future Version: ${future}
|
||||
EOF
|
||||
if $TEST_MODE; then
|
||||
log "Confirmation not requested, proceeding..."
|
||||
else
|
||||
log "Press any key to confirm or ^C to exit"
|
||||
read -n 1 -s
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function release_next() {
|
||||
local curr="$1"
|
||||
python3 -c "${NEXT_RELEASE_TEMPLATE/RELEASE_CURR/$curr}"
|
||||
}
|
||||
|
||||
|
||||
function packaging_version() {
|
||||
local version="$1"
|
||||
local dev_release="$2"
|
||||
if $dev_release; then
|
||||
python3 -c "${PACKAGE_DEV_VERSION_TEMPLATE/VERSION/$version}"
|
||||
else
|
||||
python3 -c "${PACKAGE_VERSION_TEMPLATE/VERSION/$version}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function git_checkout_temp() {
|
||||
local name="$1"
|
||||
local ref="$2"
|
||||
log_exec git checkout --no-track -b "$name" "$ref"
|
||||
CLEAN_BRANCHES+=("$name")
|
||||
}
|
||||
|
||||
|
||||
function branch_exists() {
|
||||
local branch="$1"
|
||||
local ref_base
|
||||
case "$branch" in
|
||||
*/*)
|
||||
ref_base='refs/remotes'
|
||||
;;
|
||||
*)
|
||||
ref_base='refs/heads'
|
||||
;;
|
||||
esac
|
||||
git for-each-ref --format='%(refname:short)' "${ref_base}/${branch}" | grep -q "^${branch}\$"
|
||||
}
|
||||
|
||||
|
||||
function _test_forward_merge() {
|
||||
local curr="$1"
|
||||
local next="$(release_next "$curr")"
|
||||
local curr_branch="${UPSTREAM_REMOTE}/release_${curr}"
|
||||
local next_branch="${UPSTREAM_REMOTE}/release_${next}"
|
||||
local curr_local_branch="__release_merge_test_${curr}"
|
||||
local next_local_branch="__release_merge_test_${next}"
|
||||
local recurse=true
|
||||
local strategy=
|
||||
log "Testing forward merge of ${curr} to ${next}"
|
||||
if ! branch_exists "$curr_local_branch"; then
|
||||
branch_exists "$curr_branch" || { log_error "No existing branch for merge test: ${curr_branch}"; exit 1; }
|
||||
git_checkout_temp "$curr_local_branch" "$curr_branch"
|
||||
fi
|
||||
if ! branch_exists "$next_branch"; then
|
||||
next_branch="${UPSTREAM_REMOTE}/${DEV_BRANCH}"
|
||||
recurse=false
|
||||
fi
|
||||
git_checkout_temp "$next_local_branch" "$next_branch"
|
||||
# Test the merge even if ignoring just to test the code path
|
||||
$TEST_MODE && strategy='-X ours'
|
||||
log_exec git merge $strategy -m 'test merge; please ignore' "$curr_local_branch" || {
|
||||
log_error "Merging unmodified ${curr} to ${next} failed, resolve upstream first!"; exit 1; }
|
||||
if $recurse; then
|
||||
_test_forward_merge "$next"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function test_forward_merge() {
|
||||
local branch_curr=$(git branch --show-current)
|
||||
_test_forward_merge "$@"
|
||||
git checkout "$branch_curr"
|
||||
}
|
||||
|
||||
|
||||
function perform_stable_merge() {
|
||||
[ "$RELEASE_TYPE" == 'initial' -o "$RELEASE_TYPE" == 'point' ] || return 0
|
||||
local branch_curr=$(git branch --show-current)
|
||||
git_checkout_temp '__stable' "${UPSTREAM_REMOTE}/${STABLE_BRANCH}"
|
||||
local stable=$(get_version_major)
|
||||
local curr_int=$(echo "$RELEASE_CURR" | tr -d .)
|
||||
local stable_int=$(echo "$stable" | tr -d .)
|
||||
if [ "$curr_int" -ge "$stable_int" ]; then
|
||||
log "Release '${RELEASE_CURR}' >= stable branch release '${stable}', merging 'release_${RELEASE_CURR}' to '${STABLE_BRANCH}'"
|
||||
log_exec git merge -m "Merge branch 'release_${RELEASE_CURR}' into '${STABLE_BRANCH}'" "__release_${RELEASE_CURR}"
|
||||
PUSH_BRANCHES+=("__stable:${STABLE_BRANCH}")
|
||||
else
|
||||
log "Release '${RELEASE_CURR}' < stable branch release '${stable}', skipping merge to to '${STABLE_BRANCH}'"
|
||||
fi
|
||||
git checkout "$branch_curr"
|
||||
}
|
||||
|
||||
|
||||
function _perform_forward_merge() {
|
||||
local curr="$1"
|
||||
local next="$(release_next "$curr")"
|
||||
local curr_branch="${UPSTREAM_REMOTE}/release_${curr}"
|
||||
local next_branch="${UPSTREAM_REMOTE}/release_${next}"
|
||||
local curr_local_branch="__release_${curr}"
|
||||
local next_local_branch="__release_${next}"
|
||||
local recurse=true
|
||||
log "Performing forward merge of ${curr} to ${next}"
|
||||
branch_exists "$curr_local_branch" || { log_error "Missing expected branch: ${curr_local_branch}"; exit 1; }
|
||||
branch_exists "$next_local_branch" && { log_error "Unexpected branch exists: ${next_local_branch}"; exit 1; }
|
||||
PUSH_BRANCHES+=("${curr_local_branch}:release_${curr}")
|
||||
if ! branch_exists "$next_branch"; then
|
||||
next_branch="${UPSTREAM_REMOTE}/${DEV_BRANCH}"
|
||||
recurse=false
|
||||
PUSH_BRANCHES+=("${next_local_branch}:${DEV_BRANCH}")
|
||||
fi
|
||||
git_checkout_temp "$next_local_branch" "$next_branch"
|
||||
# This should necessarily result in conflicts merging version.py
|
||||
log_exec git merge -X ours -m "Merge branch 'release_${curr}' into 'release_${next}'" "$curr_local_branch"
|
||||
if $recurse; then
|
||||
_perform_forward_merge "$next"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function perform_forward_merge() {
|
||||
local curr="$1"
|
||||
local branch_curr=$(git branch --show-current)
|
||||
_perform_forward_merge "$@"
|
||||
declare -p PUSH_BRANCHES
|
||||
git checkout "$branch_curr"
|
||||
}
|
||||
|
||||
|
||||
function push_merged() {
|
||||
local curr="$1"
|
||||
for branch in "${PUSH_BRANCHES[@]}"; do
|
||||
log "Pushing '${branch}' to remote '${UPSTREAM_REMOTE}'"
|
||||
log_exec git push "$UPSTREAM_REMOTE" "$branch"
|
||||
done
|
||||
if [ "$RELEASE_TYPE" == 'initial' -o "$RELEASE_TYPE" == 'point' ]; then
|
||||
log_exec git push --tags "$UPSTREAM_REMOTE"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function set_package_version_var() {
|
||||
local package_version_minor
|
||||
local dev_release='false'
|
||||
case "$RELEASE_CURR_MINOR_NEXT" in
|
||||
[0-9]*)
|
||||
package_version_minor="$RELEASE_CURR_MINOR_NEXT"
|
||||
;;
|
||||
dev)
|
||||
# TODO: you can remove this case once the current dev branch minor version is updated to dev0
|
||||
package_version_minor="0dev0"
|
||||
dev_release='true'
|
||||
;;
|
||||
*)
|
||||
package_version_minor="0${RELEASE_CURR_MINOR_NEXT}"
|
||||
dev_release='true'
|
||||
;;
|
||||
esac
|
||||
PACKAGE_VERSION=$(packaging_version "${RELEASE_CURR}.${package_version_minor}" "$dev_release")
|
||||
}
|
||||
|
||||
|
||||
function increment_minor() {
|
||||
local minor="$1"
|
||||
case "$minor" in
|
||||
+([0-9]))
|
||||
[ "$RELEASE_TYPE" != 'rc' ] || {
|
||||
log_error "Cannot create rc after release (current version: ${RELEASE_CURR}.${minor})";
|
||||
exit 1; }
|
||||
echo "$((minor + 1)).dev0"
|
||||
;;
|
||||
+([0-9]).dev*)
|
||||
[ "$RELEASE_TYPE" != 'rc' ] || {
|
||||
log_error "Cannot create rc after release (current version: ${RELEASE_CURR}.${minor})";
|
||||
exit 1; }
|
||||
echo "${minor%.*}"
|
||||
;;
|
||||
rc*)
|
||||
if [ "$RELEASE_TYPE" == 'rc' ]; then
|
||||
echo "rc$((${minor#rc*} + 1))"
|
||||
else
|
||||
echo ''
|
||||
fi
|
||||
;;
|
||||
None|'')
|
||||
[ "$RELEASE_TYPE" != 'rc' ] || {
|
||||
log_error "Cannot create rc after release (current version: ${RELEASE_CURR}.0)";
|
||||
exit 1; }
|
||||
echo '1.dev0'
|
||||
;;
|
||||
*)
|
||||
log_error "Don't know how to increment minor version: ${minor}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
function get_version_major() {
|
||||
grep '^VERSION_MAJOR' lib/galaxy/version.py | sed -E -e "s/^[^'\"]*['\"]([^'\"]*)['\"]$/\1/"
|
||||
}
|
||||
|
||||
|
||||
function get_version_minor() {
|
||||
grep '^VERSION_MINOR' lib/galaxy/version.py | sed -E -e "s/^[^'\"]*['\"]([^'\"]*)['\"]$/\1/" | tr -d '[[:space:]]'
|
||||
}
|
||||
|
||||
|
||||
function set_version_vars() {
|
||||
RELEASE_CURR="$(get_version_major)"
|
||||
RELEASE_CURR_MINOR="$(get_version_minor)"
|
||||
[[ "$RELEASE_CURR_MINOR" =~ .*"None"$ ]] && RELEASE_CURR_MINOR='0'
|
||||
: ${RELEASE_TYPE:=point}
|
||||
RELEASE_CURR_MINOR_NEXT="$(increment_minor "$RELEASE_CURR_MINOR")"
|
||||
[ -n "$RELEASE_CURR_MINOR_NEXT" ] || RELEASE_TYPE='initial'
|
||||
RELEASE_CURR_MINOR_NEXT_DEV="$(increment_minor "${RELEASE_CURR_MINOR_NEXT}")"
|
||||
set_package_version_var
|
||||
}
|
||||
|
||||
|
||||
function update_galaxy_version() {
|
||||
local key="$1"
|
||||
local val="$2"
|
||||
local match="${3:-.*}"
|
||||
log "Updating lib/galaxy/version.py for ${key} = ${val}..."
|
||||
log_exec sed -E -i -e "s/^${key} = ${match}/${key} = \"$val\"/" lib/galaxy/version.py
|
||||
}
|
||||
|
||||
|
||||
function packages_make_all() {
|
||||
local dir
|
||||
# subshell to preserve cwd
|
||||
(
|
||||
cd packages/
|
||||
for dir in *; do
|
||||
[ ! -d "$dir" -o ! -f "${dir}/setup.py" ] && continue
|
||||
# can't use log_exec here because we want to capture output
|
||||
echo + make -C "$dir" "$@" 1>&2
|
||||
make -C "$dir" "$@" >"${dir}/make-${1}.log" 2>&1
|
||||
done
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
function update_package_versions() {
|
||||
local package_version="${1:-$PACKAGE_VERSION}"
|
||||
local project_file
|
||||
log "Updating package versions to '${package_version}'..."
|
||||
(
|
||||
cd packages/
|
||||
for dir in *; do
|
||||
project_file="${dir}/galaxy/project_galaxy_${dir}.py"
|
||||
if [ -f "${project_file}" ]; then
|
||||
sed -i -e "s/^__version__ =.*/__version__ = \"${package_version}\"/" "$project_file"
|
||||
fi
|
||||
done
|
||||
)
|
||||
#git diff -- packages/
|
||||
}
|
||||
|
||||
|
||||
function perform_version_update() {
|
||||
local tag_version=
|
||||
update_package_versions
|
||||
git add -- packages/
|
||||
log 'Cleaning package dirs...'
|
||||
packages_make_all clean
|
||||
log 'Building packages (logs in packages/*/make-dist.log)...'
|
||||
if $TEST_MODE; then
|
||||
log_debug "Test mode skipping package build"
|
||||
else
|
||||
packages_make_all dist
|
||||
fi
|
||||
log 'Committing version changes...'
|
||||
log_exec git commit -m "Update version to ${RELEASE_CURR}.${RELEASE_CURR_MINOR_NEXT}"
|
||||
case "$RELEASE_TYPE" in
|
||||
initial)
|
||||
tag_version="${RELEASE_CURR}"
|
||||
;;
|
||||
point)
|
||||
tag_version="${RELEASE_CURR}.${RELEASE_CURR_MINOR_NEXT}"
|
||||
;;
|
||||
esac
|
||||
if [ -n "$tag_version" ]; then
|
||||
log_exec git tag -m "Tag version ${tag_version}" "v${tag_version}"
|
||||
CLEAN_TAGS+=("v${tag_version}")
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function perform_version_update_dev() {
|
||||
[ "$RELEASE_TYPE" == 'initial' -o "$RELEASE_TYPE" == 'point' ] || return 0
|
||||
log "Incrementing release version to '${RELEASE_CURR}.${RELEASE_CURR_MINOR_NEXT_DEV}' for development of next point release"
|
||||
update_galaxy_version 'VERSION_MINOR' "$RELEASE_CURR_MINOR_NEXT_DEV"
|
||||
log_exec git diff --exit-code && { log_error 'Missing expected version.py changes'; exit 1; } || true
|
||||
git add -- lib/galaxy/version.py
|
||||
update_package_versions
|
||||
git add -- packages/
|
||||
log_exec git commit -m "Update version to ${RELEASE_CURR}.${RELEASE_CURR_MINOR_NEXT_DEV}"
|
||||
}
|
||||
|
||||
|
||||
function create_release_rc_initial() {
|
||||
RELEASE_TYPE='rc-initial'
|
||||
RELEASE_NEXT="$(release_next "$RELEASE_CURR")"
|
||||
RELEASE_CURR_MINOR_NEXT='rc1'
|
||||
set_package_version_var
|
||||
user_verify_release
|
||||
|
||||
local _dev_branch="${UPSTREAM_REMOTE}/${DEV_BRANCH}"
|
||||
git_checkout_temp "__release_${RELEASE_CURR}" "$_dev_branch"
|
||||
|
||||
update_galaxy_version 'VERSION_MAJOR' "$RELEASE_CURR"
|
||||
update_galaxy_version 'VERSION_MINOR' "$RELEASE_CURR_MINOR_NEXT"
|
||||
log_exec git diff --exit-code && { log_error 'Missing expected version.py changes'; exit 1; } || true
|
||||
git add -- lib/galaxy/version.py
|
||||
|
||||
perform_version_update
|
||||
|
||||
# Increment version in dev branch
|
||||
git_checkout_temp "__release_${RELEASE_NEXT}" "$_dev_branch"
|
||||
|
||||
update_galaxy_version 'VERSION_MAJOR' "$RELEASE_NEXT"
|
||||
update_galaxy_version 'VERSION_MINOR' 'dev0'
|
||||
log_exec git diff --exit-code && { log_error 'Missing expected version.py changes'; exit 1; } || true
|
||||
git add -- lib/galaxy/version.py
|
||||
log_exec sed -i -e "s/^RELEASE_CURR:=.*/RELEASE_CURR:=${RELEASE_NEXT}/" Makefile
|
||||
log_exec git diff --exit-code && { log_error 'Missing expected Makefile changes'; exit 1; } || true
|
||||
git add -- Makefile
|
||||
local package_version=$(packaging_version "${RELEASE_NEXT}.0dev0" "true")
|
||||
update_package_versions "$package_version"
|
||||
git add -- packages/
|
||||
log_exec git commit -m "Update version to ${RELEASE_NEXT}.dev0"
|
||||
|
||||
# Resolve merge conflicts
|
||||
log_exec git merge -X ours -m "Merge branch 'release_${RELEASE_CURR}' into 'dev'" "__release_${RELEASE_CURR}"
|
||||
|
||||
# Push branches for PR
|
||||
local owner=$(fork_owner)
|
||||
local curr_remote_branch="version-${RELEASE_CURR}.${RELEASE_CURR_MINOR_NEXT}"
|
||||
local next_remote_branch="version-${RELEASE_NEXT}.dev"
|
||||
log_exec git push "$FORK_REMOTE" "__release_${RELEASE_CURR}:${curr_remote_branch}"
|
||||
log_exec git push "$FORK_REMOTE" "__release_${RELEASE_NEXT}:${next_remote_branch}"
|
||||
log_exec git push "$UPSTREAM_REMOTE" "refs/remotes/${UPSTREAM_REMOTE}/${DEV_BRANCH}:refs/heads/release_${RELEASE_CURR}"
|
||||
|
||||
#https://github.com/galaxyproject/galaxy/compare/{branch}...{fork_owner}:{branch}
|
||||
log "Open a PR from ${owner}/galaxy:${curr_remote_branch} to galaxyproject/galaxy:release_${RELEASE_CURR}"
|
||||
echo "- https://github.com/galaxyproject/galaxy/compare/release_${RELEASE_CURR}...${owner}:${curr_remote_branch}" 1>&2
|
||||
log "Open a PR from ${owner}/galaxy:${next_remote_branch} to galaxyproject/galaxy:dev"
|
||||
echo "- https://github.com/galaxyproject/galaxy/compare/dev...${owner}:${next_remote_branch}" 1>&2
|
||||
}
|
||||
|
||||
|
||||
function create_release_local() {
|
||||
RELEASE_CURR_MINOR="$(get_version_minor)"
|
||||
RELEASE_CURR_MINOR_NEXT="${RELEASE_CURR_MINOR}+${RELEASE_LOCAL_VERSION}"
|
||||
set_package_version_var
|
||||
user_verify_release
|
||||
# Append the local portion if this is a point release or the local portion already exists
|
||||
update_galaxy_version 'VERSION_MINOR' "\1+${RELEASE_LOCAL_VERSION}" "['\"]([^+]*)[^'\"\]*['\"]$"
|
||||
# Set the minor version to 0 and append the local version if the release version is not set (e.g. .0)
|
||||
update_galaxy_version 'VERSION_MINOR' "0+${RELEASE_LOCAL_VERSION}" 'None'
|
||||
update_galaxy_version 'VERSION_MINOR' "0+${RELEASE_LOCAL_VERSION}" '""'
|
||||
log_exec git diff --exit-code && { log_error 'Missing expected version.py changes'; exit 1; } || true
|
||||
update_package_versions
|
||||
##git add -- lib/galaxy/version.py packages/*/galaxy/project_*.py
|
||||
packages_make_all clean
|
||||
log 'Building packages (logs in packages/*/make-dist.log)...'
|
||||
packages_make_all dist
|
||||
##git commit -m "Update version to $(RELEASE_CURR)"
|
||||
##git tag -m "Tag version $(RELEASE_CURR)" v$(RELEASE_CURR)
|
||||
}
|
||||
|
||||
|
||||
function create_release_normal() {
|
||||
local _release_curr="$RELEASE_CURR"
|
||||
local _release_branch="${UPSTREAM_REMOTE}/release_${RELEASE_CURR}"
|
||||
git_checkout_temp "__release_${RELEASE_CURR}" "$_release_branch"
|
||||
set_version_vars
|
||||
[ "$_release_curr" == "$RELEASE_CURR" ] || {
|
||||
log_error "Release is incorrect in branch ${_release_branch}: ${_release_curr} != ${RELEASE_CURR}";
|
||||
exit 1; }
|
||||
|
||||
user_verify_release
|
||||
test_forward_merge "$RELEASE_CURR"
|
||||
|
||||
update_galaxy_version 'VERSION_MINOR' "$RELEASE_CURR_MINOR_NEXT"
|
||||
log_exec git diff --exit-code && { log_error 'Missing expected version.py changes'; exit 1; } || true
|
||||
git add -- lib/galaxy/version.py
|
||||
|
||||
perform_version_update
|
||||
perform_stable_merge
|
||||
perform_version_update_dev
|
||||
perform_forward_merge "$RELEASE_CURR"
|
||||
push_merged "$RELEASE_CURR"
|
||||
}
|
||||
|
||||
|
||||
function create_release() {
|
||||
log 'Fetching upstream changes...'
|
||||
git fetch "$UPSTREAM_REMOTE"
|
||||
if [ "$RELEASE_TYPE" == 'local' ]; then
|
||||
create_release_local
|
||||
elif ! branch_exists "${UPSTREAM_REMOTE}/release_${RELEASE_CURR}"; then
|
||||
create_release_rc_initial
|
||||
else
|
||||
create_release_normal
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function main() {
|
||||
ensure_upstream
|
||||
ensure_prereqs
|
||||
create_release
|
||||
}
|
||||
|
||||
|
||||
main
|
||||
Reference in New Issue
Block a user