Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a74b1a9c
Commit
a74b1a9c
authored
Mar 13, 2022
by
Harish Ramachandran
Committed by
Evan Read
Mar 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document how to find artifacts with a certain expiration
parent
258ea35f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
doc/administration/job_artifacts.md
doc/administration/job_artifacts.md
+31
-0
No files found.
doc/administration/job_artifacts.md
View file @
a74b1a9c
...
...
@@ -414,6 +414,37 @@ space, and in some cases, manually delete job artifacts to reclaim disk space.
One possible first step is to
[
clean up _orphaned_ artifact files
](
../raketasks/cleanup.md#remove-orphan-artifact-files
)
.
#### List projects and builds with artifacts with a specific expiration (or no expiration)
Using a
[
Rails console
](
operations/rails_console.md
)
, you can find projects that have job artifacts with either:
-
No expiration date.
-
An expiration date more than 7 days in the future.
Similar to
[
deleting artifacts
](
#delete-job-artifacts-from-jobs-completed-before-a-specific-date
)
, use the following example time frames
and alter them as needed:
-
`7.days.from_now`
-
`10.days.from_now`
-
`2.weeks.from_now`
-
`3.months.from_now`
Each of the following scripts also limits the search to 50 results with
`.limit(50)`
, but this number can also be changed as needed:
```
ruby
# Find builds & projects with artifacts that never expire
builds_with_artifacts_that_never_expire
=
Ci
::
Build
.
with_downloadable_artifacts
.
where
(
artifacts_expire_at:
nil
).
limit
(
50
)
builds_with_artifacts_that_never_expire
.
find_each
do
|
build
|
puts
"Build with id
#{
build
.
id
}
has artifacts that don't expire and belongs to project
#{
build
.
project
.
full_path
}
"
end
# Find builds & projects with artifacts that expire after 7 days from today
builds_with_artifacts_that_expire_in_a_week
=
Ci
::
Build
.
with_downloadable_artifacts
.
where
(
'artifacts_expire_at > ?'
,
7
.
days
.
from_now
).
limit
(
50
)
builds_with_artifacts_that_expire_in_a_week
.
find_each
do
|
build
|
puts
"Build with id
#{
build
.
id
}
has artifacts that expire at
#{
build
.
artifacts_expire_at
}
and belongs to project
#{
build
.
project
.
full_path
}
"
end
```
#### List projects by total size of job artifacts stored
List the top 20 projects, sorted by the total size of job artifacts stored, by
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment