From 9730806cef6c69e9212e8e034e51e251ef0a4d63 Mon Sep 17 00:00:00 2001 From: zongz Date: Fri, 8 Nov 2024 11:46:59 +0800 Subject: [PATCH 1/3] feat: make 'kcl mod add' supports ModSpec Signed-off-by: zongz --- cmd/kcl/commands/mod_add.go | 32 ++++++++++++------- go.mod | 2 +- go.sum | 4 +-- scripts/e2e/pull_pkg.sh | 4 +++ scripts/e2e/push_pkg.sh | 6 ++++ .../test_suites/test_add_oci_ref_tag/stdout | 2 +- .../test_suites/test_kcl_mod_add_git/stdout | 2 +- .../test_suites/test_kcl_mod_add_git_1/stdout | 2 +- .../test_suites/test_kcl_mod_add_git_2/stdout | 2 +- .../test_suites/test_kcl_mod_add_git_3/stdout | 2 +- .../test_suites/test_kcl_mod_add_git_4/stdout | 2 +- .../test_suites/test_kcl_mod_add_git_5/stdout | 2 +- .../test_kcl_mod_add_git_modspec/input | 1 + .../test_kcl_mod_add_git_modspec/stderr | 0 .../test_kcl_mod_add_git_modspec/stdout | 1 + .../test_space/kcl.mod | 7 ++++ .../test_space/kcl.mod.lock | 7 ++++ .../test_space/main.k | 1 + .../test_kcl_mod_add_git_modspec_0/input | 1 + .../test_kcl_mod_add_git_modspec_0/stderr | 0 .../test_kcl_mod_add_git_modspec_0/stdout | 1 + .../test_space/kcl.mod | 7 ++++ .../test_space/kcl.mod.lock | 7 ++++ .../test_space/main.k | 1 + .../test_kcl_mod_add_git_url/input | 2 +- .../test_kcl_mod_add_git_url/stdout | 2 +- .../test_kcl_mod_add_git_url_1/input | 2 +- .../test_kcl_mod_add_git_url_1/stdout | 2 +- .../test_kcl_mod_add_git_url_2/stdout | 2 +- .../test_kcl_mod_add_git_url_3/stdout | 2 +- .../test_kcl_mod_add_git_url_4/stdout | 2 +- .../test_suites/test_kcl_mod_add_oci/stdout | 2 +- .../test_suites/test_kcl_mod_add_oci_1/stdout | 2 +- .../test_kcl_mod_add_oci_modspec/input | 1 + .../test_kcl_mod_add_oci_modspec/stderr | 0 .../test_kcl_mod_add_oci_modspec/stdout | 1 + .../test_space/kcl.mod | 7 ++++ .../test_space/kcl.mod.lock | 8 +++++ .../test_space/main.k | 1 + .../test_kcl_mod_add_oci_modspec_0/input | 1 + .../test_kcl_mod_add_oci_modspec_0/stderr | 0 .../test_kcl_mod_add_oci_modspec_0/stdout | 1 + .../test_space/kcl.mod | 7 ++++ .../test_space/kcl.mod.lock | 8 +++++ .../test_space/main.k | 1 + .../test_kcl_mod_add_oci_url/stdout | 2 +- .../test_kcl_mod_add_oci_url_2/stdout | 2 +- .../test_kcl_mod_add_oci_url_4/stdout | 2 +- test/e2e/test_suites/test_kcl_mod_pull/stdout | 6 ++-- test/e2e/test_suites/test_kcl_run_11/stdout | 6 ++-- test/e2e/test_suites/test_kcl_run_2/stdout | 6 ++-- 51 files changed, 134 insertions(+), 40 deletions(-) create mode 100644 test/e2e/test_suites/test_kcl_mod_add_git_modspec/input create mode 100644 test/e2e/test_suites/test_kcl_mod_add_git_modspec/stderr create mode 100644 test/e2e/test_suites/test_kcl_mod_add_git_modspec/stdout create mode 100644 test/e2e/test_suites/test_kcl_mod_add_git_modspec/test_space/kcl.mod create mode 100644 test/e2e/test_suites/test_kcl_mod_add_git_modspec/test_space/kcl.mod.lock create mode 100644 test/e2e/test_suites/test_kcl_mod_add_git_modspec/test_space/main.k create mode 100644 test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/input create mode 100644 test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/stderr create mode 100644 test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/stdout create mode 100644 test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/test_space/kcl.mod create mode 100644 test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/test_space/kcl.mod.lock create mode 100644 test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/test_space/main.k create mode 100644 test/e2e/test_suites/test_kcl_mod_add_oci_modspec/input create mode 100644 test/e2e/test_suites/test_kcl_mod_add_oci_modspec/stderr create mode 100644 test/e2e/test_suites/test_kcl_mod_add_oci_modspec/stdout create mode 100644 test/e2e/test_suites/test_kcl_mod_add_oci_modspec/test_space/kcl.mod create mode 100644 test/e2e/test_suites/test_kcl_mod_add_oci_modspec/test_space/kcl.mod.lock create mode 100644 test/e2e/test_suites/test_kcl_mod_add_oci_modspec/test_space/main.k create mode 100644 test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/input create mode 100644 test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/stderr create mode 100644 test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/stdout create mode 100644 test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/test_space/kcl.mod create mode 100644 test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/test_space/kcl.mod.lock create mode 100644 test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/test_space/main.k diff --git a/cmd/kcl/commands/mod_add.go b/cmd/kcl/commands/mod_add.go index 177a8d3..0a407f5 100644 --- a/cmd/kcl/commands/mod_add.go +++ b/cmd/kcl/commands/mod_add.go @@ -42,8 +42,17 @@ const ( # Add the sub module dependency named "helloworld" from the Git repo by the tag flag with ssh url kcl mod add helloworld --git ssh://github.com/kcl-lang/modules --tag v0.1.0 + # Add the sub module dependency named "cc" with version "0.0.1" from the Git repo by the commit flag with ssh url + kcl mod add cc:0.0.1 --git https://github.com/kcl-lang/flask-demo-kcl-manifests --commit 8308200 + # Add the module dependency from the OCI registry named "" by the tag flag - kcl mod add --oci https://ghcr.io/kcl-lang/helloworld --tag 0.1.0` + kcl mod add --oci https://ghcr.io/kcl-lang/helloworld --tag 0.1.0 + + # Add the sub module dependency named "subhelloworld" from the OCI registry by the tag flag + kcl mod add subhelloworld --oci https://ghcr.io/kcl-lang/helloworld --tag 0.1.4 + + # Add the sub module dependency named "subhelloworld" with version "0.0.1" from the OCI registry by the tag flag + kcl mod add subhelloworld:0.0.1 --oci https://ghcr.io/kcl-lang/helloworld --tag 0.1.4` ) // NewModAddCmd returns the mod add command. @@ -100,7 +109,10 @@ func ModAdd(cli *client.KpmClient, args []string) error { return err } - kclPkg, err := pkg.LoadKclPkg(pwd) + kclPkg, err := pkg.LoadKclPkgWithOpts( + pkg.WithPath(pwd), + pkg.WithSettings(cli.GetSettings()), + ) if err != nil { return err } @@ -110,13 +122,13 @@ func ModAdd(cli *client.KpmClient, args []string) error { return err } - addOpts, err := parseAddOptions(cli, globalPkgPath, args) + source, err := ParseSourceFromArgs(cli, args) if err != nil { return err } - if addOpts.RegistryOpts.Local != nil { - absAddPath, err := filepath.Abs(addOpts.RegistryOpts.Local.Path) + if source.Local != nil { + absAddPath, err := filepath.Abs(source.Local.Path) if err != nil { return reporter.NewErrorEvent(reporter.Bug, err, "internal bugs, please contact us to fix it.") } @@ -128,12 +140,10 @@ func ModAdd(cli *client.KpmClient, args []string) error { } } - err = addOpts.Validate() - if err != nil { - return err - } - - _, err = cli.AddDepWithOpts(kclPkg, addOpts) + err = cli.Add( + client.WithAddKclPkg(kclPkg), + client.WithAddSource(source), + ) if err != nil { return err } diff --git a/go.mod b/go.mod index aeeab48..2ea78b4 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( kcl-lang.io/kcl-go v0.10.8 kcl-lang.io/kcl-openapi v0.10.0 kcl-lang.io/kcl-plugin v0.6.0 - kcl-lang.io/kpm v0.10.1-0.20241107094147-b05e196b2c05 + kcl-lang.io/kpm v0.10.1-0.20241108034557-9be57610ec73 ) require ( diff --git a/go.sum b/go.sum index fbfc8ab..12af86a 100644 --- a/go.sum +++ b/go.sum @@ -1702,8 +1702,8 @@ kcl-lang.io/kcl-openapi v0.10.0 h1:yetZMSnn/HHaMcfiLt1P2zhCF06O33jxkjtHrm08VR8= kcl-lang.io/kcl-openapi v0.10.0/go.mod h1:kGCf0AZygrZyB+xpmMtiC3FYoiV/1rCLXuAq2QtuLf8= kcl-lang.io/kcl-plugin v0.6.0 h1:rBdoqKDPdOtojeOHCFnXoB/I7ltFjV61r0KkfOcL5sE= kcl-lang.io/kcl-plugin v0.6.0/go.mod h1:LoIouleHYRKAvFcdW30yUlhsMYH2W9zD5Ji1XHfbht4= -kcl-lang.io/kpm v0.10.1-0.20241107094147-b05e196b2c05 h1:J+Leim2cR1h6KQ0DhurhrrctgVnLrhCC/wsgJWhcBw8= -kcl-lang.io/kpm v0.10.1-0.20241107094147-b05e196b2c05/go.mod h1:1ndoNvUQdYNgoiQHIkGGRUQIWLU8BSslIbJhk9B5Kco= +kcl-lang.io/kpm v0.10.1-0.20241108034557-9be57610ec73 h1:eJ30UC0O/kEDPVJgfAcfpzmYCYfO5mWyGD4uPs6hc28= +kcl-lang.io/kpm v0.10.1-0.20241108034557-9be57610ec73/go.mod h1:1ndoNvUQdYNgoiQHIkGGRUQIWLU8BSslIbJhk9B5Kco= kcl-lang.io/lib v0.10.8 h1:/Mhko6fngIstvdx9dAS3H6N1utogkWfoARVj643l5nU= kcl-lang.io/lib v0.10.8/go.mod h1:0Dw/MQwRMjLDksxl4JerGBn/ueaxRyCCKBCCwQwJ1MI= oras.land/oras-go v1.2.6 h1:z8cmxQXBU8yZ4mkytWqXfo6tZcamPwjsuxYU81xJ8Lk= diff --git a/scripts/e2e/pull_pkg.sh b/scripts/e2e/pull_pkg.sh index 24ab401..992cf5d 100755 --- a/scripts/e2e/pull_pkg.sh +++ b/scripts/e2e/pull_pkg.sh @@ -25,4 +25,8 @@ if [ ! -d "./oci/ghcr.io/kcl-lang/helloworld/0.1.1/helloworld/0.1.1" ]; then $current_dir/bin/kcl mod pull helloworld:0.1.1 fi +if [ ! -d "./oci/ghcr.io/kcl-lang/helloworld/0.1.4/helloworld/0.1.4" ]; then + $current_dir/bin/kcl mod pull helloworld:0.1.4 +fi + cd "$current_dir" diff --git a/scripts/e2e/push_pkg.sh b/scripts/e2e/push_pkg.sh index e052fd8..c255b81 100755 --- a/scripts/e2e/push_pkg.sh +++ b/scripts/e2e/push_pkg.sh @@ -27,6 +27,12 @@ $current_dir/bin/kcl mod push cd "$current_dir" +# Push the package helloworld/0.1.4 to the registry +cd ./scripts/e2e/pkg_in_reg/oci/ghcr.io/kcl-lang/helloworld/0.1.4/helloworld/0.1.4 +$current_dir/bin/kcl mod push + +cd "$current_dir" + # Push the package 'kcl1' depends on 'k8s' to the registry cd ./scripts/e2e/pkg_in_reg/kcl1 $current_dir/bin/kcl mod push diff --git a/test/e2e/test_suites/test_add_oci_ref_tag/stdout b/test/e2e/test_suites/test_add_oci_ref_tag/stdout index c2947d1..bf84fe9 100644 --- a/test/e2e/test_suites/test_add_oci_ref_tag/stdout +++ b/test/e2e/test_suites/test_add_oci_ref_tag/stdout @@ -1 +1 @@ -add dependency 'helloworld:0.1.1' successfully \ No newline at end of file +add dependency 'helloworld:0.1.4' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git/stdout b/test/e2e/test_suites/test_kcl_mod_add_git/stdout index 82f674e..2c863e8 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_git/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_git/stdout @@ -1 +1 @@ -add dependency 'konfig:v0.4.0' successfully \ No newline at end of file +add dependency 'konfig:0.3.0' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_1/stdout b/test/e2e/test_suites/test_kcl_mod_add_git_1/stdout index 5fa9ded..a7667b3 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_git_1/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_git_1/stdout @@ -1 +1 @@ -add dependency 'konfig:main' successfully \ No newline at end of file +add dependency 'konfig:0.13.0' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_2/stdout b/test/e2e/test_suites/test_kcl_mod_add_git_2/stdout index 27b92b8..dc799f8 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_git_2/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_git_2/stdout @@ -1 +1 @@ -add dependency 'konfig:01ca24c' successfully \ No newline at end of file +add dependency 'konfig:0.4.0' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_3/stdout b/test/e2e/test_suites/test_kcl_mod_add_git_3/stdout index 27b92b8..dc799f8 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_git_3/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_git_3/stdout @@ -1 +1 @@ -add dependency 'konfig:01ca24c' successfully \ No newline at end of file +add dependency 'konfig:0.4.0' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_4/stdout b/test/e2e/test_suites/test_kcl_mod_add_git_4/stdout index 5fa9ded..a7667b3 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_git_4/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_git_4/stdout @@ -1 +1 @@ -add dependency 'konfig:main' successfully \ No newline at end of file +add dependency 'konfig:0.13.0' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_5/stdout b/test/e2e/test_suites/test_kcl_mod_add_git_5/stdout index 5fa9ded..a7667b3 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_git_5/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_git_5/stdout @@ -1 +1 @@ -add dependency 'konfig:main' successfully \ No newline at end of file +add dependency 'konfig:0.13.0' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_modspec/input b/test/e2e/test_suites/test_kcl_mod_add_git_modspec/input new file mode 100644 index 0000000..ee55b15 --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_git_modspec/input @@ -0,0 +1 @@ +kcl mod add cc --git https://github.com/kcl-lang/flask-demo-kcl-manifests --commit 8308200 \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_modspec/stderr b/test/e2e/test_suites/test_kcl_mod_add_git_modspec/stderr new file mode 100644 index 0000000..e69de29 diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_modspec/stdout b/test/e2e/test_suites/test_kcl_mod_add_git_modspec/stdout new file mode 100644 index 0000000..7b1baaf --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_git_modspec/stdout @@ -0,0 +1 @@ +add dependency 'cc:0.0.1' successfully diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_modspec/test_space/kcl.mod b/test/e2e/test_suites/test_kcl_mod_add_git_modspec/test_space/kcl.mod new file mode 100644 index 0000000..1ca23b7 --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_git_modspec/test_space/kcl.mod @@ -0,0 +1,7 @@ +[package] +name = "test_space" +edition = "v0.10.0" +version = "0.0.1" + +[dependencies] +cc = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", commit = "8308200", version = "0.0.1" } diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_modspec/test_space/kcl.mod.lock b/test/e2e/test_suites/test_kcl_mod_add_git_modspec/test_space/kcl.mod.lock new file mode 100644 index 0000000..2c68bee --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_git_modspec/test_space/kcl.mod.lock @@ -0,0 +1,7 @@ +[dependencies] + [dependencies.cc] + name = "cc" + full_name = "cc_0.0.1" + version = "0.0.1" + url = "https://github.com/kcl-lang/flask-demo-kcl-manifests" + commit = "8308200" diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_modspec/test_space/main.k b/test/e2e/test_suites/test_kcl_mod_add_git_modspec/test_space/main.k new file mode 100644 index 0000000..fa7048e --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_git_modspec/test_space/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/input b/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/input new file mode 100644 index 0000000..131c772 --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/input @@ -0,0 +1 @@ +kcl mod add cc:0.0.1 --git https://github.com/kcl-lang/flask-demo-kcl-manifests --commit 8308200 \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/stderr b/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/stderr new file mode 100644 index 0000000..e69de29 diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/stdout b/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/stdout new file mode 100644 index 0000000..7b1baaf --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/stdout @@ -0,0 +1 @@ +add dependency 'cc:0.0.1' successfully diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/test_space/kcl.mod b/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/test_space/kcl.mod new file mode 100644 index 0000000..1ca23b7 --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/test_space/kcl.mod @@ -0,0 +1,7 @@ +[package] +name = "test_space" +edition = "v0.10.0" +version = "0.0.1" + +[dependencies] +cc = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", commit = "8308200", version = "0.0.1" } diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/test_space/kcl.mod.lock b/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/test_space/kcl.mod.lock new file mode 100644 index 0000000..2c68bee --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/test_space/kcl.mod.lock @@ -0,0 +1,7 @@ +[dependencies] + [dependencies.cc] + name = "cc" + full_name = "cc_0.0.1" + version = "0.0.1" + url = "https://github.com/kcl-lang/flask-demo-kcl-manifests" + commit = "8308200" diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/test_space/main.k b/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/test_space/main.k new file mode 100644 index 0000000..fa7048e --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/test_space/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_url/input b/test/e2e/test_suites/test_kcl_mod_add_git_url/input index e13e16c..1daf856 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_git_url/input +++ b/test/e2e/test_suites/test_kcl_mod_add_git_url/input @@ -1 +1 @@ -kcl mod add https://github.com/kcl-lang/flask-demo-kcl-manifests.git --commit ade147b \ No newline at end of file +kcl mod add git://github.com/kcl-lang/flask-demo-kcl-manifests.git --commit ade147b \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_url/stdout b/test/e2e/test_suites/test_kcl_mod_add_git_url/stdout index 83ae1c5..5354b1d 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_git_url/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_git_url/stdout @@ -1 +1 @@ -add dependency 'flask-demo-kcl-manifests:ade147b' successfully \ No newline at end of file +add dependency 'flask_manifests:0.0.1' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_url_1/input b/test/e2e/test_suites/test_kcl_mod_add_git_url_1/input index a0bef0d..419ffd5 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_git_url_1/input +++ b/test/e2e/test_suites/test_kcl_mod_add_git_url_1/input @@ -1 +1 @@ -kcl mod add https://github.com/kcl-lang/flask-demo-kcl-manifests.git --branch main \ No newline at end of file +kcl mod add git://github.com/kcl-lang/flask-demo-kcl-manifests.git --branch main \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_url_1/stdout b/test/e2e/test_suites/test_kcl_mod_add_git_url_1/stdout index 095e41b..5354b1d 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_git_url_1/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_git_url_1/stdout @@ -1 +1 @@ -add dependency 'flask-demo-kcl-manifests:main' successfully \ No newline at end of file +add dependency 'flask_manifests:0.0.1' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_url_2/stdout b/test/e2e/test_suites/test_kcl_mod_add_git_url_2/stdout index 095e41b..5354b1d 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_git_url_2/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_git_url_2/stdout @@ -1 +1 @@ -add dependency 'flask-demo-kcl-manifests:main' successfully \ No newline at end of file +add dependency 'flask_manifests:0.0.1' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_url_3/stdout b/test/e2e/test_suites/test_kcl_mod_add_git_url_3/stdout index 83ae1c5..5354b1d 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_git_url_3/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_git_url_3/stdout @@ -1 +1 @@ -add dependency 'flask-demo-kcl-manifests:ade147b' successfully \ No newline at end of file +add dependency 'flask_manifests:0.0.1' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_git_url_4/stdout b/test/e2e/test_suites/test_kcl_mod_add_git_url_4/stdout index 83ae1c5..5354b1d 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_git_url_4/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_git_url_4/stdout @@ -1 +1 @@ -add dependency 'flask-demo-kcl-manifests:ade147b' successfully \ No newline at end of file +add dependency 'flask_manifests:0.0.1' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci/stdout b/test/e2e/test_suites/test_kcl_mod_add_oci/stdout index a392ce4..bf84fe9 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_oci/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_oci/stdout @@ -1 +1 @@ -add dependency 'helloworld' successfully \ No newline at end of file +add dependency 'helloworld:0.1.4' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_1/stdout b/test/e2e/test_suites/test_kcl_mod_add_oci_1/stdout index eb14c84..76bc252 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_oci_1/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_oci_1/stdout @@ -1 +1 @@ -add dependency 'kcl1' successfully \ No newline at end of file +add dependency 'kcl1:0.0.1' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/input b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/input new file mode 100644 index 0000000..1a3fee6 --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/input @@ -0,0 +1 @@ +kcl mod add subhelloworld --oci https://ghcr.io/kcl-lang/helloworld --tag 0.1.4 \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/stderr b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/stderr new file mode 100644 index 0000000..e69de29 diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/stdout b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/stdout new file mode 100644 index 0000000..a29c5b1 --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/stdout @@ -0,0 +1 @@ +add dependency 'subhelloworld:0.0.1' successfully diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/test_space/kcl.mod b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/test_space/kcl.mod new file mode 100644 index 0000000..d663d07 --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/test_space/kcl.mod @@ -0,0 +1,7 @@ +[package] +name = "test_space" +edition = "v0.10.0" +version = "0.0.1" + +[dependencies] +subhelloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.4", version = "0.0.1" } diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/test_space/kcl.mod.lock b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/test_space/kcl.mod.lock new file mode 100644 index 0000000..eb72fe2 --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/test_space/kcl.mod.lock @@ -0,0 +1,8 @@ +[dependencies] + [dependencies.subhelloworld] + name = "subhelloworld" + full_name = "subhelloworld_0.0.1" + version = "0.0.1" + reg = "ghcr.io" + repo = "kcl-lang/helloworld" + oci_tag = "0.1.4" diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/test_space/main.k b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/test_space/main.k new file mode 100644 index 0000000..fa7048e --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec/test_space/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/input b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/input new file mode 100644 index 0000000..6220063 --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/input @@ -0,0 +1 @@ +kcl mod add subhelloworld:0.0.1 --oci https://ghcr.io/kcl-lang/helloworld --tag 0.1.4 \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/stderr b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/stderr new file mode 100644 index 0000000..e69de29 diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/stdout b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/stdout new file mode 100644 index 0000000..a29c5b1 --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/stdout @@ -0,0 +1 @@ +add dependency 'subhelloworld:0.0.1' successfully diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/test_space/kcl.mod b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/test_space/kcl.mod new file mode 100644 index 0000000..d663d07 --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/test_space/kcl.mod @@ -0,0 +1,7 @@ +[package] +name = "test_space" +edition = "v0.10.0" +version = "0.0.1" + +[dependencies] +subhelloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.4", version = "0.0.1" } diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/test_space/kcl.mod.lock b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/test_space/kcl.mod.lock new file mode 100644 index 0000000..eb72fe2 --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/test_space/kcl.mod.lock @@ -0,0 +1,8 @@ +[dependencies] + [dependencies.subhelloworld] + name = "subhelloworld" + full_name = "subhelloworld_0.0.1" + version = "0.0.1" + reg = "ghcr.io" + repo = "kcl-lang/helloworld" + oci_tag = "0.1.4" diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/test_space/main.k b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/test_space/main.k new file mode 100644 index 0000000..fa7048e --- /dev/null +++ b/test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/test_space/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_url/stdout b/test/e2e/test_suites/test_kcl_mod_add_oci_url/stdout index a392ce4..bf84fe9 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_oci_url/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_oci_url/stdout @@ -1 +1 @@ -add dependency 'helloworld' successfully \ No newline at end of file +add dependency 'helloworld:0.1.4' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_url_2/stdout b/test/e2e/test_suites/test_kcl_mod_add_oci_url_2/stdout index a392ce4..bf84fe9 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_oci_url_2/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_oci_url_2/stdout @@ -1 +1 @@ -add dependency 'helloworld' successfully \ No newline at end of file +add dependency 'helloworld:0.1.4' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_add_oci_url_4/stdout b/test/e2e/test_suites/test_kcl_mod_add_oci_url_4/stdout index a392ce4..bf84fe9 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_oci_url_4/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_oci_url_4/stdout @@ -1 +1 @@ -add dependency 'helloworld' successfully \ No newline at end of file +add dependency 'helloworld:0.1.4' successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_mod_pull/stdout b/test/e2e/test_suites/test_kcl_mod_pull/stdout index a8aa5fd..3ead4d0 100644 --- a/test/e2e/test_suites/test_kcl_mod_pull/stdout +++ b/test/e2e/test_suites/test_kcl_mod_pull/stdout @@ -1,4 +1,4 @@ start to pull oci://localhost:5001/test/helloworld -the lastest version '0.1.1' will be downloaded -downloading 'test/helloworld:0.1.1' from 'localhost:5001/test/helloworld:0.1.1' -pulled helloworld 0.1.1 successfully \ No newline at end of file +the lastest version '0.1.4' will be downloaded +downloading 'test/helloworld:0.1.4' from 'localhost:5001/test/helloworld:0.1.4' +pulled helloworld 0.1.4 successfully \ No newline at end of file diff --git a/test/e2e/test_suites/test_kcl_run_11/stdout b/test/e2e/test_suites/test_kcl_run_11/stdout index 85ecfcd..56d34ff 100644 --- a/test/e2e/test_suites/test_kcl_run_11/stdout +++ b/test/e2e/test_suites/test_kcl_run_11/stdout @@ -1,3 +1,5 @@ -the lastest version '0.1.1' will be downloaded -downloading 'test/helloworld:0.1.1' from 'localhost:5001/test/helloworld:0.1.1' +the lastest version '0.1.4' will be downloaded +downloading 'test/helloworld:0.1.4' from 'localhost:5001/test/helloworld:0.1.4' +The_fisrt_schema_inst: + msg: Hello Schema! The_first_kcl_program: Hello World! diff --git a/test/e2e/test_suites/test_kcl_run_2/stdout b/test/e2e/test_suites/test_kcl_run_2/stdout index 85ecfcd..56d34ff 100644 --- a/test/e2e/test_suites/test_kcl_run_2/stdout +++ b/test/e2e/test_suites/test_kcl_run_2/stdout @@ -1,3 +1,5 @@ -the lastest version '0.1.1' will be downloaded -downloading 'test/helloworld:0.1.1' from 'localhost:5001/test/helloworld:0.1.1' +the lastest version '0.1.4' will be downloaded +downloading 'test/helloworld:0.1.4' from 'localhost:5001/test/helloworld:0.1.4' +The_fisrt_schema_inst: + msg: Hello Schema! The_first_kcl_program: Hello World! From 507879fc8230883c487f1d7211ed178c0a9f2531 Mon Sep 17 00:00:00 2001 From: zongz Date: Fri, 8 Nov 2024 14:28:39 +0800 Subject: [PATCH 2/3] fix: fix CI test Signed-off-by: zongz --- test/e2e/test_suites/test_kcl_mod_add_local_0/stdout | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/e2e/test_suites/test_kcl_mod_add_local_0/stdout b/test/e2e/test_suites/test_kcl_mod_add_local_0/stdout index 45b339f..5f0b5b5 100644 --- a/test/e2e/test_suites/test_kcl_mod_add_local_0/stdout +++ b/test/e2e/test_suites/test_kcl_mod_add_local_0/stdout @@ -1,2 +1 @@ -adding dependency 'dep' -add dependency 'dep:0.0.1' successfully \ No newline at end of file +add dependency 'dep:0.0.1' successfully From 7308b2ce5334bf32e3299b496c0ddef8b9f78ed1 Mon Sep 17 00:00:00 2001 From: zongz Date: Fri, 8 Nov 2024 15:29:08 +0800 Subject: [PATCH 3/3] fix: bump kpm version to main to fix ci test Signed-off-by: zongz --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2ea78b4..a747a0b 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( kcl-lang.io/kcl-go v0.10.8 kcl-lang.io/kcl-openapi v0.10.0 kcl-lang.io/kcl-plugin v0.6.0 - kcl-lang.io/kpm v0.10.1-0.20241108034557-9be57610ec73 + kcl-lang.io/kpm v0.10.1-0.20241108070633-70859aba1f5b ) require ( diff --git a/go.sum b/go.sum index 12af86a..5bd7c8c 100644 --- a/go.sum +++ b/go.sum @@ -1702,8 +1702,8 @@ kcl-lang.io/kcl-openapi v0.10.0 h1:yetZMSnn/HHaMcfiLt1P2zhCF06O33jxkjtHrm08VR8= kcl-lang.io/kcl-openapi v0.10.0/go.mod h1:kGCf0AZygrZyB+xpmMtiC3FYoiV/1rCLXuAq2QtuLf8= kcl-lang.io/kcl-plugin v0.6.0 h1:rBdoqKDPdOtojeOHCFnXoB/I7ltFjV61r0KkfOcL5sE= kcl-lang.io/kcl-plugin v0.6.0/go.mod h1:LoIouleHYRKAvFcdW30yUlhsMYH2W9zD5Ji1XHfbht4= -kcl-lang.io/kpm v0.10.1-0.20241108034557-9be57610ec73 h1:eJ30UC0O/kEDPVJgfAcfpzmYCYfO5mWyGD4uPs6hc28= -kcl-lang.io/kpm v0.10.1-0.20241108034557-9be57610ec73/go.mod h1:1ndoNvUQdYNgoiQHIkGGRUQIWLU8BSslIbJhk9B5Kco= +kcl-lang.io/kpm v0.10.1-0.20241108070633-70859aba1f5b h1:vpmjZzeTg9LSZwuk5MajFAMxBoOeLktVgdIRUydq/mc= +kcl-lang.io/kpm v0.10.1-0.20241108070633-70859aba1f5b/go.mod h1:1ndoNvUQdYNgoiQHIkGGRUQIWLU8BSslIbJhk9B5Kco= kcl-lang.io/lib v0.10.8 h1:/Mhko6fngIstvdx9dAS3H6N1utogkWfoARVj643l5nU= kcl-lang.io/lib v0.10.8/go.mod h1:0Dw/MQwRMjLDksxl4JerGBn/ueaxRyCCKBCCwQwJ1MI= oras.land/oras-go v1.2.6 h1:z8cmxQXBU8yZ4mkytWqXfo6tZcamPwjsuxYU81xJ8Lk=