Commit 319c6903 authored by Craig Norris's avatar Craig Norris

Merge branch 'alvin-docs-get-tags-rails' into 'master'

Update doc to get list of  tags via rails console

See merge request gitlab-org/gitlab!69139
parents abf15216 cc72b37c
...@@ -865,6 +865,18 @@ these steps: ...@@ -865,6 +865,18 @@ these steps:
echo -n "" > list_o_tags.out; for i in {1..N}; do curl --header 'PRIVATE-TOKEN: <PAT>' "https://gitlab.example.com/api/v4/projects/<Project_id>/registry/repositories/<container_repo_id>/tags?per_page=100&page=${i}" | jq '.[].name' | sed 's:^.\(.*\).$:\1:' >> list_o_tags.out; done echo -n "" > list_o_tags.out; for i in {1..N}; do curl --header 'PRIVATE-TOKEN: <PAT>' "https://gitlab.example.com/api/v4/projects/<Project_id>/registry/repositories/<container_repo_id>/tags?per_page=100&page=${i}" | jq '.[].name' | sed 's:^.\(.*\).$:\1:' >> list_o_tags.out; done
``` ```
If you have Rails console access, you can enter the following commands to retrieve a list of tags limited by date:
```shell
output = File.open( "/tmp/list_o_tags.out","w" )
Project.find(<Project_id>).container_repositories.find(<container_repo_id>).tags.each do |tag|
output << tag.name + "\n" if tag.created_at < 1.month.ago
end;nil
output.close
```
This set of commands creates a `/tmp/list_o_tags.out` file listing all tags with a `created_at` date of older than one month.
1. Remove from the `list_o_tags.out` file any tags that you want to keep. Here are some example 1. Remove from the `list_o_tags.out` file any tags that you want to keep. Here are some example
`sed` commands for this. Note that these commands are simply examples. You may change them to `sed` commands for this. Note that these commands are simply examples. You may change them to
best suit your needs: best suit your needs:
......
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