@@ -600,93 +600,6 @@ To address the `Blob unknown to registry` error, include the architecture in the
individual images. For example, use `mygroup/myapp:1.0.0-amd64` and `mygroup/myapp:1.0.0-arm64v8`.
You can then tag the manifest list with `mygroup/myapp:1.0.0`.
### The cleanup policy doesn't delete any tags
There can be different reasons behind this:
- In GitLab 13.6 and earlier, when you run the cleanup policy you may expect it to delete tags and
it does not. This occurs when the cleanup policy is saved without editing the value in the
**Remove tags matching** field. This field has a grayed out `.*` value as a placeholder. Unless
`.*` (or another regex pattern) is entered explicitly into the field, a `nil` value is submitted.
This value prevents the saved cleanup policy from matching any tags. As a workaround, edit the
cleanup policy. In the **Remove tags matching** field, enter `.*` and save. This value indicates
that all tags should be removed.
- If you are on GitLab self-managed instances and you have 1000+ tags in a container repository, you
might run into a [Container Registry token expiration issue](https://gitlab.com/gitlab-org/gitlab/-/issues/288814),
with `error authorizing context: invalid token` in the logs.
To fix this, there are two workarounds:
- If you are on GitLab 13.9 or later, you can [set limits for the cleanup policy](reduce_container_registry_storage.md#set-cleanup-limits-to-conserve-resources).
This limits the cleanup execution in time, and avoids the expired token error.
- Extend the expiration delay of the Container Registry authentication tokens. This defaults to 5
minutes. You can set a custom value by running
`ApplicationSetting.last.update(container_registry_token_expire_delay: <integer>)` in the Rails
console, where `<integer>` is the desired number of minutes. For reference, 15 minutes is the
value currently in use for GitLab.com. Be aware that by extending this value you increase the
time required to revoke permissions.
If the previous fixes didn't work or you are on earlier versions of GitLab, you can generate a list
of the tags that you want to delete, and then use that list to delete the tags. To do this, follow
these steps:
1. Run the following shell script. The command just before the `for` loop ensures that
`list_o_tags.out` is always reinitialized when starting the loop. After running this command, all
the tags' names will be in the `list_o_tags.out` file:
```shell
# Get a list of all tags in a certain container repository while considering [pagination](../../../api/index.md#pagination)
-[Delete a registry repository tag](../../../api/container_registry.md#delete-a-registry-repository-tag)
-[Delete registry repository tags in bulk](../../../api/container_registry.md#delete-registry-repository-tags-in-bulk)
-[Delete a package](../package_registry/reduce_package_registry_storage.md#delete-a-package)
Here are some other options to reduce your project's use of Container Registry storage:
## Troubleshooting cleanup policies
- Use the [GitLab UI](index.md#delete-images)
to delete individual image tags or the entire repository containing all the tags.
- Use the API to [delete individual image tags](../../../api/container_registry.md#delete-a-registry-repository-tag).
- Use the API to [delete the entire container registry repository containing all the tags](../../../api/container_registry.md#delete-registry-repository).
- Use the API to [delete registry repository tags in bulk](../../../api/container_registry.md#delete-registry-repository-tags-in-bulk).
If you see the following message:
## Troubleshooting cleanup policies
"Something went wrong while updating the cleanup policy."
### `Something went wrong while updating the cleanup policy.`
Check the regex patterns to ensure they are valid.
If you see this error message, check the regex patterns to ensure they are valid.
GitLab uses [RE2 syntax](https://github.com/google/re2/wiki/Syntax) for regular expressions in the cleanup policy. You can test them with the [regex101 regex tester](https://regex101.com/).
View some common [regex pattern examples](#regex-pattern-examples).
### The cleanup policy doesn't delete any tags
There can be different reasons behind this:
- In GitLab 13.6 and earlier, when you run the cleanup policy you may expect it to delete tags and
it does not. This occurs when the cleanup policy is saved without editing the value in the
**Remove tags matching** field. This field has a grayed out `.*` value as a placeholder. Unless
`.*` (or another regex pattern) is entered explicitly into the field, a `nil` value is submitted.
This value prevents the saved cleanup policy from matching any tags. As a workaround, edit the
cleanup policy. In the **Remove tags matching** field, enter `.*` and save. This value indicates
that all tags should be removed.
- If you are on GitLab self-managed instances and you have 1000+ tags in a container repository, you
might run into a [Container Registry token expiration issue](https://gitlab.com/gitlab-org/gitlab/-/issues/288814),
with `error authorizing context: invalid token` in the logs.
To fix this, there are two workarounds:
- If you are on GitLab 13.9 or later, you can [set limits for the cleanup policy](reduce_container_registry_storage.md#set-cleanup-limits-to-conserve-resources).
This limits the cleanup execution in time, and avoids the expired token error.
- Extend the expiration delay of the Container Registry authentication tokens. This defaults to 5
minutes. You can set a custom value by running
`ApplicationSetting.last.update(container_registry_token_expire_delay: <integer>)` in the Rails
console, where `<integer>` is the desired number of minutes. For reference, 15 minutes is the
value currently in use for GitLab.com. Be aware that by extending this value you increase the
time required to revoke permissions.
If the previous fixes didn't work or you are on earlier versions of GitLab, you can generate a list
of the tags that you want to delete, and then use that list to delete the tags. To do this, follow
these steps:
1. Run the following shell script. The command just before the `for` loop ensures that
`list_o_tags.out` is always reinitialized when starting the loop. After running this command, all
the tags' names will be in the `list_o_tags.out` file:
```shell
# Get a list of all tags in a certain container repository while considering [pagination](../../../api/index.md#pagination)