glab-artifact-registry
Skill48 starsChanged 3 months agoMITView on GitHub
Exchange GitLab credentials for short-lived Artifact Registry tokens, verify token identity, and configure package-manager authentication with glab. Use when checking GitLab Artifact Registry access, obtaining an ephemeral registry token, or configuring Docker, Maven, Gradle, npm, or sbt for a GitLab Artifact Registry. Triggers on artifact registry, glab artifact-registry, glab ar, get-token, token exchange, registry access status, artifact-registry login, Docker credential helper, Maven registry, Gradle registry, npm auth, sbt credentials.
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- cormacc/dotagentsedited, first seen Sep 17, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- cormacc/dotagents★ 181% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository47 other files it gives its agents.
- gitlab-cli-skillsSkill
- glab-aliasSkill
- glab-apiSkill
- glab-attestationSkill
- glab-authSkill
- glab-changelogSkill
- glab-check-updateSkill
- glab-ciSkill
- glab-clusterSkill
- glab-completionSkill
- glab-configSkill
- glab-container-registrySkill
- glab-dependency-firewallSkill
- glab-deploy-keySkill
- glab-duoSkill
- glab-gpg-keySkill
- glab-helpSkill
- glab-incidentSkill
- glab-issueSkill
- glab-iterationSkill
- glab-jobSkill
- glab-labelSkill
- glab-mcpSkill
- glab-milestoneSkill
- glab-mrSkill
- glab-opentofuSkill
- glab-orbitSkill
- glab-packagesSkill
- glab-quick-actionsSkill
- glab-releaseSkill
- glab-repoSkill
- glab-runner-controllerSkill
- glab-runnerSkill
- glab-scheduleSkill
- glab-securefileSkill
- glab-securitySkill
- glab-skillsSkill
- glab-snippetSkill
- glab-ssh-keySkill
- glab-stackSkill
- glab-todoSkill
- glab-tokenSkill
- glab-userSkill
- glab-variableSkill
- glab-versionSkill
- glab-whatsnewSkill
- glab-workitemsSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 54
Use --output json only when a consumer also needs the expiry.
- Distinctive: line 91
Use this only for a registry actually backed by GitLab Artifact Registry.
- Very specific: line 98
Unsupported or not found: verify GitLab EE 19.1+ and the gate_token_exchange_endpoint feature flag with the instance administrator.
- Very specific: line 99
Wrong issuer/subject/audience: stop; re-check --hostname, environment-token precedence, and glab auth status --hostname <host>.
- Very specific: line 100
Duration rejected: use a Go-style duration between 1s and 12h.
- Very specific: line 102
Stored-token error during Docker setup: run glab auth login --hostname <host>.
- Very specific: line 104
Build tool still unauthenticated: verify the tool reads the file that glab artifact-registry login wrote, and that its registry URL or …
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
glab artifact-registry
Exchange the active GitLab credential for a short-lived Artifact Registry access token. The command group also accepts the glab ar alias. This command group is experimental; verify live help and the target GitLab instance before using it in durable automation.
Prerequisites
- GitLab Enterprise Edition 19.1 or later.
- The instance administrator enabled the
gate_token_exchange_endpointfeature flag. glabis authenticated to the intended hostname.
The token is ephemeral but still a credential. Never print it in logs, store it in a repository, include it in command arguments, or paste it into issue/MR content.
Check access first
status performs the token exchange and prints non-secret identity metadata: issuer, subject, audience, and expiry. Each check mints and immediately discards a server-side token; prefer JSON for automation and do not call it in a tight loop.
glab artifact-registry status --hostname gitlab.example.com --output json
# Extract only non-secret expiry metadata
glab artifact-registry status \
--hostname gitlab.example.com \
--output json \
--jq '.expires_at'Confirm that the issuer, subject, and audience identify the intended instance, actor, and registry before requesting a token for another process.
Request a short-lived token
Text output is the bare token on stdout so a shell can capture or pipe it. Default duration is 15 minutes; accepted durations range from 1 second through 12 hours. Use the shortest duration that covers the operation.
# Avoid command tracing and keep the token only in a process-local variable
set +x
artifact_token="$(glab artifact-registry get-token \
--hostname gitlab.example.com \
--duration 15m)"
# Feed via stdin, not as a command-line argument. Obtain the registry host and
# required username from the target registry's documentation or administrator.
printf '%s' "$artifact_token" | \
docker login <artifact-registry-host> \
--username '<registry-username>' \
--password-stdin
unset artifact_tokenUse --output json only when a consumer also needs the expiry. Treat the JSON document as secret because it contains the token. Do not pass --jq expressions that print the token into logs.
Configure package-manager authentication
glab artifact-registry login configures exactly one package manager per run:
--dockerinstalls thedocker-credential-glabshim and registersglabunder Docker's per-registrycredHelpers.--mavenwrites a<server>block to~/.m2/settings.xml, keyed by--registry-alias; the consuming<repository>must use the same<id>.--gradlewrites{alias}Url,{alias}Username, and{alias}Passwordto~/.gradle/gradle.properties, where{alias}is--registry-alias.--npmwrites a//{host}{path}/:_authTokenentry to~/.npmrc; you must still configureregistry=or@scope:registry=to point npm at the registry.--sbtwrites acredentials +=line to~/.sbt/1.0/credentials.sbt; sbt installs with a custom global base may not read that file.
# Inspect the intended Docker config and stored GitLab identity first
printf 'Docker config: %s\n' "${DOCKER_CONFIG:-$HOME/.docker}/config.json"
glab auth status --hostname gitlab.example.com
# Configure only the verified Artifact Registry hostname
glab artifact-registry login \
--hostname gitlab.example.com \
--docker \
--registry registry.example.com
# Configure Maven for a two-hour token
glab artifact-registry login \
--hostname gitlab.example.com \
--maven \
--registry https://ar.example.com \
--registry-alias gitlab-ar \
--duration 2hSafety and compatibility rules:
- For
--docker,--registrymust be a bare hostname, optionally with a port. For Maven, Gradle, npm, and sbt,--registryis typically a URL. - Docker exchanges a fresh token for every pull or push, so
--durationdoes not apply. Maven, Gradle, npm, and sbt receive one static token; rerun the command before--durationelapses. - The Docker helper subprocess intentionally ignores
GITLAB_TOKEN. It normally reads a token stored byglab auth login; inside a GitLab CI job, it also honorsCI_JOB_TOKENwhen CI auto-login is enabled withGLAB_ENABLE_CI_AUTOLOGIN=true. Maven, Gradle, npm, and sbt login paths can readGITLAB_TOKENbecauseglabwrites the exchanged token into each tool's config file. - Use this only for a registry actually backed by GitLab Artifact Registry. Misclassifying a normal container registry can make every pull fail because an exchanged Artifact Registry token takes precedence.
- Review the destination config path before writing:
${DOCKER_CONFIG:-$HOME/.docker}/config.json,~/.m2/settings.xml,~/.gradle/gradle.properties,~/.npmrc, or~/.sbt/1.0/credentials.sbt. --registry-aliasapplies only to Maven and Gradle. For Gradle, choose an alias that is a valid identifier in the build script; the derived default can contain hyphens.- Re-running the command for the same registry refreshes or replaces the matching entry. After configuration, test a non-destructive package-manager operation against the intended host without printing credentials.
Troubleshooting
- Unsupported or not found: verify GitLab EE 19.1+ and the
gate_token_exchange_endpointfeature flag with the instance administrator. - Wrong issuer/subject/audience: stop; re-check
--hostname, environment-token precedence, andglab auth status --hostname <host>. - Duration rejected: use a Go-style duration between
1sand12h. - Expired token: request a new short-lived token; do not persist or attempt to refresh the old one.
- Stored-token error during Docker setup: run
glab auth login --hostname <host>; an environment-only token is not used by the Docker helper. - Credential-helper conflict: inspect Docker's existing
credHelpersentry and keep the current helper unless the operator explicitly approves a migration. - Build tool still unauthenticated: verify the tool reads the file that
glab artifact-registry loginwrote, and that its registry URL or repository ID matches the written key.
See references/commands.md for captured command help.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

