Skip to content

Commit

Permalink
fix: bump kpm version to 0.11.0-alpha.2 (#183)
Browse files Browse the repository at this point in the history
* fix: bump kpm version to 0.11.0-alpha.2

Signed-off-by: zongz <[email protected]>

* fix: move push on API `Push`

Signed-off-by: zongz <[email protected]>

---------

Signed-off-by: zongz <[email protected]>
  • Loading branch information
zong-zhe authored Dec 9, 2024
1 parent 25be385 commit 2dcc098
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 22 deletions.
29 changes: 13 additions & 16 deletions cmd/kcl/commands/mod_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (

"github.com/spf13/cobra"
"kcl-lang.io/kpm/pkg/client"
"kcl-lang.io/kpm/pkg/downloader"
"kcl-lang.io/kpm/pkg/errors"
kpmoci "kcl-lang.io/kpm/pkg/oci"
"kcl-lang.io/kpm/pkg/opt"
pkg "kcl-lang.io/kpm/pkg/package"
"kcl-lang.io/kpm/pkg/reporter"
"kcl-lang.io/kpm/pkg/utils"
Expand Down Expand Up @@ -164,24 +164,21 @@ func pushPackage(ociUrl string, kclPkg *pkg.KclPkg, vendorMode bool, cli *client
)
}
}

// 3. Generate the OCI options from oci url and the version of current kcl package.
ociOpts, err := opt.ParseOciOptionFromOciUrl(ociUrl, kclPkg.GetPkgTag())
if err != (*reporter.KpmEvent)(nil) {
return reporter.NewErrorEvent(
reporter.UnsupportOciUrlScheme,
errors.InvalidOciUrl,
"only support url scheme 'oci://'.",
)
}
ociOpts.Annotations, err = kclPkg.GenOciManifestFromPkg()
// 4. Push it.
ociSource := downloader.Source{}
err = ociSource.FromString(ociUrl)
if err != nil {
return err
}

reporter.ReportMsgTo(fmt.Sprintf("package '%s' will be pushed", kclPkg.GetPkgName()), cli.GetLogWriter())
// 4. Push it.
err = cli.PushToOci(tarPath, ociOpts)
ociSource.ModSpec = &downloader.ModSpec{
Name: kclPkg.GetPkgName(),
Version: kclPkg.GetPkgTag(),
}
err = cli.Push(
client.WithPushModPath(kclPkg.HomePath),
client.WithPushSource(ociSource),
client.WithPushVendorMode(vendorMode),
)
if err != (*reporter.KpmEvent)(nil) {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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.11.0-alpha.1
kcl-lang.io/kpm v0.11.0-alpha.2
)

require (
Expand All @@ -36,7 +36,7 @@ require (
github.com/dchest/siphash v1.2.3 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/ebitengine/purego v0.7.1 // indirect
github.com/elliotchance/orderedmap/v2 v2.4.0 // indirect
github.com/elliotchance/orderedmap/v2 v2.5.0 // indirect
github.com/emicklei/proto v1.13.2 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ github.com/ebitengine/purego v0.7.1/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU=
github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM=
github.com/elliotchance/orderedmap/v2 v2.4.0 h1:6tUmMwD9F998FNpwFxA5E6NQvSpk2PVw7RKsVq3+2Cw=
github.com/elliotchance/orderedmap/v2 v2.4.0/go.mod h1:85lZyVbpGaGvHvnKa7Qhx7zncAdBIBq6u56Hb1PRU5Q=
github.com/elliotchance/orderedmap/v2 v2.5.0 h1:WRPmWGChucaZ09eEd3UkU8XfVajv6ZZ6eg3+x0cLWPM=
github.com/elliotchance/orderedmap/v2 v2.5.0/go.mod h1:85lZyVbpGaGvHvnKa7Qhx7zncAdBIBq6u56Hb1PRU5Q=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/emicklei/proto v1.13.2 h1:z/etSFO3uyXeuEsVPzfl56WNgzcvIr42aQazXaQmFZY=
Expand Down Expand Up @@ -1697,8 +1697,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.11.0-alpha.1 h1:WZDfCQDinyWionkLDYe56IEeCJpcCYTAwZJtIrtCyFg=
kcl-lang.io/kpm v0.11.0-alpha.1/go.mod h1:/G40SABMTuPEVaD1lp0nvPx4v1TIvxIuDwNCV6N9YSU=
kcl-lang.io/kpm v0.11.0-alpha.2 h1:EwWt9oedkB20E7ypnR8OOxxL1oNzdOrNhnDU7vsJ9no=
kcl-lang.io/kpm v0.11.0-alpha.2/go.mod h1:Z7df8c7NwWm8KNFGd6vmO0F6LArxtuN5a2eGVY95/1g=
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=
Expand Down
5 changes: 5 additions & 0 deletions scripts/e2e/pull_pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ cd ./scripts/e2e/pkg_in_reg/


# Check if file exists

if [ ! -d "./oci/ghcr.io/kcl-lang/k8s/1.27/k8s/1.27" ]; then
$current_dir/bin/kcl mod pull k8s:1.27
fi

if [ ! -d "./oci/ghcr.io/kcl-lang/k8s/1.28/k8s/1.28" ]; then
$current_dir/bin/kcl mod pull k8s:1.28
fi
Expand Down
5 changes: 5 additions & 0 deletions scripts/e2e/push_pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ echo $current_dir

$current_dir/bin/kcl registry login -u test -p 1234 localhost:5001

cd ./scripts/e2e/pkg_in_reg/oci/ghcr.io/kcl-lang/k8s/1.27/k8s/1.27
$current_dir/bin/kcl mod push

cd "$current_dir"

cd ./scripts/e2e/pkg_in_reg/oci/ghcr.io/kcl-lang/k8s/1.28/k8s/1.28
$current_dir/bin/kcl mod push

Expand Down

0 comments on commit 2dcc098

Please sign in to comment.