summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorJoffrey F <f.joffrey@gmail.com>2018-04-27 15:26:28 -0700
committerGitHub <noreply@github.com>2018-04-27 15:26:28 -0700
commitbb44d06f0780c83d7d1cb375cd72760b9c7e3151 (patch)
tree8308b5af1fbca763b6e3b8ee95d18b6e4a2c9886 /script
parent948ce555da07564ca7328730392743aca02fd35d (diff)
parent90c89e34f19364023f9ff06a32c059c3c86efaaa (diff)
Merge pull request #5915 from docker/autotests_fixes
Improve release automation
Diffstat (limited to 'script')
-rw-r--r--script/release/Dockerfile3
-rwxr-xr-xscript/release/release.py22
-rwxr-xr-xscript/release/release.sh1
3 files changed, 17 insertions, 9 deletions
diff --git a/script/release/Dockerfile b/script/release/Dockerfile
index 0d4ec27e..e5af676a 100644
--- a/script/release/Dockerfile
+++ b/script/release/Dockerfile
@@ -3,7 +3,8 @@ RUN mkdir -p /src && pip install -U Jinja2==2.10 \
PyGithub==1.39 \
pypandoc==1.4 \
GitPython==2.1.9 \
- requests==2.18.4 && \
+ requests==2.18.4 \
+ twine==1.11.0 && \
apt-get update && apt-get install -y pandoc
VOLUME /src/script/release
diff --git a/script/release/release.py b/script/release/release.py
index add8fb2d..d0545a7e 100755
--- a/script/release/release.py
+++ b/script/release/release.py
@@ -27,6 +27,7 @@ from release.utils import ScriptError
from release.utils import update_init_py_version
from release.utils import update_run_sh_version
from release.utils import yesno
+from twine.commands.upload import main as twine_upload
def create_initial_branch(repository, args):
@@ -78,10 +79,9 @@ def monitor_pr_status(pr_data):
continue
summary[detail.state] += 1
print('{pending} pending, {success} successes, {failure} failures'.format(**summary))
- if status.total_count == 0:
- # Mostly for testing purposes against repos with no CI setup
- return True
- elif summary['pending'] == 0 and summary['failure'] == 0:
+ if summary['pending'] == 0 and summary['failure'] == 0 and summary['success'] > 0:
+ # This check assumes at least 1 non-DCO CI check to avoid race conditions.
+ # If testing on a repo without CI, use --skip-ci-check to avoid looping eternally
return True
elif summary['failure'] > 0:
raise ScriptError('CI failures detected!')
@@ -156,7 +156,8 @@ def resume(args):
if not pr_data:
pr_data = repository.create_release_pull_request(args.release)
check_pr_mergeable(pr_data)
- monitor_pr_status(pr_data)
+ if not args.skip_ci:
+ monitor_pr_status(pr_data)
downloader = BinaryDownloader(args.destination)
files = downloader.download_all(args.release)
if not gh_release:
@@ -195,7 +196,8 @@ def start(args):
create_initial_branch(repository, args)
pr_data = repository.create_release_pull_request(args.release)
check_pr_mergeable(pr_data)
- monitor_pr_status(pr_data)
+ if not args.skip_ci:
+ monitor_pr_status(pr_data)
downloader = BinaryDownloader(args.destination)
files = downloader.download_all(args.release)
gh_release = create_release_draft(repository, args.release, pr_data, files)
@@ -239,8 +241,8 @@ def finalize(args):
if not merge_status.merged:
raise ScriptError('Unable to merge PR #{}: {}'.format(pr_data.number, merge_status.message))
print('Uploading to PyPi')
- run_setup(os.path.join(REPO_ROOT, 'setup.py'), script_args=['upload'])
- img_manager.push_images(args.release)
+ twine_upload(['dist/*'])
+ img_manager.push_images()
repository.publish_release(gh_release)
except ScriptError as e:
print(e)
@@ -310,6 +312,10 @@ def main():
'--no-cherries', '-C', dest='cherries', action='store_false',
help='If set, the program will not prompt the user for PR numbers to cherry-pick'
)
+ parser.add_argument(
+ '--skip-ci-checks', dest='skip_ci', action='store_true',
+ help='If set, the program will not wait for CI jobs to complete'
+ )
args = parser.parse_args()
if args.action == 'start':
diff --git a/script/release/release.sh b/script/release/release.sh
index 2310429a..f592365d 100755
--- a/script/release/release.sh
+++ b/script/release/release.sh
@@ -19,6 +19,7 @@ docker run -e GITHUB_TOKEN=$GITHUB_TOKEN -e BINTRAY_TOKEN=$BINTRAY_TOKEN -it \
--mount type=bind,source=$(pwd),target=/src \
--mount type=bind,source=$(pwd)/.git,target=/src/.git \
--mount type=bind,source=$HOME/.docker,target=/root/.docker \
+ --mount type=bind,source=$HOME/.gitconfig,target=/root/.gitconfig
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
--mount type=bind,source=$HOME/.ssh,target=/root/.ssh \
-v $HOME/.pypirc:/root/.pypirc \