fix(artifact-registry): correct the token exchange prerequisite

Description

The help of glab artifact-registry status and get-token, and their pages under docs/source/artifact-registry/, give two instance prerequisites: an EE instance on GitLab 19.1 or later, and token exchange enabled through the gate_token_exchange_endpoint feature flag.

The second one no longer applies. gitlab!236798 (merged) added the endpoint in 19.1 behind that flag, and gitlab!253385 (merged) removed the flag in 19.4. Up to 19.3 the endpoint answered 404 unless the flag was enabled (token_exchange.rb at v19.3.0-ee); from 19.4 it checks only authenticate! (at v19.4.0-ee), as it still does on master. So an operator following the help looks for a flag that does not exist.

This MR:

  • States the prerequisite as "A GitLab Enterprise Edition (EE) instance on GitLab 19.4 or later." in the Long help of both commands, and regenerates the two pages with make gen-docs.
  • Adds TestStatus_HelpNamesNoRemovedFeatureFlag and TestGetToken_HelpNamesNoRemovedFeatureFlag, which hold each command's help to that prerequisite and to no mention of the flag.
  • Rewrites the comments of the three 404 tests to name each kind of instance that answers 404.
  • Rewords the error a 404 from the endpoint gives, from token exchange is not enabled on this instance to token exchange is not available on this instance (requires GitLab EE 19.4 or later), as suggested in review. The three 404 tests expect the new text, and the two command tests are now TestGetToken_TokenExchangeNotAvailable and TestStatus_TokenExchangeNotAvailable.

I named a version rather than a flag, as the issue suggests, and 19.4 alone: on 19.1 the endpoint also required a permission that only an add-on purchase granted (at v19.1.0-ee), so "19.1 to 19.3 with the flag enabled" would still be incomplete. Happy to add those releases back if you prefer.

Closes gitlab-org/ops/artifact-registry#1272 (closed)

Related to gitlab#601520 (closed), the rollout issue of the removed flag.

How has this been tested?

  • The two new tests fail against main's help text, each on both assertions, and pass with this change.
  • The three 404 tests fail against the previous error text and pass with the new one.
  • go test -race ./internal/... ./cmd/... with Go 1.27.3: 7178 pass, 20 skip, none fail.
  • golangci-lint v2.15.0, the comment-overlap check, the check_docs_markdown linters and commitlint report nothing; make generate, make gen-docs, make check-embed, make check-args and go build ./... leave the tree clean.

Screenshots (if appropriate):

Help before and after, from glab built on main and on this branch

glab artifact-registry status --help on main:

  Prerequisites:

  - A GitLab Enterprise Edition (EE) instance on GitLab 19.1 or later.
  - Token exchange enabled on the instance (the
    `gate_token_exchange_endpoint` feature flag).

On this branch:

  Prerequisites:

  - A GitLab Enterprise Edition (EE) instance on GitLab 19.4 or later.

glab artifact-registry get-token --help shows the same two blocks.

Edited by José M. Requena Plens

Merge request reports

Loading
Loading