GitLab starting from version 16.0 introduced mandatory lifetime limits for tokens.
Previously, if their lifetime was unlimited, after upgrading to version 16.0, the maximum token lifetime can be 365 days.
GitLab explains this in the following publication:
Why GitLab access tokens now have lifetime limits.
To extend the lifetime of tokens, you can use the command:
gitlab-rake gitlab:tokens:edit
However, it does not provide the ability to flexibly and precisely choose which tokens need to be extended.
In response, a script was created that allows for a more specific selection of tokens for extension.
The script should be executed with the command:
gitlab-rails runner "require '/opt/gitlab/extend_tokens.rb'"