Skip to content

feat: Add support for GitLab Token rotation

Andrew Newdigate requested to merge gitlab-token-rotation into main

Adds a new GitLab Token rotation command.

rotate gitlab <tag>

Uses the GitLab Token rotation API to rotate a token. By default, the new token will have an expiry 1 day less than 1 year into the future.

$ pmv rotate gitlab "MyTag"
pmv: 🔓 Fetching 1password items tag=Dedicated/Sandbox/GitLab.com/PAT:Personal
pmv: 🧩 Loaded item title="GitLab Access Token: GitLab.com PAT for Sandbox Access (api): https://gitlab.com: andrewn"
pmv: 🔓 Complete, loaded items...
pmv: 🔑  Rotating token in GitLab...
pmv: 🔑  New token expiry date... expires_at=2025-05-16
pmv: 🐣  Creating new 1password item...
pmv: 🐣 Created item link=https://start.1password.com/open/...
pmv: 🗑️  Deleting old 1password item.
pmv: 🚀 Rotation complete...
  1. Unfortunately this can only be used for Personal Access Tokens at present, until gitlab-org/gitlab#462419 (closed) is resolved.
  2. Use the --expires argument to set an expiry. This can either be a date in YYYY-MM-DD format, for a duration, eg: 30d.
Edited by Andrew Newdigate

Merge request reports