Compare commits

...
Author SHA1 Message Date
jobevers e69e0f0c54 flailing again - trying to upload from stdin 2017-02-23 12:11:05 -06:00
jobevers 250ed2bd6a the last thing worked, now just replace json with file 2017-02-23 11:45:23 -06:00
jobevers 4ad978f3ef still flailing - what if we try to post just json 2017-02-23 11:21:46 -06:00
jobevers c05e85d0f8 still flailing - try empty name 2017-02-23 10:46:36 -06:00
jobevers 0c0b85aa7a still flailing - try lbry repo 2017-02-23 10:17:25 -06:00
jobevers 518d136d8e still flailing - try a different file 2017-02-23 09:34:30 -06:00
jobevers 318160b328 still flailing - try a random name 2017-02-23 09:16:10 -06:00
jobevers 478ca98b0e still flailing - try both requests and curl 2017-02-23 08:51:59 -06:00
jobevers 2e8c8b95c8 still flailing - use a random name 2017-02-23 08:32:28 -06:00
jobevers 6fb83f8da4 still flailing - use a simple name 2017-02-23 08:17:33 -06:00
jobevers 26c077dd79 still flailing - remove uri expansion 2017-02-22 23:14:40 -06:00
jobevers be97368123 still flailing 2017-02-22 23:05:45 -06:00
jobevers a11949608a still flailing 2017-02-22 22:53:35 -06:00
jobevers 26391cb935 flailing, lets try print some stuff 2017-02-22 18:40:39 -06:00
jobevers 4688e92aab flailing, lets try reversing the uploads 2017-02-22 17:00:19 -06:00
jobevers 498534a61e not sure what else to do, so retrying curl 2017-02-22 16:47:30 -06:00
jobevers 01e19a457b Bump version: 0.9.0rc9 → 0.9.0rc10 2017-02-22 16:14:44 -06:00
jobevers 105f234d2c update submodules 2017-02-22 15:49:14 -06:00
jobevers 18cd7608e3 revert accidental unicode testing 2017-02-22 15:49:00 -06:00
jobevers 9e7ca7c9f8 more curl debugging 2017-02-22 15:24:19 -06:00
jobevers 0c77644861 more curl debugging 2017-02-22 15:11:52 -06:00
7 changed files with 62 additions and 19 deletions

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.9.0rc9
current_version = 0.9.0rc10
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>[a-z]+)(?P<candidate>\d+))?
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "LBRY",
"version": "0.9.0rc9",
"version": "0.9.0rc10",
"main": "main.js",
"description": "LBRY is a fully decentralized, open-source protocol facilitating the discovery, access, and (sometimes) purchase of data.",
"author": {
+1
View File
@@ -41,6 +41,7 @@ build_script:
- python zip_daemon.py
- dir dist
- pip install PyGithub uritemplate
- pip install -U requests[security]
- python release_on_tag.py
test: off
+1
View File
@@ -84,6 +84,7 @@ if [ "$FULL_BUILD" == "true" ]; then
# it to reliably work and it also seemed difficult to configure. Not proud of
# this, but it seemed better to write my own.
pip install PyGithub uritemplate
pip install -U requests[security]
python release_on_tag.py
deactivate
fi
+1 -1
Submodule lbry updated: 40d4fb5641...d3d8426430.
+56 -15
View File
@@ -4,6 +4,7 @@ import json
import logging
import os
import platform
import random
import re
import subprocess
import sys
@@ -33,21 +34,21 @@ def main(args=None):
auth = github.Github(gh_token)
app_repo = auth.get_repo('lbryio/lbry-app')
# TODO: switch lbryio/lbrynet-daemon to lbryio/lbry
daemon_repo = auth.get_repo('lbryio/lbrynet-daemon')
daemon_repo = auth.get_repo('lbryio/lbry')
if not check_repo_has_tag(app_repo, current_tag):
log.info('Tag %s is not in repo %s', current_tag, app_repo)
# TODO: maybe this should be an error
return
app = get_app_artifact()
release = get_release(app_repo, current_tag)
upload_asset(release, app, gh_token)
daemon = get_daemon_artifact()
release = get_release(daemon_repo, current_tag)
upload_asset(release, daemon, gh_token)
app = get_app_artifact()
release = get_release(app_repo, current_tag)
upload_asset(release, app, gh_token)
def check_repo_has_tag(repo, target_tag):
tags = repo.get_tags().get_page(0)
@@ -84,30 +85,70 @@ def upload_asset(release, asset_to_upload, token):
basename = os.path.basename(asset_to_upload)
if is_asset_already_uploaded(release, basename):
return
count = 0
while count < 10:
try:
return _upload_asset(release, asset_to_upload, token, _curl_uploader)
except Exception:
log.exception('Failed to upload')
count += 1
def _upload_asset(release, asset_to_upload, token, uploader):
basename = os.path.basename(asset_to_upload)
upload_uri = uritemplate.expand(
release.upload_url, {'name': basename})
release.upload_url,
{'name': basename}
)
output = uploader(upload_uri, asset_to_upload, token)
if 'errors' in output:
raise Exception(output)
else:
log.info('Successfully uploaded to %s', output['browser_download_url'])
# requests doesn't work on windows / linux / osx.
def _requests_uploader(upload_uri, asset_to_upload, token):
log.info('Using requests to upload %s to %s', asset_to_upload, upload_uri)
with open(asset_to_upload, 'rb') as f:
response = requests.post(upload_uri, data=f, auth=('', token))
output = response.json()
return output
# curl -H "Content-Type: application/json" -X POST -d '{"username":"xyz","password":"xyz"}' http://localhost:3000/api/login
def _curl_uploader(upload_uri, asset_to_upload, token):
# using requests.post fails miserably with SSL EPIPE errors. I spent
# half a day trying to debug before deciding to switch to curl.
#
# TODO: actually set the content type
log.info('Using curl to upload %s to %s', asset_to_upload, upload_uri)
cmd = [
'curl', '-sS', '-X', 'POST', '-u', ':{}'.format(os.environ['GH_TOKEN']),
'--header', 'Content-Type:application/octet-stream',
'--data-binary', '@{}'.format(asset_to_upload), upload_uri
'curl',
'-sS',
'-X', 'POST',
'-u', ':{}'.format(os.environ['GH_TOKEN']),
'--header', 'Content-Type: application/octet-stream',
'--data-binary', '@-',
upload_uri
]
p = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
#'-d', '{"some_key": "some_value"}',
print 'Calling curl:'
print cmd
print
with open(asset_to_upload, 'rb') as fp:
p = subprocess.Popen(cmd, stdin=fp, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
stdout, stderr = p.communicate()
print 'curl return code:', p.returncode
if stderr:
print 'stderr output from curl:'
print stderr
output = json.loads(stdout)
print 'stdout from curl:'
print stdout
if 'errors' in output:
raise Exception(output)
else:
log.info('Successfully uploaded to %s', output['browser_download_url'])
output = json.loads(stdout)
return output
def is_asset_already_uploaded(release, basename):