diff --git a/README.md b/README.md
index 0eec5568..895c9c48 100644
--- a/README.md
+++ b/README.md
@@ -12,10 +12,10 @@ Kubescape integrates natively with other DevOps tools, including Jenkins, Circle
-# Kubescape Covarage
+
# Kubescape CLI:
@@ -23,8 +23,8 @@ Kubescape integrates natively with other DevOps tools, including Jenkins, Circle
-# Kubescape overview:
-
+
# TL;DR
## Install:
@@ -267,6 +267,16 @@ Now you can submit the results to the Kubescape SaaS version -
kubescape submit results path/to/results.json
```
+
+# Integrations
+
+## VS Code Extension
+
+ 
+
+Scan the YAML files while writing them using the [vs code extension](https://github.com/armosec/vscode-kubescape/blob/master/README.md)
+
+
# Under the hood
## Technology
diff --git a/core/pkg/resultshandling/reporter/interface.go b/core/pkg/resultshandling/reporter/interface.go
index 964cc2b8..da36c853 100644
--- a/core/pkg/resultshandling/reporter/interface.go
+++ b/core/pkg/resultshandling/reporter/interface.go
@@ -7,4 +7,5 @@ type IReport interface {
SetCustomerGUID(customerGUID string)
SetClusterName(clusterName string)
DisplayReportURL()
+ GetURL() string
}
diff --git a/core/pkg/resultshandling/reporter/v1/reporteventreceiver.go b/core/pkg/resultshandling/reporter/v1/reporteventreceiver.go
index e4e5da44..a2884827 100644
--- a/core/pkg/resultshandling/reporter/v1/reporteventreceiver.go
+++ b/core/pkg/resultshandling/reporter/v1/reporteventreceiver.go
@@ -157,6 +157,9 @@ func (report *ReportEventReceiver) generateMessage() {
report.message = fmt.Sprintf("%s %s", message, u.String())
}
+func (report *ReportEventReceiver) GetURL() string {
+ return getter.GetArmoAPIConnector().GetFrontendURL()
+}
func (report *ReportEventReceiver) DisplayReportURL() {
cautils.InfoTextDisplay(os.Stderr, fmt.Sprintf("\n\n%s\n\n", report.message))
}
diff --git a/core/pkg/resultshandling/reporter/v2/mockreporter.go b/core/pkg/resultshandling/reporter/v2/mockreporter.go
index fdb0b40b..ede811e8 100644
--- a/core/pkg/resultshandling/reporter/v2/mockreporter.go
+++ b/core/pkg/resultshandling/reporter/v2/mockreporter.go
@@ -31,6 +31,10 @@ func (reportMock *ReportMock) SetCustomerGUID(customerGUID string) {
func (reportMock *ReportMock) SetClusterName(clusterName string) {
}
+func (reportMock *ReportMock) GetURL() string {
+ return getter.GetArmoAPIConnector().GetFrontendURL()
+}
+
func (reportMock *ReportMock) DisplayReportURL() {
u := fmt.Sprintf("https://%s/account/login", getter.GetArmoAPIConnector().GetFrontendURL())
if reportMock.query != "" {
diff --git a/core/pkg/resultshandling/reporter/v2/reporteventreceiver.go b/core/pkg/resultshandling/reporter/v2/reporteventreceiver.go
index fb15248a..4ee27d96 100644
--- a/core/pkg/resultshandling/reporter/v2/reporteventreceiver.go
+++ b/core/pkg/resultshandling/reporter/v2/reporteventreceiver.go
@@ -47,7 +47,6 @@ func (report *ReportEventReceiver) ActionSendReport(opaSessionObj *cautils.OPASe
if report.customerGUID == "" {
logger.L().Warning("failed to publish results. Reason: Unknown accout ID. Run kubescape with the '--account ' flag. Contact ARMO team for more details")
-
return nil
}
if report.clusterName == "" {
@@ -62,14 +61,17 @@ func (report *ReportEventReceiver) ActionSendReport(opaSessionObj *cautils.OPASe
opaSessionObj.Report.ClusterName = report.clusterName
opaSessionObj.Report.Metadata = *opaSessionObj.Metadata
- if err := report.prepareReport(opaSessionObj.Report); err != nil {
- logger.L().Error("failed to publish results", helpers.Error(err))
- } else {
+ err := report.prepareReport(opaSessionObj.Report)
+ if err == nil {
report.generateMessage()
+ } else {
+ logger.L().Debug(err.Error()) // print original error only in debug mode
+ err = fmt.Errorf("failed to submit scan results. url: '%s'", report.GetURL())
}
+
logger.L().Debug("", helpers.String("account ID", report.customerGUID))
- return nil
+ return err
}
func (report *ReportEventReceiver) SetCustomerGUID(customerGUID string) {
@@ -95,6 +97,24 @@ func (report *ReportEventReceiver) prepareReport(postureReport *reporthandlingv2
return err
}
+func (report *ReportEventReceiver) GetURL() string {
+ u := url.URL{}
+ u.Scheme = "https"
+ u.Host = getter.GetArmoAPIConnector().GetFrontendURL()
+
+ if report.customerAdminEMail != "" || report.token == "" { // data has been submitted
+ u.Path = fmt.Sprintf("configuration-scanning/%s", report.clusterName)
+ } else {
+ u.Path = "account/sign-up"
+ q := u.Query()
+ q.Add("invitationToken", report.token)
+ q.Add("customerGUID", report.customerGUID)
+
+ u.RawQuery = q.Encode()
+ }
+ return u.String()
+
+}
func (report *ReportEventReceiver) sendResources(host string, postureReport *reporthandlingv2.PostureReport, reportCounter *int, isLastReport bool) error {
splittedPostureReport := setSubReport(postureReport)
counter := 0
@@ -171,26 +191,12 @@ func (report *ReportEventReceiver) sendReport(host string, postureReport *report
}
func (report *ReportEventReceiver) generateMessage() {
-
- u := url.URL{}
- u.Scheme = "https"
- u.Host = getter.GetArmoAPIConnector().GetFrontendURL()
-
- if report.customerAdminEMail != "" || report.token == "" { // data has been submitted
- u.Path = fmt.Sprintf("configuration-scanning/%s", report.clusterName)
- } else {
- u.Path = "account/sign-up"
- q := u.Query()
- q.Add("invitationToken", report.token)
- q.Add("customerGUID", report.customerGUID)
-
- u.RawQuery = q.Encode()
- }
+ report.message = ""
sep := "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
report.message = sep
report.message += " << WOW! Now you can see the scan results on the web >>\n\n"
- report.message += fmt.Sprintf(" %s\n", u.String())
+ report.message += fmt.Sprintf(" %s\n", report.GetURL())
report.message += sep
}
diff --git a/core/pkg/resultshandling/reporter/v2/utils.go b/core/pkg/resultshandling/reporter/v2/utils.go
index 70547a85..b7af9020 100644
--- a/core/pkg/resultshandling/reporter/v2/utils.go
+++ b/core/pkg/resultshandling/reporter/v2/utils.go
@@ -15,12 +15,10 @@ func finalizeReport(opaSessionObj *cautils.OPASessionObj) {
if len(opaSessionObj.Report.Results) == 0 {
opaSessionObj.Report.Results = make([]resourcesresults.Result, len(opaSessionObj.ResourcesResult))
finalizeResults(opaSessionObj.Report.Results, opaSessionObj.ResourcesResult)
- opaSessionObj.ResourcesResult = nil
}
if len(opaSessionObj.Report.Resources) == 0 {
opaSessionObj.Report.Resources = finalizeResources(opaSessionObj.AllResources)
- opaSessionObj.AllResources = nil
}
}