-
Notifications
You must be signed in to change notification settings - Fork 15
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
Download GitHub release artifacts #127
Conversation
👍 for the helpful messages. |
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.
Functionally tested using the OMERO 5.6.0 artifacts uploaded to ome/openmicroscopy
(thanks @joshmoore)
sbesson@ls30630:omego ((ae0dacd...)) $ venv/bin/omego download --github ome/openmicroscopy --release 5.6.0
Artifacts available for download. Initial partial matching is supported for all except named-components). Alternatively a full filename can be specified to download any artifact, including those not listed.
named-components:
server
omerozips:
server-5.6.0-ice36-b136
zips:
OMERO.server-5.6.0-ice36-b136
sbesson@ls30630:omego ((ae0dacd...)) $ time venv/bin/omego download --release 5.6.0 server --skipunzip
2020-03-20 12:18:23,092 [omego.artifa] INFO Checking https://downloads.openmicroscopy.org/omero/5.6.0/artifacts/OMERO.server-5.6.0-ice36-b136.zip
2020-03-20 12:18:23,092 [omego.fileut] INFO Downloading https://downloads.openmicroscopy.org/omero/5.6.0/artifacts/OMERO.server-5.6.0-ice36-b136.zip
real 0m44.779s
user 0m1.187s
sys 0m0.746s
sbesson@ls30630:omego ((ae0dacd...)) $ mv OMERO.server-5.6.0-ice36-b136.zip OMERO.server-5.6.0-ice36-b136.zip.2
sbesson@ls30630:omego ((ae0dacd...)) $ time venv/bin/omego download --github ome/openmicroscopy --release 5.6.0 server --skipunzip
2020-03-20 12:24:17,499 [omego.artifa] INFO Checking https://github.com/ome/openmicroscopy/releases/download/v5.6.0/OMERO.server-5.6.0-ice36-b136.zip
2020-03-20 12:24:17,499 [omego.fileut] INFO Downloading https://github.com/ome/openmicroscopy/releases/download/v5.6.0/OMERO.server-5.6.0-ice36-b136.zip
real 0m30.740s
user 0m1.095s
sys 0m0.695s
sbesson@ls30630:omego ((ae0dacd...)) $ shasum OMERO.server-5.6.0-ice36-b136.zip*
83fde9edef3818afac3a86b973ab7301c24e3690 OMERO.server-5.6.0-ice36-b136.zip
83fde9edef3818afac3a86b973ab7301c24e3690 OMERO.server-5.6.0-ice36-b136.zip.2
So in terms of functionality, this is working as expected. As per the numbers above it looks like the networking issues which initially drove this investigation have been partly resolved but I see no reason not to get this merged and released as an opt-in mechanism which might become use more and more widely.
@@ -472,6 +475,56 @@ def read_downloads(dlurl): | |||
return dl_icever | |||
|
|||
|
|||
class GithubArtifacts(ArtifactsList): |
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.
Could be renamed as GitHubArtifacts
but not a blocker
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.
I was undecided on following the GitHub
branding vs CapitalisedsubtypeArtifacts
if url: | ||
url.close() | ||
|
||
return [a['browser_download_url'] for a in d['assets']] |
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.
Main caveat of this approach is that I found it only worked with release assets of public repositories. TO be reviewed if we want to investigate using it for private repositories
Adding a few notes about my investigation of using this branch for private repository releases. Individual releases can be accessed by setting a valid GitHub OAuth token in the request header as per: diff --git a/omego/fileutils.py b/omego/fileutils.py
index fb02653..f794dc8 100644
--- a/omego/fileutils.py
+++ b/omego/fileutils.py
@@ -96,6 +96,11 @@ def open_url(url, httpuser=None, httppassword=None, method=None):
# Override method http://stackoverflow.com/a/4421485
req = urllib.request.Request(url)
+ if 'GITHUB_TOKEN' in os.environ:
+ req.add_header(
+ 'Authorization', 'token %s' % os.environ.get('GITHUB_TOKEN'))
+ log.debug('Setting authorization')
+
if method:
req.get_method = lambda: method With this change |
78097f2
to
519ed77
Compare
dd49dc3
to
c8ae100
Compare
c8ae100
to
bc91592
Compare
I think I've fixed Travis which looks like it was broken for a while. The remaining failing tests should be the ones that download from openmicroscopy.org |
A few thoughts:
|
Support downloading from GitHub releases. Currently limited to:
latest
isn't supported, nor are partial tag prefixes such as5.5
).zip
(matches the current behaviour ofomego download
, but e.g. this means you won't see the Insight.dmg)E.g.: