diff --git a/go.mod b/go.mod index 5798eb4f..940d351e 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/sirupsen/logrus v1.9.0 github.com/urfave/cli/v2 v2.25.0 gotest.tools/v3 v3.4.0 - kcl-lang.io/kcl-go v0.6.0 + kcl-lang.io/kcl-go v0.6.1 ) require ( diff --git a/go.sum b/go.sum index 06ca97a0..8ffc1773 100644 --- a/go.sum +++ b/go.sum @@ -765,8 +765,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= kcl-lang.io/kcl-artifact-go v0.6.0 h1:J/1FKzgGRqzFDkq0amBWxCdXXRMrtg5oT3IGtoo9sgU= kcl-lang.io/kcl-artifact-go v0.6.0/go.mod h1:c07mqi9Hu2UjPW7lYfHhAAWOlZiB7lo7Vkr4jL5ov/M= -kcl-lang.io/kcl-go v0.6.0 h1:gmbTZ5VfLxL2I2lGnVG2Tpin750YMHTFQeINfj7jKBk= -kcl-lang.io/kcl-go v0.6.0/go.mod h1:1/xEscOhVGNabr9+rYC5peFDIjphbthYqk8UyHzaPRk= +kcl-lang.io/kcl-go v0.6.1 h1:we/e3qvllsOoQj0YQht+yNxI+QFLWEmYn4FQ3zAvv9E= +kcl-lang.io/kcl-go v0.6.1/go.mod h1:1/xEscOhVGNabr9+rYC5peFDIjphbthYqk8UyHzaPRk= oras.land/oras-go v1.2.3 h1:v8PJl+gEAntI1pJ/LCrDgsuk+1PKVavVEPsYIHFE5uY= oras.land/oras-go v1.2.3/go.mod h1:M/uaPdYklze0Vf3AakfarnpoEckvw0ESbRdN8Z1vdJg= oras.land/oras-go/v2 v2.3.0 h1:lqX1aXdN+DAmDTKjiDyvq85cIaI4RkIKp/PghWlAGIU= diff --git a/pkg/client/client.go b/pkg/client/client.go index 2ff28377..ae15f965 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -344,9 +344,9 @@ func (c *KpmClient) CompileOciPkg(ociSource, version string, opts *opt.CompileOp localPath := ociOpts.AddStoragePathSuffix(tmpDir) // 2. Pull the tar. - err = oci.Pull(localPath, ociOpts.Reg, ociOpts.Repo, ociOpts.Tag, c.GetSettings()) + err = c.pullTarFromOci(localPath, ociOpts) - if err != (*reporter.KpmEvent)(nil) { + if err != nil { return nil, err } @@ -1012,10 +1012,11 @@ func (c *KpmClient) pullTarFromOci(localPath string, ociOpts *opt.OciOptions) er tagSelected = ociOpts.Tag } + full_repo := utils.JoinPath(ociOpts.Reg, ociOpts.Repo) reporter.ReportEventTo( reporter.NewEvent( reporter.Pulling, - fmt.Sprintf("pulling '%s'.", ociCli.GetReference()), + fmt.Sprintf("pulling '%s:%s' from '%s'.", ociOpts.Repo, tagSelected, full_repo), ), c.logWriter, ) diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_oci_url/test_suite.stdout b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_oci_url/test_suite.stdout index a441e30a..9ccf32e7 100644 --- a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_oci_url/test_suite.stdout +++ b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_oci_url/test_suite.stdout @@ -1,4 +1,4 @@ kpm: start to pull 'oci://localhost:5001/test/k8s'. kpm: the lastest version '1.27' will be pulled. -kpm: pulling 'localhost:5001/test/k8s'. +kpm: pulling '/test/k8s:1.27' from 'localhost:5001/test/k8s'. kpm: pulled 'oci://localhost:5001/test/k8s' in '/localhost:5001/test/k8s' successfully. \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_oci_url_tag/test_suite.stdout b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_oci_url_tag/test_suite.stdout index e1dadb9d..b1880461 100644 --- a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_oci_url_tag/test_suite.stdout +++ b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_oci_url_tag/test_suite.stdout @@ -1,3 +1,3 @@ kpm: start to pull 'oci://localhost:5001/test/k8s' with tag '1.14'. -kpm: pulling 'localhost:5001/test/k8s'. +kpm: pulling '/test/k8s:1.14' from 'localhost:5001/test/k8s'. kpm: pulled 'oci://localhost:5001/test/k8s' in '/localhost:5001/test/k8s/1.14' successfully. \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_pkg_name/test_suite.stdout b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_pkg_name/test_suite.stdout index 2415ce8d..9346b4d3 100644 --- a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_pkg_name/test_suite.stdout +++ b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_pkg_name/test_suite.stdout @@ -1,4 +1,4 @@ kpm: start to pull 'k8s'. kpm: the lastest version '1.27' will be pulled. -kpm: pulling 'localhost:5001/test/k8s'. +kpm: pulling 'test/k8s:1.27' from 'localhost:5001/test/k8s'. kpm: pulled 'k8s' in '/localhost:5001/test/k8s' successfully. \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_pkg_name_tag/test_suite.stdout b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_pkg_name_tag/test_suite.stdout index da84370f..ab15009f 100644 --- a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_pkg_name_tag/test_suite.stdout +++ b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_pkg_name_tag/test_suite.stdout @@ -1,3 +1,3 @@ kpm: start to pull 'k8s:1.27'. -kpm: pulling 'localhost:5001/test/k8s'. +kpm: pulling 'test/k8s:1.27' from 'localhost:5001/test/k8s'. kpm: pulled 'k8s:1.27' in '/localhost:5001/test/k8s/1.27' successfully. \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url/test_suite.env b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url/test_suite.env new file mode 100644 index 00000000..4c789529 --- /dev/null +++ b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url/test_suite.env @@ -0,0 +1,2 @@ +KPM_HOME="" +KCLVM_VENDOR_HOME="" \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url/test_suite.input b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url/test_suite.input new file mode 100644 index 00000000..99dbf9a5 --- /dev/null +++ b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url/test_suite.input @@ -0,0 +1 @@ +kpm run oci://localhost:5001/test/kcl1 \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url/test_suite.stderr b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url/test_suite.stderr new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url/test_suite.stdout b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url/test_suite.stdout new file mode 100644 index 00000000..2e71bc77 --- /dev/null +++ b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url/test_suite.stdout @@ -0,0 +1,3 @@ +kpm: the lastest version '0.0.1' will be pulled. +kpm: pulling '/test/kcl1:0.0.1' from 'localhost:5001/test/kcl1'. +The_first_kcl_program: Hello World! \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url_quiet/test_suite.env b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url_quiet/test_suite.env new file mode 100644 index 00000000..4c789529 --- /dev/null +++ b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url_quiet/test_suite.env @@ -0,0 +1,2 @@ +KPM_HOME="" +KCLVM_VENDOR_HOME="" \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url_quiet/test_suite.input b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url_quiet/test_suite.input new file mode 100644 index 00000000..99dbf9a5 --- /dev/null +++ b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url_quiet/test_suite.input @@ -0,0 +1 @@ +kpm run oci://localhost:5001/test/kcl1 \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url_quiet/test_suite.stderr b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url_quiet/test_suite.stderr new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url_quiet/test_suite.stdout b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url_quiet/test_suite.stdout new file mode 100644 index 00000000..f4059255 --- /dev/null +++ b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_run_oci_url_quiet/test_suite.stdout @@ -0,0 +1 @@ +The_first_kcl_program: Hello World! \ No newline at end of file