MCPcopy Index your code
hub / github.com/devspace-sh/devspace / AddHelmDeployment

Method AddHelmDeployment

pkg/devspace/configure/deployment.go:95–348  ·  view source on GitHub ↗

AddHelmDeployment adds a new helm deployment to the provided config

(deploymentName string)

Source from the content-addressed store, hash-verified

93
94// AddHelmDeployment adds a new helm deployment to the provided config
95func (m *manager) AddHelmDeployment(deploymentName string) error {
96 for {
97 helmConfig := &latest.HelmConfig{
98 Chart: &latest.ChartConfig{},
99 Values: map[string]interface{}{
100 "someChartValue": "",
101 },
102 }
103
104 var (
105 localPath = "Use a local Helm chart (e.g. ./helm/chart/)"
106 chartRepo = "Use a Helm chart repository (e.g. app-chart stored in https://charts.company.tld)"
107 archiveURL = "Use a .tar.gz archive from URL (e.g. https://artifacts.company.tld/chart.tar.gz)"
108 gitRepo = "Use a chart from another git repository (e.g. you have an infra repo)"
109 abort = "Abort and return to more options"
110 )
111 chartLocation, err := m.log.Question(&survey.QuestionOptions{
112 Question: "Which Helm chart do you want to use?",
113 Options: []string{
114 localPath,
115 chartRepo,
116 archiveURL,
117 gitRepo,
118 abort,
119 },
120 })
121 if err != nil {
122 return err
123 }
124
125 if chartLocation == abort {
126 return errors.New("")
127 }
128
129 if chartLocation == localPath {
130 localChartPath, err := m.log.Question(&survey.QuestionOptions{
131 Question: "Please enter the relative path to your local Helm chart (e.g. ./chart)",
132 ValidationRegexPattern: ".+",
133 })
134 if err != nil {
135 return err
136 }
137
138 absPath, err := filepath.Abs(".")
139 if err != nil {
140 return err
141 }
142
143 localChartPathRel, err := filepath.Rel(absPath, localChartPath)
144 if err != nil {
145 localChartPathRel = localChartPath
146 }
147
148 pathStat, err := os.Stat(localChartPathRel)
149 if err != nil {
150 return err
151 }
152

Callers

nothing calls this directly

Calls 10

chartRepoURLFunction · 0.85
QuestionMethod · 0.65
WriteStringMethod · 0.65
SetVarMethod · 0.65
EnvironMethod · 0.65
IsDirMethod · 0.45
ErrorfMethod · 0.45
ErrorMethod · 0.45
InfofMethod · 0.45

Tested by

no test coverage detected