Skip to content
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

Get artifacts files #122

Closed
iBobik opened this issue Jun 7, 2016 · 7 comments
Closed

Get artifacts files #122

iBobik opened this issue Jun 7, 2016 · 7 comments

Comments

@iBobik
Copy link

iBobik commented Jun 7, 2016

It seems library is not able to download artifacts (by /projects/:id/builds/:build_id/artifacts), only list them:

>>> import gitlab
>>> GITLAB_SERVER = 'https://gitlab.com'
>>> 
>>> gl = gitlab.Gitlab(GITLAB_SERVER, 'xxx')
>>> project = gl.projects.get(123)
>>> build = project.builds.get(12345)               
>>> build.artifacts_file
{'filename': 'artifacts.zip', 'size': 2420515}
gpocentek pushed a commit that referenced this issue Jun 7, 2016
@gpocentek
Copy link
Contributor

Thank you for the report. Could you test the issue-122 branch? I don't have the setup to test right now.

@iBobik
Copy link
Author

iBobik commented Jun 21, 2016

It works, but it is also good to write some docs how to work with it. Maybe some example for not experienced how to convert bytes to files on disk :-)

@iBobik
Copy link
Author

iBobik commented Jun 21, 2016

Also I am not sure if it uses streams, so I can process artifacts bigger than available RAM.

@gpocentek
Copy link
Contributor

I have implemented stream support in some methods (the one for which it makes sense to do so) in commit 94aea52. I would be interested in some testing. Do you think you could give it a try?

I've also added some documentation in this commit, published here: http://python-gitlab.readthedocs.io/en/latest/gl_objects/builds.html#streaming-example

@iBobik
Copy link
Author

iBobik commented Jul 17, 2016

I am not sure how to use it in companion with ZipFile stream.

I use it here:
https://github.com/iBobik/gitlab-ci-deployer/blob/master/deployer.py#L50

Could you please kick me to the right direction?

@iBobik
Copy link
Author

iBobik commented Jul 17, 2016

Btw, is it really needed to have streamed=True twice?

build.artifacts(streamed=True, streamed=True, action=target)

@gpocentek
Copy link
Contributor

The double streamed parameter is a mistake, one is enough :)

I'm not sure how to use the stream with ZipFile, I need to dig a little. I'll get back to you with some ideas as soon as I can.

Thank you for testing.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants