mirror of
https://github.com/hauler-dev/hauler.git
synced 2026-02-14 18:09:51 +00:00
ensure charts are always given a version tag
This commit is contained in:
@@ -75,7 +75,7 @@ func AddImageCmd(ctx context.Context, o *AddImageOpts, s *store.Layout, referenc
|
||||
func storeImage(ctx context.Context, s *store.Layout, i v1alpha1.Image) error {
|
||||
l := log.FromContext(ctx)
|
||||
|
||||
oci, err := image.NewImage(i.Name)
|
||||
img, err := image.NewImage(i.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -85,7 +85,7 @@ func storeImage(ctx context.Context, s *store.Layout, i v1alpha1.Image) error {
|
||||
return err
|
||||
}
|
||||
|
||||
desc, err := s.AddOCI(ctx, oci, r.Name())
|
||||
desc, err := s.AddOCI(ctx, img, r.Name())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -127,16 +127,16 @@ func AddChartCmd(ctx context.Context, o *AddChartOpts, s *store.Layout, chartNam
|
||||
func storeChart(ctx context.Context, s *store.Layout, cfg v1alpha1.Chart) error {
|
||||
l := log.FromContext(ctx)
|
||||
|
||||
oci, err := chart.NewChart(cfg)
|
||||
chrt, err := chart.NewChart(cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ref, err := reference.NewTagged(cfg.Name, cfg.Version)
|
||||
ref, err := reference.NewTagged(chrt.Name, chrt.Version)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
desc, err := s.AddOCI(ctx, oci, ref.Name())
|
||||
desc, err := s.AddOCI(ctx, chrt, ref.Name())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
2
go.mod
2
go.mod
@@ -12,7 +12,7 @@ require (
|
||||
github.com/mholt/archiver/v3 v3.5.1
|
||||
github.com/opencontainers/image-spec v1.0.2
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/rancherfederal/ocil v0.1.6
|
||||
github.com/rancherfederal/ocil v0.1.7
|
||||
github.com/rs/zerolog v1.26.0
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
github.com/spf13/cobra v1.2.1
|
||||
|
||||
4
go.sum
4
go.sum
@@ -869,8 +869,8 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1
|
||||
github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=
|
||||
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
||||
github.com/rancherfederal/ocil v0.1.6 h1:PncaQJkny10WHr3bYOuM6uXVUUdMki/xooNF0XiMGvo=
|
||||
github.com/rancherfederal/ocil v0.1.6/go.mod h1:l4d1cHHfdXDGtio32AYDjG6n1i1JxQK+kAom0cVf0SY=
|
||||
github.com/rancherfederal/ocil v0.1.7 h1:qIEaMEoLPbNSKZpmllZnIAj7YuD1xq1f0tVFL+32IIs=
|
||||
github.com/rancherfederal/ocil v0.1.7/go.mod h1:l4d1cHHfdXDGtio32AYDjG6n1i1JxQK+kAom0cVf0SY=
|
||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
|
||||
@@ -79,10 +79,15 @@ func NewRemoteChart(name, repo, version string) (*Chart, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
c, err := loader.Load(cp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Chart{
|
||||
Repo: repo,
|
||||
Name: name,
|
||||
Version: version,
|
||||
Name: c.Name(),
|
||||
Version: c.Metadata.Version,
|
||||
|
||||
path: cp,
|
||||
}, nil
|
||||
|
||||
2
testdata/contents.yaml
vendored
2
testdata/contents.yaml
vendored
@@ -15,7 +15,7 @@ spec:
|
||||
- path: "https://github.com/k3s-io/k3s/releases/download/v1.22.2%2Bk3s2/k3s-images.txt"
|
||||
|
||||
# when filenames are not appropriate, a name should be specified
|
||||
- path: https://get.k3s.io?filename=get-k3s.sh
|
||||
- path: https://get.k3s.io
|
||||
|
||||
---
|
||||
apiVersion: content.hauler.cattle.io/v1alpha1
|
||||
|
||||
Reference in New Issue
Block a user