You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm not quite sure why this is failing. My understanding is I should be able to use the path correctly to retrieve the artifact, but it completely fails for me.
This may have something to do with the fact that my artifact has spaces in its path?
Description of the problem, including code/CLI snippet
I'm trying to download a single artifact from a pipeline job.
Expected Behavior
Get Pipeline
Get Pipeline Job
Convert Pipeline Job to a Job
Get the artifact by path from the job
Actual Behavior
Get Pipeline
Get Pipeline Job
Convert Pipeline Job to a Job
Get the artifact by path from the job, except it returns an error saying the attribute does not exist
(venv) ╭─user ~/Repositories/ExampleRepo ‹feature/ci-ci-testing*›
╰─$ python gitlab_artifact.py 1 ↵
Traceback (most recent call last):
File "gitlab_artifact.py", line 60, in <module>
main()
File "gitlab_artifact.py", line 52, in main
a = most_recent_job.artifact("ExampleRepo/cached_service_specs.json")
File "/Users/lknecht/Repositories/ExampleRepo/venv/lib/python3.7/site-packages/gitlab/cli.py", line 43, in wrapped_f
return f(*args, **kwargs)
File "/Users/lknecht/Repositories/ExampleRepo/venv/lib/python3.7/site-packages/gitlab/exceptions.py", line 251, in wrapped_f
return f(*args, **kwargs)
File "/Users/lknecht/Repositories/ExampleRepo/venv/lib/python3.7/site-packages/gitlab/v4/objects.py", line 1397, in artifact
return utils.response_content(result, streamed, action, chunk_size)
File "/Users/lknecht/Repositories/ExampleRepo/venv/lib/python3.7/site-packages/gitlab/utils.py", line 28, in response_content
return response.content
AttributeError: 'list' object has no attribute 'content'
Specifications
python-gitlab version: 1.7.0
API version you are using (v3/v4): Unknown
Gitlab server version (or gitlab.com): GitLab Enterprise Edition 11.6.3-ee
Here is the script I've written that is failing
# Python Standard Libraries# N/A# Third-Party Librariesimportgitlab# Custom Libraries# N/ASERVER_URL="<REDACTED>"TOKEN="<REDACTED>"PROJECT_ID=<REDACTED>ARTIFACT_JOB_NAME="<REDACTED>"ARTIFACT_NAME="ExampleRepo/cached_service_specs.json"defmain():
gitlab_client=gitlab.Gitlab(SERVER_URL, private_token=TOKEN)
monitor_project=gitlab_client.projects.get(PROJECT_ID)
pipelines= [pipelineforpipelineinmonitor_project.pipelines.list()
iflen(pipeline.jobs.list()) >0forjobinpipeline.jobs.list()
ifjob.attributes["name"] ==ARTIFACT_JOB_NAME]
if(not (len(pipelines) >0)):
raiseException("No pipelines are available to retrieve artifacts from.")
most_recent_pipeline=pipelines[0]
most_recent_pipeline_job=most_recent_pipeline.jobs.list()[0]
most_recent_job=monitor_project.jobs.get(most_recent_pipeline_job.id, lazy=True)
artifact=most_recent_job.artifact(ARTIFACT_NAME)
main()
The text was updated successfully, but these errors were encountered:
loganknecht
changed the title
Job Artifact Does Not Work
Job Artifact Retrieval Does Not Work
Jan 15, 2019
The artifact you retrieve contains json data so python-gitlab interprets it instead of just returning the content as string. This shouldn't happen obviously.
http_get always tries to interpret the retrieved data if the
content-type is json. In some cases (artifact download for instance)
this is not the expected behavior.
This patch changes http_get and download methods to always get the raw
data without parsing.
Closes#683
Hello, I'm not quite sure why this is failing. My understanding is I should be able to use the path correctly to retrieve the artifact, but it completely fails for me.
This may have something to do with the fact that my artifact has spaces in its path?
Description of the problem, including code/CLI snippet
I'm trying to download a single artifact from a pipeline job.
Expected Behavior
Actual Behavior
Specifications
Here is the script I've written that is failing
The text was updated successfully, but these errors were encountered: