Skip to content

Commit 90f64bd

Browse files
committed
fix: support tag for oci ref
Signed-off-by: zongz <[email protected]>
1 parent 6abc8a2 commit 90f64bd

File tree

21 files changed

+4
-37
lines changed

21 files changed

+4
-37
lines changed

cmd/kcl/commands/mod_add.go

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -226,23 +226,10 @@ func parseAddOptions(cli *client.KpmClient, localPath string, args []string) (*o
226226
regOpt.Git.Branch = branch
227227
} else if regOpt.Oci != nil && len(tag) != 0 {
228228
regOpt.Oci.Tag = tag
229-
} else if regOpt.Registry != nil {
230-
var invalidFlag string
231-
if len(tag) != 0 {
232-
invalidFlag = tag
233-
} else if len(commit) != 0 {
234-
invalidFlag = commit
235-
} else if len(branch) != 0 {
236-
invalidFlag = branch
229+
} else if regOpt.Registry != nil && len(tag) != 0 {
230+
if regOpt.Registry.Tag == "" {
231+
regOpt.Registry.Tag = tag
237232
}
238-
var diagMsg string
239-
if len(invalidFlag) != 0 {
240-
diagMsg = fmt.Sprintf("invalid flag '%s' for oci registry ref", invalidFlag)
241-
}
242-
if len(tag) != 0 {
243-
diagMsg = fmt.Sprintf("%s, try 'kcl mod add %s:%s'", diagMsg, pkgSource, tag)
244-
}
245-
return nil, fmt.Errorf(diagMsg)
246233
}
247234

248235
return &opt.AddOptions{

scripts/registry_auth/htpasswd

Lines changed: 0 additions & 2 deletions
This file was deleted.

test/e2e/test_suites/test_add_oci_ref_invalid/stderr

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/e2e/test_suites/test_add_oci_ref_invalid_1/input

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/e2e/test_suites/test_add_oci_ref_invalid_1/stderr

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/e2e/test_suites/test_add_oci_ref_invalid_1/stdout

Whitespace-only changes.

test/e2e/test_suites/test_add_oci_ref_invalid_1/test_space/kcl.mod

Lines changed: 0 additions & 6 deletions
This file was deleted.

test/e2e/test_suites/test_add_oci_ref_invalid_1/test_space/kcl.mod.lock

Whitespace-only changes.

test/e2e/test_suites/test_add_oci_ref_invalid_1/test_space/main.k

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/e2e/test_suites/test_add_oci_ref_invalid_2/input

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)