Commit 7ad08894 authored by Marcel Amirault's avatar Marcel Amirault

Merge branch 'shemgyll-master-patch-74723' into 'master'

Add section for returning single project's artifacts and associated job ID

See merge request gitlab-org/gitlab!59665
parents f1d7159c d46e9291
...@@ -435,6 +435,27 @@ Ci::JobArtifact.where(project: project).order(size: :desc).limit(50).map { |a| p ...@@ -435,6 +435,27 @@ Ci::JobArtifact.where(project: project).order(size: :desc).limit(50).map { |a| p
You can change the number of job artifacts listed by modifying `.limit(50)` to You can change the number of job artifacts listed by modifying `.limit(50)` to
the number you want. the number you want.
#### List artifacts in a single project
List the artifacts for a single project, sorted by artifact size. The output includes the:
- ID of the job that created the artifact
- artifact size
- artifact file type
- artifact creation date
- on-disk location of the artifact
```ruby
p = Project.find_by_id(:project ID)
arts = Ci::JobArtifact.where(project: p)
list = arts.order('sort DESC').limit(50).each do |art|
puts "Job ID: #{art.job_id} - Size: #{art.size}b - Type: #{art.file_type} - Created: #{art.created_at} - File loc: #{art.file}"
end
```
To change the number of projects listed, change the number in `limit(50)`.
#### Delete job artifacts from jobs completed before a specific date #### Delete job artifacts from jobs completed before a specific date
WARNING: WARNING:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment