feat(packages): add upload command

Description

Adds glab packages upload (alias ul): uploads a local file to the package registry as a generic package, identified by --name and --version. The stored file name defaults to the local file name and can be overridden with --filename. On success it prints the resulting package URL and SHA256.

Related to #7421 (closed)

How has this been tested?

Automated:

  • go test ./internal/commands/packages/upload/...
  • golangci-lint run ./internal/commands/packages/... — 0 issues

Manual (against a project you can write to, e.g. -R group/project):

  1. Build the branch: make build
  2. echo hello > /tmp/app.txt
  3. ./bin/glab packages upload /tmp/app.txt --name my-package --version 1.0.0 -R group/project — prints the package URL and SHA256.
  4. ./bin/glab packages list -R group/project --name my-package — the uploaded package appears.
  5. ./bin/glab packages upload /tmp/app.txt --name my-package --version 1.0.0 --filename release.txt -R group/project — the file is stored under release.txt.
  6. ./bin/glab packages ul /tmp/app.txt -n my-package -v 1.0.1 -R group/project — the ul alias and short flags work.
  7. ./bin/glab packages upload /tmp/missing.txt -n my-package -v 1.0.0 -R group/project — fails cleanly with a "unable to read file" error.

Stacked MRs (review/merge bottom-up):

  1. !3393 (merged) — Add packages command group with list
  2. !3394 (merged) — Add packages upload command (depends on !3393 (merged))
  3. !3395 (merged) — Add packages download command (depends on !3394 (merged))
  4. !3396 (merged) — Add packages delete command (depends on !3395 (merged))
Edited by Oscar Tovar

Merge request reports

Loading