Skip to content

Continuing Work from #367 #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

rizul2108
Copy link
Collaborator

@rizul2108 rizul2108 commented Apr 24, 2025

Fix #365

Fix #366

Issue

The artifact reference parsing logic incorrectly assumed that splitting the input by / would always yield exactly three parts — project/repository/reference. However, some repositories legitimately contain / in their names, which broke valid inputs.

For example:

nosign/mkdocs:latest

was being parsed incorrectly due to the problematic assumption.


Solution

  • Updated the reference parsing logic to properly handle : and @ as delimiters for the tag or digest (reference) portion of the artifact.
  • This allows repository names to contain / without misinterpretation safely.
  • Ensures compatibility with Harbor’s API expectations.

UI Improvement

Additionally, improved the artifact list view:

  • Tags are now correctly displayed in the output table (comma-separated if multiple).
  • Digest and Tag fields were separated properly for clarity.
  • Helps users visually confirm the image tags, vulnerabilities, size, and push time.

@rizul2108
Copy link
Collaborator Author

image

@rizul2108 rizul2108 requested review from bupd and Copilot April 24, 2025 14:04
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR resolves issues with artifact reference parsing by allowing repository names with embedded slashes and improves the Harbor CLI documentation and UI for artifact commands.

  • Fixes the parsing logic for artifact references by using ":" and "@" delimiters.
  • Updates CLI documentation (e.g., weight adjustments, command examples, and new flag options) for improved clarity and usability.
  • Enhances the artifact view command with an additional empty-reference check.

Reviewed Changes

Copilot reviewed 21 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
doc/cli-docs/harbor-artifact.md Updated weight and configuration flag; revised description to reflect new parsing logic.
doc/cli-docs/harbor-artifact-view.md Updated weight and example syntax to show new reference formats.
doc/cli-docs/harbor-artifact-tags*.md Adjusted weight and config paths across multiple tags documentation files.
doc/cli-docs/harbor-artifact-scan*.md Updated weight and config paths for scan and scan-stop/start commands.
doc/cli-docs/harbor-artifact-list.md Revised description, weight, and added new optional flags for pagination and sorting.
doc/cli-docs/harbor-artifact-delete.md Updated configuration flag.
cmd/harbor/root/artifact/view.go Updated example text and added error handling for empty artifact references.
cmd/harbor/root/artifact/list.go Enhanced command description with additional usage details.
Files not reviewed (7)
  • doc/man-docs/man1/harbor-artifact-delete.1: Language not supported
  • doc/man-docs/man1/harbor-artifact-list.1: Language not supported
  • doc/man-docs/man1/harbor-artifact-scan-start.1: Language not supported
  • doc/man-docs/man1/harbor-artifact-scan-stop.1: Language not supported
  • doc/man-docs/man1/harbor-artifact-scan.1: Language not supported
  • doc/man-docs/man1/harbor-artifact-tags-create.1: Language not supported
  • doc/man-docs/man1/harbor-artifact-tags-delete.1: Language not supported

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Rizul Gupta <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Artifact View Command artifact view vulnerabilities does not work
3 participants