Skip to content

Commit

Permalink
feat: add arch flag to prometheus install
Browse files Browse the repository at this point in the history
Signed-off-by: Engin Diri <[email protected]>
  • Loading branch information
Engin Diri authored and alexellis committed Apr 10, 2022
1 parent 800bf5a commit 627b9f6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/system/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const (
pathFlag = "path"
versionFlag = "version"
progressFlag = "progress"
archFlag = "arch"
prometheusArchive = "prometheus-%s.linux-%s.tar.gz"
githubDownloadBaseURL = "https://github.com/%s/%s/releases/download/%s/%s"
)
Expand All @@ -33,6 +34,7 @@ func MakeInstallPrometheus() *cobra.Command {
command.Flags().StringP(versionFlag, "v", "latest", "The version for Prometheus to install")
command.Flags().StringP(pathFlag, "p", "/usr/local/bin", "Installation path, where a go subfolder will be created")
command.Flags().Bool(progressFlag, true, "Show download progress")
command.Flags().String(archFlag, "", "CPU architecture for Prometheus, eg: amd64")

command.RunE = func(cmd *cobra.Command, args []string) error {
installPath, _ := cmd.Flags().GetString(pathFlag)
Expand All @@ -50,6 +52,9 @@ func MakeInstallPrometheus() *cobra.Command {
if strings.ToLower(osVer) != "linux" {
return fmt.Errorf("this app only supports Linux")
}
if cmd.Flags().Changed(archFlag) {
arch, _ = cmd.Flags().GetString(archFlag)
}

dlArch := arch
if arch == "x86_64" {
Expand Down

0 comments on commit 627b9f6

Please sign in to comment.