AddHelmDeployment adds a new helm deployment to the provided config
(deploymentName string)
| 93 | |
| 94 | // AddHelmDeployment adds a new helm deployment to the provided config |
| 95 | func (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 |
nothing calls this directly
no test coverage detected