glab-securefile について
glab-securefile は、リポジトリ外に置く GitLab CI/CD のセキュアファイルを管理するスキルです。プロジェクト単位で機密性のあるテキストやバイナリをダウンロード、更新、削除できます。
主な機能
- 01CI/CD セキュアファイルの管理
- 02プロジェクトのファイルを個別・一括ダウンロード
- 03ダウンロードしたファイルのチェックサム検証
- 04名前または ID による更新・削除
活用シーン
- 01パイプライン用の証明書や鍵の取得
- 02プロジェクトに保存したセキュアファイルの差し替え
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ vince-winkintel/ gitlab-cli-skills --skill glab-securefileインストール後、Claude Code で/glab-securefileを入力して読み込まれたか確認します。
同梱ファイルreferences/commands.md
詳細
glab securefile
概要
Store up to 100 files for secure use in CI/CD pipelines. Secure files are
stored outside of your project's repository, not in version control.
It is safe to store sensitive information in these files. Both plain text
and binary files are supported, but they must be smaller than 5 MB.
USAGE
glab securefile <command> [command] [--flags]
COMMANDS
create <name> <path> Upload a new secure file to a project.
download [<id> | --id <id> | --name <name>] [--flags] Download one or more secure files from a project.
get <id> [--flags] Get details of a secure file by ID.
list [--flags] List secure files in a project.
remove [<id> | --id <id> | --name <name>] [--flags] Remove a secure file from a project.
update <name> <path> [--flags] Update a secure file in a project.
FLAGS
-h --help Show help for this command.
-R --repo Select another repository. Can use either `OWNER/REPO` or `GROUP/NAMESPACE/REPO` format. Also accepts full URL or Git URL.
クイックスタート
glab securefile --help
glab securefile get には GitLab 18.0 以降が必要です。古い GitLab インスタンスでは、詳細エンドポイントが機能することを期待せず、ID または名前で一覧表示またはダウンロードしてください。
セキュアファイルのダウンロード
すべての API ページにわたるすべてのセキュアファイルをダウンロードするには、--all を使用します。最初の 100 件に限定されません。ユーザーが --no-verify または --force-download のリスクを明示的に受け入れる場合を除き、チェックサム検証は有効にしておいてください。
# Download every secure file to a controlled directory
glab securefile download --all --output-dir ./secure-files -R group/project
# Download one file to an absolute path; glab creates missing parents
glab securefile download 1 --path /tmp/secure/file.txt -R group/project
# Download all files to an absolute directory
glab securefile download --all --output-dir /tmp/secure-files -R group/project
保存先は機密情報として扱い、バージョン管理の対象外にし、ダウンロード前に対象プロジェクトを確認してください。絶対パスの --path と --output-dir 保存先がサポートされています。--all の場合、glab は選択した出力ディレクトリの外に出る可能性がある、サーバー提供の名前を拒否します。
セキュアファイルの削除
セキュアファイルの削除には、位置引数の数値 ID、--id、または --name による完全一致のファイル名を指定できます。
# Interactive confirmation
glab securefile remove 1
glab securefile remove --id 1
glab securefile remove --name signing-certificate.p12
# Approved non-interactive deletion
glab securefile remove --name signing-certificate.p12 --yes
削除は元に戻せません。非対話型環境では、--yes / -y が必要です。削除前に -R/--repo で対象プロジェクトを特定して確認し、名前が重複または曖昧になる可能性がある場合は ID を使用してください。
削除時には、位置引数の ID、--id、--name のいずれか 1 つだけを指定してください。セレクターの併用はエラーになります。先に対象ファイルを特定し、使用するセレクターを 1 つだけ指定してください。
セキュアファイルの更新
保存済みの正確な名前とローカルの置換ファイルのパスを指定して、セキュアファイルを更新します。--yes / -y を設定しない限り、コマンドは確認を求めます。overwrite はエイリアスです。
# Interactive update
glab securefile update signing-certificate.p12 ./replacement.p12
# Approved non-interactive update in an explicit project
glab securefile update signing-certificate.p12 ./replacement.p12 \
-R group/project --yes
内容が変更されていない場合、更新は行われません。更新が成功するとセキュアファイルの ID が変わるため、以降のワークフローでは --name で特定またはダウンロードするか、ID を更新してから使用してください。古い ID を再利用しないでください。確認を省略する前に、対象プロジェクト、ファイル名、置換ファイルのパスを確認してください。
サブコマンド
--help の出力全体については、references/commands.md を参照してください。