-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add more checks to build_release.py #7913
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -545,9 +545,32 @@ def find_bwc_version(release_version, bwc_dir='backwards'): | |
log(' bwc directory [%s] does not exists or is not a directory - skipping' % bwc_dir) | ||
return bwc_version | ||
|
||
def ensure_checkout_is_clean(branchName): | ||
# Make sure no local mods: | ||
s = os.popen('git diff --shortstat').read() | ||
if len(s) > 0: | ||
raise RuntimeError('git diff --shortstat is non-empty: got:\n%s' % s) | ||
|
||
# Make sure no untracked files: | ||
s = os.popen('git status').read() | ||
if s.find('Untracked files:') != -1: | ||
raise RuntimeError('git status shows untracked files: got:\n%s' % s) | ||
|
||
# Make sure we are on the right branch (NOTE: a bit weak, since we default to current branch): | ||
if s.find('On branch %s' % branchName) == -1: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For all of these find calls, you can use |
||
raise RuntimeError('git status does not show branch %s: got:\n%s' % (branchName, s)) | ||
|
||
# Make sure we have all changes from origin: | ||
if s.find('is behind') != -1: | ||
raise RuntimeError('git status shows not all changes pulled from origin; try running "git pull origin %s": got:\n%s' % (branchName, s)) | ||
|
||
# Make sure we no local unpushed changes (this is supposed to be a clean area): | ||
if s.find('is ahead') != -1: | ||
raise RuntimeError('git status shows local commits; try running "git fetch origin", "git checkout %s", "git reset --hard origin/%s": got:\n%s' % (branchName, branchName, s)) | ||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser(description='Builds and publishes a Elasticsearch Release') | ||
parser.add_argument('--branch', '-b', metavar='master', default=get_current_branch(), | ||
parser.add_argument('--branch', '-b', metavar='1.3', default=get_current_branch(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change intentional? Seems like the metavar should be something like "RELEASE_BRANCH". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was intentional; I just didn't think we would ever release from master directly :) But I agree a standin like RELEASE_BRANCH is better ... I'll switch. |
||
help='The branch to release from. Defaults to the current branch.') | ||
parser.add_argument('--cpus', '-c', metavar='1', default=1, | ||
help='The number of cpus to use for running the test. Default is [1]') | ||
|
@@ -584,6 +607,7 @@ def find_bwc_version(release_version, bwc_dir='backwards'): | |
print(' JAVA_HOME is [%s]' % JAVA_HOME) | ||
print(' Running with maven command: [%s] ' % (MVN)) | ||
if build: | ||
ensure_checkout_is_clean(src_branch) | ||
verify_lucene_version() | ||
release_version = find_release_version(src_branch) | ||
ensure_no_open_tickets(release_version) | ||
|
@@ -633,8 +657,7 @@ def find_bwc_version(release_version, bwc_dir='backwards'): | |
cherry_pick_command = ' and cherry-pick the documentation changes: \'git cherry-pick %s\' to the development branch' % (version_head_hash) | ||
pending_msg = """ | ||
Release successful pending steps: | ||
* create a version tag on github for version 'v%(version)s' | ||
* check if there are pending issues for this version (https://github.com/elasticsearch/elasticsearch/issues?labels=v%(version)s&page=1&state=open) | ||
* create a new vX.Y.Z label on github for the next release (https://github.com/elasticsearch/elasticsearch/labels) | ||
* publish the maven artifacts on Sonatype: https://oss.sonatype.org/index.html | ||
- here is a guide: https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-8a.ReleaseIt | ||
* check if the release is there https://oss.sonatype.org/content/repositories/releases/org/elasticsearch/elasticsearch/%(version)s | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use subprocess instead:
s = subprocess.check_output('git diff --shortstat', shell=True)