Skip to content
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

fix: imagefullName support more than two slash-separated #1907

Merged
merged 1 commit into from
Jul 13, 2023

Conversation

wongearl
Copy link
Contributor

@wongearl wongearl commented Jul 7, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

for imagefullName support more than two slash-separated, like 10.121.218.184:30002/cache/goharbor/notary-server-photon:v2.8.2, While the OCI Distribution Specification supports more than two slash-separated components

Which issue(s) this PR fixes:

Fixes #

Special notes for reviewers:

Does this PR introduced a user-facing change?

  None

Additional documentation, usage docs, etc.:


@ks-ci-bot ks-ci-bot added kind/bug Categorizes issue or PR as related to a bug. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 7, 2023
@@ -173,11 +173,18 @@ func NewManifestSpec(image string, entries []manifesttypes.ManifestEntry) manife

func validateImageName(imageFullName string) error {
image := strings.Split(imageFullName, "/")
if len(image) != 3 {
return errors.Errorf("image %s is invalid, only the format \"registry/namespace/name:tag\" is supported", imageFullName)
if len(image) >= 3 {
Copy link
Member

Choose a reason for hiding this comment

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

Bigger than 3 or less than 3?

Copy link
Contributor Author

@wongearl wongearl Jul 11, 2023

Choose a reason for hiding this comment

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

only 3 or bigger than 3 is legal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i get it

if len(image) != 3 {
return errors.Errorf("image %s is invalid, only the format \"registry/namespace/name:tag\" is supported", imageFullName)
if len(image) >= 3 {
return errors.Errorf("image %s is invalid,image PATH need contain at least two slash-separated", imageFullName)
Copy link
Member

Choose a reason for hiding this comment

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

Extra whitespace between contain at is not necessary. A whitespace after comma is necessary. invalid,image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@wongearl wongearl requested a review from LinuxSuRen July 11, 2023 09:04
}
return nil
}

func suffixImageName(imageFullName []string) string {
Copy link
Member

Choose a reason for hiding this comment

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

Good to have an unit test here.

@ImitationImmortal
Copy link
Collaborator

/lgtm
/approve

@ks-ci-bot ks-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 13, 2023
@ks-ci-bot
Copy link
Collaborator

LGTM label has been added.

Git tree hash: 7adfa3e79ac543566167f4924026047eda13eaa8

@ks-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: littleBlackHouse, wongearl

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ks-ci-bot ks-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 13, 2023
@ks-ci-bot ks-ci-bot merged commit bc409a8 into kubesphere:master Jul 13, 2023
4 checks passed
@wongearl wongearl deleted the fix/imagefullname branch July 13, 2023 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants