Skip to content

Commit

Permalink
Add insights prompt (#968)
Browse files Browse the repository at this point in the history
* add insights prompt

* switch to stderr

* adjust message

* adjust message
  • Loading branch information
rbren committed Jun 29, 2023
1 parent 75997f0 commit d55cd4b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions cmd/polaris/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"net/http"
"os"
"os/exec"
"strings"

workloads "github.com/fairwindsops/insights-plugins/plugins/workloads"
workloadsPkg "github.com/fairwindsops/insights-plugins/plugins/workloads/pkg"
Expand Down Expand Up @@ -174,10 +175,12 @@ var auditCmd = &cobra.Command{
logrus.Errorf("reporting audit file to insights: %v", err)
os.Exit(1)
}
logrus.Println("Success! You can see your results at:")
logrus.Printf("%s/orgs/%s/clusters/%s/action-items\n", insightsHost, auth.Organization, clusterName)
os.Stderr.WriteString("\n\nSuccess! You can see your results at:")
os.Stderr.WriteString(fmt.Sprintf("\n\n%s/orgs/%s/clusters/%s/action-items\n\n", insightsHost, auth.Organization, clusterName))
} else {
outputAudit(auditData, auditOutputFile, auditOutputURL, auditOutputFormat, useColor, onlyShowFailedTests, severityLevel)
os.Stderr.WriteString("\n\n🚀 Upload your Polaris findings to Fairwinds Insights to see remediation advice, add teammates, integrate with Slack or Jira, and more:")
os.Stderr.WriteString("\n\n❯ polaris " + strings.Join(os.Args[1:], " ") + " --upload-insights --cluster-name=my-cluster\n\n")
}

summary := auditData.GetSummary()
Expand Down
5 changes: 4 additions & 1 deletion cmd/polaris/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package cmd

import (
"os"
"strings"

conf "github.com/fairwindsops/polaris/pkg/config"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -84,7 +85,9 @@ var rootCmd = &cobra.Command{
os.Exit(1)
},
PersistentPostRun: func(cmd *cobra.Command, args []string) {
os.Stderr.WriteString("\n\nWant more? Automate Polaris for free with Fairwinds Insights!\n🚀 https://fairwinds.com/insights-signup/polaris 🚀 \n")
if !strings.HasPrefix(cmd.Use, "audit") {
os.Stderr.WriteString("\n\nWant more? Automate Polaris for free with Fairwinds Insights!\n🚀 https://fairwinds.com/insights-signup/polaris 🚀 \n")
}
},
}

Expand Down

0 comments on commit d55cd4b

Please sign in to comment.