Skip to content

Commit efdd97c

Browse files
committed
Add Helm repository update command in UpgradeCommand function
- Introduced a command to update Helm repositories before performing the upgrade, enhancing the upgrade process by ensuring the latest charts are available. - Added error handling to notify users of any issues during the repository update.
1 parent 463f37a commit efdd97c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

command_upgrade/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package commandupgrade
22

33
import (
44
"os"
5+
"os/exec"
56

67
"github.com/Netsocs-Team/netsocs-manager-cli/utils"
78
"github.com/pterm/pterm"
@@ -17,6 +18,14 @@ func UpgradeCommand(cmd *cobra.Command, args []string) {
1718
pterm.Info.Println("Upgrading to the latest version available")
1819
}
1920

21+
cmdResult := exec.Command("helm", "repo", "update")
22+
cmdResult.Stdout = os.Stdout
23+
cmdResult.Stderr = os.Stderr
24+
if err := cmdResult.Run(); err != nil {
25+
pterm.Error.Printfln("Error updating Helm repositories: %v", err)
26+
os.Exit(1)
27+
}
28+
2029
if err := utils.RunHelmUpgradeWithVersion(version); err != nil {
2130
pterm.Error.Printfln("Error upgrading application: %v", err)
2231
os.Exit(1)

0 commit comments

Comments
 (0)