MCPcopy
hub / github.com/helm/helm / Pull

Method Pull

pkg/registry/client.go:558–594  ·  view source on GitHub ↗

Pull downloads a chart from a registry

(ref string, options ...PullOption)

Source from the content-addressed store, hash-verified

556
557// Pull downloads a chart from a registry
558func (c *Client) Pull(ref string, options ...PullOption) (*PullResult, error) {
559 operation := &pullOperation{
560 withChart: true, // By default, always download the chart layer
561 }
562 for _, option := range options {
563 option(operation)
564 }
565 if !operation.withChart && !operation.withProv {
566 return nil, errors.New(
567 "must specify at least one layer to pull (chart/prov)")
568 }
569
570 // Build allowed media types for chart pull
571 allowedMediaTypes := []string{
572 ocispec.MediaTypeImageIndex,
573 ocispec.MediaTypeImageManifest,
574 ConfigMediaType,
575 }
576 if operation.withChart {
577 allowedMediaTypes = append(allowedMediaTypes, ChartLayerMediaType, LegacyChartLayerMediaType)
578 }
579 if operation.withProv {
580 allowedMediaTypes = append(allowedMediaTypes, ProvLayerMediaType)
581 }
582
583 // Use generic client for the pull operation
584 genericClient := c.Generic()
585 genericResult, err := genericClient.PullGeneric(ref, GenericPullOptions{
586 AllowedMediaTypes: allowedMediaTypes,
587 })
588 if err != nil {
589 return nil, err
590 }
591
592 // Process the result with chart-specific logic
593 return c.processChartPull(genericResult, operation)
594}
595
596// PullOptWithChart returns a function that sets the withChart setting on pull
597func PullOptWithChart(withChart bool) PullOption {

Callers 5

Test_4_ManInTheMiddleMethod · 0.80
Test_5_ImageIndexMethod · 0.80
testPushFunction · 0.80
testPullFunction · 0.80
getMethod · 0.80

Calls 3

GenericMethod · 0.95
processChartPullMethod · 0.95
PullGenericMethod · 0.80

Tested by 4

Test_4_ManInTheMiddleMethod · 0.64
Test_5_ImageIndexMethod · 0.64
testPushFunction · 0.64
testPullFunction · 0.64