glab-container-registry について
`glab` で GitLab のコンテナレジストリのリポジトリとタグを管理するコマンドラインスキルです。一覧表示や確認、削除、条件指定によるタグの一括整理に対応します。
主な機能
- 01プロジェクトやグループ別のリポジトリ一覧
- 02リポジトリ詳細とタグの確認
- 03ダイジェスト、サイズ、日付付きタグ一覧
- 04リポジトリとタグの削除
- 05正規表現や期間による一括整理
活用シーン
- 01複数プロジェクトのレジストリ内容の確認
- 02指定したリポジトリやタグの削除
- 03最新タグを残して古いタグを整理
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ vince-winkintel/ gitlab-cli-skills --skill glab-container-registryインストール後、Claude Code で/glab-container-registryを入力して読み込まれたか確認します。
同梱ファイルreferences/commands.md
詳細
glab container-registry
CLI から GitLab コンテナレジストリのリポジトリとタグを管理します。
リポジトリ ID はレジストリのリポジトリ一覧/詳細の出力から取得します。Git リポジトリのプロジェクト ID ではありません。
一般的なワークフロー
# List registry repositories for the current project
glab container-registry repository list
# List repositories for another project
glab container-registry repository list -R gitlab-org/cli
# List repositories for a group
glab container-registry repository list --group gitlab-org
# Include tag counts/tags in project repository output
glab container-registry repository list --include-tags-count --include-tags
# JSON output for automation
glab container-registry repository list --output json --jq '.[].id'
リポジトリコマンド
# View a registry repository
glab container-registry repository view <repository-id>
# Include tags in the repository response
glab container-registry repository view <repository-id> --include-tags
# Delete a repository and all images/tags published to it (destructive)
glab container-registry repository delete <repository-id>
glab container-registry repository delete <repository-id> --yes
エイリアス:repository ls、repository show、repository del。
タグコマンド
# List tags for a registry repository
glab container-registry tag list <repository-id>
# List tags for a repository in another project
glab container-registry tag list <repository-id> -R owner/repo
# Include digest, size, and creation time for each tag
glab container-registry tag list <repository-id> --details
# View a specific tag
glab container-registry tag view <repository-id> <tag-name>
# Delete one tag (destructive)
glab container-registry tag delete <repository-id> <tag-name>
glab container-registry tag delete <repository-id> <tag-name> --yes
エイリアス:tag ls、tag show、tag del。
タグの一括クリーンアップ
一括削除は GitLab によって非同期でスケジュールされます。バックグラウンドの削除ジョブが完了するまで、一致するタグが表示されたままになることがあります。
# Schedule tags matching a regex for deletion
glab container-registry tag delete <repository-id> \
--name-regex-delete '^release-.*' \
--yes
# Delete old tags while keeping the 10 most recent matching tags
glab container-registry tag delete <repository-id> \
--name-regex-delete '.*' \
--keep-n 10 \
--older-than 30d \
--yes
# Keep tags matching a regex during bulk deletion
glab container-registry tag delete <repository-id> \
--name-regex-delete '.*' \
--name-regex-keep '^stable$|^latest$' \
--yes
一括操作のフラグ:
--name-regex-delete <regex>— 削除するタグ名。--name-regex-keep <regex>— 保持するタグ名。--keep-n <n>— 一致したタグのうち、最新の N 件を保持します。--older-than <duration>—7dや1monthなどの期間より古いタグを削除します。
安全に関する注意
- リポジトリ/タグの削除コマンドは破壊的な操作として扱ってください。対象 ID と正規表現を確認するまでは、
--yesを省略してください。 - テーブルの解析ではなく、スクリプトでは
--output jsonと--jqを使用してください。 - 対象プロジェクトのチェックアウト外で実行する場合は、必ず
-R/--repoを使用してください。
リファレンス
コマンドの概要とフラグについては、references/commands.md を参照してください。
コメント
Markdown 対応