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
c9c78d02
Commit
c9c78d02
authored
Feb 01, 2022
by
Tim Rizzi
Committed by
Nick Gaskill
Feb 01, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add helpful snippet for cleanup to docs
parent
a070eca9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
doc/administration/packages/container_registry.md
doc/administration/packages/container_registry.md
+40
-0
No files found.
doc/administration/packages/container_registry.md
View file @
c9c78d02
...
...
@@ -1548,6 +1548,46 @@ To fix this you can do one of two things:
We use a concrete example to illustrate how to
diagnose a problem with the S3 setup.
#### Investigate a cleanup policy
If you're unsure why your cleanup policy did or didn't delete a tag, execute the policy line by line
by running the below script from the
[
Rails console
](
../../administration/operations/rails_console.md
)
.
This can help diagnose problems with the policy.
```
ruby
repo
=
ContainerRepository
.
find
(
<
project_id
>
)
policy
=
repo
.
project
.
container_expiration_policy
tags
=
repo
.
tags
tags
.
map
(
&
:name
)
tags
.
reject!
(
&
:latest?
)
tags
.
map
(
&
:name
)
regex_delete
=
::
Gitlab
::
UntrustedRegexp
.
new
(
"
\\
A
#{
policy
.
name_regex
}
\\
z"
)
regex_retain
=
::
Gitlab
::
UntrustedRegexp
.
new
(
"
\\
A
#{
policy
.
name_regex_keep
}
\\
z"
)
tags
.
select!
{
|
tag
|
regex_delete
.
match?
(
tag
.
name
)
&&
!
regex_retain
.
match?
(
tag
.
name
)
}
tags
.
map
(
&
:name
)
now
=
DateTime
.
current
tags
.
sort_by!
{
|
tag
|
tag
.
created_at
||
now
}.
reverse!
# Lengthy operation
tags
=
tags
.
drop
(
policy
.
keep_n
)
tags
.
map
(
&
:name
)
older_than_timestamp
=
ChronicDuration
.
parse
(
policy
.
older_than
).
seconds
.
ago
tags
.
select!
{
|
tag
|
tag
.
created_at
&&
tag
.
created_at
<
older_than_timestamp
}
tags
.
map
(
&
:name
)
```
-
The script builds the list of tags to delete (
`tags`
).
-
`tags.map(&:name)`
prints a list of tags to remove. This may be a lengthy operation.
-
After each filter, check the list of
`tags`
to see if it contains the intended tags to destroy.
#### Unexpected 403 error during push
A user attempted to enable an S3-backed Registry. The
`docker login`
step went
...
...
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