-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New pypi wait strategy to fix release pipeline. (#221)
Our release pipeline needs to wait until a newly uploaded version is available in pypi, before installing the new version for testing. We were using `pip search` to determine that the new version was available, but `pip search` has been disabled at a server level (https://status.python.org/incidents/grk0k7sz6zkp). We've had issues with this approach in the past anyway, where it looked like it was globally available, but then didn't install on some specific platform. New strategy is to just retry install attempts until they work (or cap out).
- Loading branch information
Showing
8 changed files
with
43 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import time | ||
import sys | ||
import subprocess | ||
|
||
DOCS = """Given cmdline args, executes: python3 -m pip install [args...] | ||
Keeps retrying until the new version becomes available in pypi (or we time out)""" | ||
if len(sys.argv) < 2: | ||
sys.exit(DOCS) | ||
|
||
RETRY_INTERVAL_SECS = 10 | ||
GIVE_UP_AFTER_SECS = 60 * 15 | ||
|
||
pip_install_args = [sys.executable, '-m', 'pip', 'install'] + sys.argv[1:] | ||
|
||
start_time = time.time() | ||
while True: | ||
print(subprocess.list2cmdline(pip_install_args)) | ||
result = subprocess.run(pip_install_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | ||
|
||
stdout = result.stdout.decode().strip() | ||
if stdout: | ||
print(stdout) | ||
|
||
if result.returncode == 0: | ||
# success | ||
sys.exit(0) | ||
|
||
if "could not find a version" in stdout.lower(): | ||
elapsed_secs = time.time() - start_time | ||
if elapsed_secs < GIVE_UP_AFTER_SECS: | ||
# try again | ||
print("Retrying in", RETRY_INTERVAL_SECS, "secs...") | ||
time.sleep(RETRY_INTERVAL_SECS) | ||
continue | ||
else: | ||
print("Giving up on retries after", int(elapsed_secs), "total secs.") | ||
|
||
# fail | ||
sys.exit(result.returncode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/bash | ||
set -ex | ||
CURRENT_TAG_VERSION=$(git describe --tags | cut -f2 -dv) | ||
python3 -m pip install --no-cache-dir -i https://testpypi.python.org/simple --user awscrt==$CURRENT_TAG_VERSION | ||
python3 continuous-delivery/pip-install-with-retry.py --no-cache-dir -i https://testpypi.python.org/simple --user awscrt==$CURRENT_TAG_VERSION | ||
python3 continuous-delivery/test-pip-install.py |
This file was deleted.
Oops, something went wrong.