mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
fix: issue with helm template and oci chart
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
(cherry picked from commit aca7e8d775)
This commit is contained in:
parent
c3e5217d85
commit
aba95b9cb4
3 changed files with 23 additions and 4 deletions
|
|
@ -415,7 +415,7 @@ func (c *Client) Pull(ref string, options ...PullOption) (*PullResult, error) {
|
|||
}
|
||||
registryStore := content.Registry{Resolver: remotesResolver}
|
||||
|
||||
manifest, err := oras.Copy(ctx(c.out, c.debug), registryStore, parsedRef.OrasReference.String(), memoryStore, "",
|
||||
manifest, err := oras.Copy(ctx(c.out, c.debug), registryStore, parsedRef.String(), memoryStore, "",
|
||||
oras.WithPullEmptyNameAllowed(),
|
||||
oras.WithAllowedMediaTypes(allowedMediaTypes),
|
||||
oras.WithLayerDescriptors(func(l []ocispec.Descriptor) {
|
||||
|
|
@ -477,7 +477,7 @@ func (c *Client) Pull(ref string, options ...PullOption) (*PullResult, error) {
|
|||
},
|
||||
Chart: &DescriptorPullSummaryWithMeta{},
|
||||
Prov: &DescriptorPullSummary{},
|
||||
Ref: parsedRef.OrasReference.String(),
|
||||
Ref: parsedRef.String(),
|
||||
}
|
||||
var getManifestErr error
|
||||
if _, manifestData, ok := memoryStore.Get(manifest); !ok {
|
||||
|
|
@ -648,7 +648,7 @@ func (c *Client) Push(data []byte, ref string, options ...PushOption) (*PushResu
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if err := memoryStore.StoreManifest(parsedRef.OrasReference.String(), manifest, manifestData); err != nil {
|
||||
if err := memoryStore.StoreManifest(parsedRef.String(), manifest, manifestData); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
@ -678,7 +678,7 @@ func (c *Client) Push(data []byte, ref string, options ...PushOption) (*PushResu
|
|||
},
|
||||
Chart: chartSummary,
|
||||
Prov: &descriptorPushSummary{}, // prevent nil references
|
||||
Ref: parsedRef.OrasReference.String(),
|
||||
Ref: parsedRef.String(),
|
||||
}
|
||||
if operation.provData != nil {
|
||||
result.Prov = &descriptorPushSummary{
|
||||
|
|
|
|||
|
|
@ -69,3 +69,10 @@ func NewReference(raw string) (result Reference, err error) {
|
|||
result.Tag = result.OrasReference.Reference
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (r *Reference) String() string {
|
||||
if r.Tag == "" {
|
||||
return r.OrasReference.String() + "@" + r.Digest
|
||||
}
|
||||
return r.OrasReference.String()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,18 @@ func verify(t *testing.T, actual Reference, registry, repository, tag, digest st
|
|||
if digest != actual.Digest {
|
||||
t.Errorf("Digest expected %v actual %v", digest, actual.Digest)
|
||||
}
|
||||
expectedString := registry
|
||||
if repository != "" {
|
||||
expectedString = expectedString + "/" + repository
|
||||
}
|
||||
if tag != "" {
|
||||
expectedString = expectedString + ":" + tag
|
||||
} else {
|
||||
expectedString = expectedString + "@" + digest
|
||||
}
|
||||
if actual.String() != expectedString {
|
||||
t.Errorf("String expected %s actual %s", expectedString, actual.String())
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewReference(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue