MCPcopy
hub / github.com/helm/helm / Run

Method Run

pkg/action/pull.go:73–175  ·  view source on GitHub ↗

Run executes 'helm pull' against the given release.

(chartRef string)

Source from the content-addressed store, hash-verified

71
72// Run executes 'helm pull' against the given release.
73func (p *Pull) Run(chartRef string) (string, error) {
74 var out strings.Builder
75
76 c := downloader.ChartDownloader{
77 Out: &out,
78 Keyring: p.Keyring,
79 Verify: downloader.VerifyNever,
80 Getters: getter.All(p.Settings),
81 Options: []getter.Option{
82 getter.WithBasicAuth(p.Username, p.Password),
83 getter.WithPassCredentialsAll(p.PassCredentialsAll),
84 getter.WithTLSClientConfig(p.CertFile, p.KeyFile, p.CaFile),
85 getter.WithInsecureSkipVerifyTLS(p.InsecureSkipTLSVerify),
86 getter.WithPlainHTTP(p.PlainHTTP),
87 },
88 RegistryClient: p.cfg.RegistryClient,
89 RepositoryConfig: p.Settings.RepositoryConfig,
90 RepositoryCache: p.Settings.RepositoryCache,
91 ContentCache: p.Settings.ContentCache,
92 }
93
94 if registry.IsOCI(chartRef) {
95 c.Options = append(c.Options,
96 getter.WithRegistryClient(p.cfg.RegistryClient))
97 c.RegistryClient = p.cfg.RegistryClient
98 }
99
100 if p.Verify {
101 c.Verify = downloader.VerifyAlways
102 } else if p.VerifyLater {
103 c.Verify = downloader.VerifyLater
104 }
105
106 // If untar is set, we fetch to a tempdir, then untar and copy after
107 // verification.
108 dest := p.DestDir
109 if p.Untar {
110 var err error
111 dest, err = os.MkdirTemp("", "helm-")
112 if err != nil {
113 return out.String(), fmt.Errorf("failed to untar: %w", err)
114 }
115 defer os.RemoveAll(dest)
116 }
117
118 downloadSourceRef := chartRef
119 if p.RepoURL != "" {
120 chartURL, err := repo.FindChartInRepoURL(
121 p.RepoURL,
122 chartRef,
123 getter.All(p.Settings),
124 repo.WithChartVersion(p.Version),
125 repo.WithClientTLS(p.CertFile, p.KeyFile, p.CaFile),
126 repo.WithUsernamePassword(p.Username, p.Password),
127 repo.WithInsecureSkipTLSVerify(p.InsecureSkipTLSVerify),
128 repo.WithPassCredentialsAll(p.PassCredentialsAll),
129 )
130 if err != nil {

Callers 2

newPullCmdFunction · 0.95

Calls 10

DownloadToMethod · 0.95
AllFunction · 0.92
WithBasicAuthFunction · 0.92
WithPassCredentialsAllFunction · 0.92
WithTLSClientConfigFunction · 0.92
WithPlainHTTPFunction · 0.92
IsOCIFunction · 0.92
WithRegistryClientFunction · 0.92
StringMethod · 0.45

Tested by 1