Commit c19eba7b authored by BENJAMIN ERIC HOMAN's avatar BENJAMIN ERIC HOMAN

remove duplicated check

parent 4d4b7bfc
Pipeline #113111 waiting for manual action with stages
in 54 seconds
......@@ -413,8 +413,6 @@ func GetChartVersion(body []byte, name string) (piece string, err error) {
color.New(color.FgCyan).Printf("Chart.APIVersion '%s'\n", chart.APIVersion)
color.New(color.FgCyan).Printf("Chart.Generated '%s'\n", chart.Generated)
color.New(color.FgCyan).Printf("Chart.ServerInfo '%s'\n", chart.ServerInfo)
color.New(color.FgCyan).Printf("Chart.Entries 'supressed'\n")
var latestcron EioSweCronjob
var latestservice EioSweService
......@@ -423,7 +421,6 @@ func GetChartVersion(body []byte, name string) (piece string, err error) {
if e7[x].Created.After(latestcron.Created) {
latestcron = e7[x]
}
// color.New(color.FgCyan).Printf("Chart.EioSwe_Cronjob: '%s','%s','%s'\n", e7[x].Created, e7[x].Version, e7[x].Name)
}
e8 := chart.Entries.EioSweServices
......@@ -431,7 +428,6 @@ func GetChartVersion(body []byte, name string) (piece string, err error) {
if e8[x].Created.After(latestservice.Created) {
latestservice = e8[x]
}
// color.New(color.FgCyan).Printf("Chart.EioSwe_Service: '%s','%s','%s'\n", e8[x].Created, e8[x].Version, e8[x].Name)
}
// no other types are used by devtool build that I am aware of so only examine these
......@@ -442,18 +438,11 @@ func GetChartVersion(body []byte, name string) (piece string, err error) {
entryVersion = latestcron.Version
entryCreated = latestcron.Created.String()
entryName = latestcron.Name
// color.New(color.FgCyan).Printf("Latest.EioSwe_Cronjob.Created '%s'\n", latestcron.Created)
// color.New(color.FgCyan).Printf("Latest.EioSwe_Cronjob.Name '%s'\n", latestcron.Name)
// color.New(color.FgCyan).Printf("Latest.EioSwe_Cronjob.Version '%s'\n\n", latestcron.Version)
}
if name == latestservice.Name {
entryVersion = latestservice.Version
entryCreated = latestservice.Created.String()
entryName = latestservice.Name
// color.New(color.FgCyan).Printf("Latest.EioSwe_Service.Created '%s'\n", latestservice.Created)
// color.New(color.FgCyan).Printf("Latest.EioSwe_Service.Name '%s'\n", latestservice.Name)
// color.New(color.FgCyan).Printf("Latest.EioSwe_Service.Version '%s'\n\n", latestservice.Version)
}
color.New(color.FgCyan).Printf("latest Chart: '%s','%s','%s'\n", entryVersion, entryCreated, entryName)
return entryVersion, err
......
......@@ -208,7 +208,6 @@ func buildDockerAndDeploy(config config.Config) error {
color.Blue("Installing Chart")
checkLocalChartVersion(deployable)
checkIndexYamlVersion(deployable)
releaseName := deployable.Name + "-local"
......@@ -308,38 +307,3 @@ func checkIndexYamlVersion(deployable config.Deployable) {
color.Red("\nA newer chart version is available: requested version: '%s', available version: '%s' Compared against '%s'.\n\n", deployable.ChartVersion, indexVersion, chartIndexUrl)
}
}
// check deployed chart version against available version
func checkLocalChartVersion(deployable config.Deployable) {
// get helm chart version to compare to version requested in '.devtool.config'
color.New(color.FgGreen).Printf("chart name: '%s'\n", deployable.Chart)
update, err := environment.RunAndGetOutput("helm", "repo", "update")
if err != nil {
color.New(color.FgRed).Printf("Error in RunAndGetOutput: %s\n", err)
}
color.New(color.FgCyan).Printf("RunAndGetOutput (helm, update, repo): %s\n", update)
chart, err := environment.RunAndGetOutput("helm", "show", "chart", deployable.Chart)
if err != nil {
color.New(color.FgRed).Printf("Error in RunAndGetOutput: %s\n", err)
}
versionLabel := "version:"
var foundVersion bool = false
for _, line := range chart {
if len(line) > 0 {
s := strings.SplitAfter(line, ":")
label := s[0]
value := strings.TrimSpace(s[1])
if label == versionLabel {
foundVersion = true
color.New(color.FgGreen).Printf("version...: '%s'\n", value)
if deployable.ChartVersion < value {
color.Red("\nA newer chart version is available: requested version: %s, available version: %s. Compared against local helm chart.\n\n", deployable.ChartVersion, value)
}
}
}
}
if !foundVersion {
color.Red("No '%s' was identified in '%s'. Could not compare version numbers\n", versionLabel, deployable.Chart)
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment