Repository: aquasecurity/starboard
Pull request #426 (2021-03-11 20:03:49)

refactor: Move aqua package under pkg/plugin
Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>

codecov[bot]: # [Codecov](https://codecov.io/gh/aquasecurity/starboard/pull/426?src=pr&el=h1) Report
> Merging [#426](https://codecov.io/gh/aquasecurity/starboard/pull/426?src=pr&el=desc) (485099d) into [main](https://codecov.io/gh/aquasecurity/starboard/commit/75502eda0eaaf131297e5b933e2ac688c4bdc2a1?el=desc) (75502ed) will **decrease** coverage by `37.64%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/aquasecurity/starboard/pull/426/graphs/tree.svg?width=650&height=150&src=pr&token=qqTGKAJ0Wb)](https://codecov.io/gh/aquasecurity/starboard/pull/426?src=pr&el=tree)

```diff
@@             Coverage Diff             @@
##             main     #426       +/-   ##
===========================================
- Coverage   67.17%   29.53%   -37.65%     
===========================================
  Files          59       58        -1     
  Lines        3406     3305      -101     
===========================================
- Hits         2288      976     -1312     
- Misses        843     2268     +1425     
+ Partials      275       61      -214     
```


| [Impacted Files](https://codecov.io/gh/aquasecurity/starboard/pull/426?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pkg/plugin/aqua/client/client.go](https://codecov.io/gh/aquasecurity/starboard/pull/426/diff?src=pr&el=tree#diff-cGtnL3BsdWdpbi9hcXVhL2NsaWVudC9jbGllbnQuZ28=) | `66.66% <ø> (ø)` | |
| [pkg/plugin/factory.go](https://codecov.io/gh/aquasecurity/starboard/pull/426/diff?src=pr&el=tree#diff-cGtnL3BsdWdpbi9mYWN0b3J5Lmdv) | `0.00% <ø> (ø)` | |
| [pkg/cmd/get.go](https://codecov.io/gh/aquasecurity/starboard/pull/426/diff?src=pr&el=tree#diff-cGtnL2NtZC9nZXQuZ28=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [pkg/cmd/find.go](https://codecov.io/gh/aquasecurity/starboard/pull/426/diff?src=pr&el=tree#diff-cGtnL2NtZC9maW5kLmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [pkg/cmd/root.go](https://codecov.io/gh/aquasecurity/starboard/pull/426/diff?src=pr&el=tree#diff-cGtnL2NtZC9yb290Lmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [pkg/cmd/scan.go](https://codecov.io/gh/aquasecurity/starboard/pull/426/diff?src=pr&el=tree#diff-cGtnL2NtZC9zY2FuLmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [pkg/cmd/polaris.go](https://codecov.io/gh/aquasecurity/starboard/pull/426/diff?src=pr&el=tree#diff-cGtnL2NtZC9wb2xhcmlzLmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [pkg/cmd/version.go](https://codecov.io/gh/aquasecurity/starboard/pull/426/diff?src=pr&el=tree#diff-cGtnL2NtZC92ZXJzaW9uLmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [pkg/cmd/kube\_bench.go](https://codecov.io/gh/aquasecurity/starboard/pull/426/diff?src=pr&el=tree#diff-cGtnL2NtZC9rdWJlX2JlbmNoLmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [pkg/cmd/kube\_hunter.go](https://codecov.io/gh/aquasecurity/starboard/pull/426/diff?src=pr&el=tree#diff-cGtnL2NtZC9rdWJlX2h1bnRlci5nbw==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| ... and [35 more](https://codecov.io/gh/aquasecurity/starboard/pull/426/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/aquasecurity/starboard/pull/426?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/aquasecurity/starboard/pull/426?src=pr&el=footer). Last update [75502ed...485099d](https://codecov.io/gh/aquasecurity/starboard/pull/426?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/Makefile b/Makefile
index 3835f2a..b3233f2 100644
--- a/Makefile
+++ b/Makefile
@@ -66,14 +66,14 @@ itests-starboard: check-env get-ginkgo
 	--v \
 	-coverprofile=coverage.txt \
 	-coverpkg=github.com/aquasecurity/starboard/pkg/cmd,\
-	github.com/aquasecurity/starboard/pkg/config,\
+	github.com/aquasecurity/starboard/pkg/plugin,\
 	github.com/aquasecurity/starboard/pkg/resources,\
 	github.com/aquasecurity/starboard/pkg/kube,\
 	github.com/aquasecurity/starboard/pkg/kube/pod,\
 	github.com/aquasecurity/starboard/pkg/kubebench,\
 	github.com/aquasecurity/starboard/pkg/kubehunter,\
 	github.com/aquasecurity/starboard/pkg/trivy,\
-	github.com/aquasecurity/starboard/pkg/polaris,\
+	github.com/aquasecurity/starboard/pkg/plugin/polaris,\
 	github.com/aquasecurity/starboard/pkg/configauditreport,\
 	github.com/aquasecurity/starboard/pkg/vulnerabilityreport \
 	./itest/starboard
@@ -88,10 +88,10 @@ itests-starboard-operator: check-env get-ginkgo
 	-coverpkg=github.com/aquasecurity/starboard/pkg/operator,\
 	github.com/aquasecurity/starboard/pkg/operator/predicate,\
 	github.com/aquasecurity/starboard/pkg/operator/controller,\
-	github.com/aquasecurity/starboard/pkg/config,\
+	github.com/aquasecurity/starboard/pkg/plugin,\
 	github.com/aquasecurity/starboard/pkg/resources,\
 	github.com/aquasecurity/starboard/pkg/trivy,\
-	github.com/aquasecurity/starboard/pkg/polaris,\
+	github.com/aquasecurity/starboard/pkg/plugin/polaris,\
 	github.com/aquasecurity/starboard/pkg/configauditreport,\
 	github.com/aquasecurity/starboard/pkg/vulnerabilityreport,\
 	github.com/aquasecurity/starboard/pkg/kubebench \
diff --git a/cmd/scanner-aqua/main.go b/cmd/scanner-aqua/main.go
index d3fabf3..8b3bb15 100644
--- a/cmd/scanner-aqua/main.go
+++ b/cmd/scanner-aqua/main.go
@@ -6,9 +6,9 @@ import (
 	"os"
 
 	"github.com/aquasecurity/starboard/pkg/apis/aquasecurity/v1alpha1"
-	"github.com/aquasecurity/starboard/pkg/aqua/client"
-	"github.com/aquasecurity/starboard/pkg/aqua/scanner/api"
-	"github.com/aquasecurity/starboard/pkg/aqua/scanner/cli"
+	"github.com/aquasecurity/starboard/pkg/plugin/aqua/client"
+	"github.com/aquasecurity/starboard/pkg/plugin/aqua/scanner/api"
+	"github.com/aquasecurity/starboard/pkg/plugin/aqua/scanner/cli"
 	"github.com/spf13/cobra"
 )
 
diff --git a/pkg/plugin/aqua/client/doc.go b/pkg/plugin/aqua/client/doc.go
new file mode 100644
index 0000000..fc1915b
--- /dev/null
+++ b/pkg/plugin/aqua/client/doc.go
@@ -0,0 +1,2 @@
+// The client package provides an HTTP client for selected Aqua Enterprise REST API endpoints.
+package client
diff --git a/pkg/aqua/client/types.go b/pkg/plugin/aqua/client/types.go
similarity index 100%
rename from pkg/aqua/client/types.go
rename to pkg/plugin/aqua/client/types.go
diff --git a/pkg/plugin/aqua/doc.go b/pkg/plugin/aqua/doc.go
new file mode 100644
index 0000000..5f8a676
--- /dev/null
+++ b/pkg/plugin/aqua/doc.go
@@ -0,0 +1,2 @@
+// The aqua package provides primitives for working with Aqua Enterprise scanner.
+package aqua
diff --git a/pkg/aqua/plugin.go b/pkg/plugin/aqua/plugin.go
similarity index 100%
rename from pkg/aqua/plugin.go
rename to pkg/plugin/aqua/plugin.go
diff --git a/pkg/aqua/scanner/api/scanner.go b/pkg/plugin/aqua/scanner/api/scanner.go
similarity index 98%
rename from pkg/aqua/scanner/api/scanner.go
rename to pkg/plugin/aqua/scanner/api/scanner.go
index c82ad5f..dfa6c60 100644
--- a/pkg/aqua/scanner/api/scanner.go
+++ b/pkg/plugin/aqua/scanner/api/scanner.go
@@ -5,7 +5,7 @@ import (
 	"time"
 
 	"github.com/aquasecurity/starboard/pkg/apis/aquasecurity/v1alpha1"
-	"github.com/aquasecurity/starboard/pkg/aqua/client"
+	"github.com/aquasecurity/starboard/pkg/plugin/aqua/client"
 	"github.com/google/go-containerregistry/pkg/name"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 )
diff --git a/pkg/aqua/scanner/cli/scanner.go b/pkg/plugin/aqua/scanner/cli/scanner.go
similarity index 98%
rename from pkg/aqua/scanner/cli/scanner.go
rename to pkg/plugin/aqua/scanner/cli/scanner.go
index dcc8b65..ec5cd7c 100644
--- a/pkg/aqua/scanner/cli/scanner.go
+++ b/pkg/plugin/aqua/scanner/cli/scanner.go
@@ -9,7 +9,7 @@ import (
 	"time"
 
 	"github.com/aquasecurity/starboard/pkg/apis/aquasecurity/v1alpha1"
-	"github.com/aquasecurity/starboard/pkg/aqua/client"
+	"github.com/aquasecurity/starboard/pkg/plugin/aqua/client"
 	"github.com/google/go-containerregistry/pkg/name"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 )
diff --git a/pkg/aqua/scanner/cli/types.go b/pkg/plugin/aqua/scanner/cli/types.go
similarity index 100%
rename from pkg/aqua/scanner/cli/types.go
rename to pkg/plugin/aqua/scanner/cli/types.go
diff --git a/pkg/aqua/scanner/testdata/aqua_csp_report/with_vulnerabilities.json b/pkg/plugin/aqua/scanner/testdata/aqua_csp_report/with_vulnerabilities.json
similarity index 100%
rename from pkg/aqua/scanner/testdata/aqua_csp_report/with_vulnerabilities.json
rename to pkg/plugin/aqua/scanner/testdata/aqua_csp_report/with_vulnerabilities.json
diff --git a/pkg/aqua/scanner/testdata/aqua_csp_report/without_vulnerabilities.json b/pkg/plugin/aqua/scanner/testdata/aqua_csp_report/without_vulnerabilities.json
similarity index 100%
rename from pkg/aqua/scanner/testdata/aqua_csp_report/without_vulnerabilities.json
rename to pkg/plugin/aqua/scanner/testdata/aqua_csp_report/without_vulnerabilities.json
diff --git a/pkg/plugin/factory.go b/pkg/plugin/factory.go
index a33bfd7..f7d4faa 100644
--- a/pkg/plugin/factory.go
+++ b/pkg/plugin/factory.go
@@ -3,9 +3,9 @@ package plugin
 import (
 	"fmt"
 
-	"github.com/aquasecurity/starboard/pkg/aqua"
 	"github.com/aquasecurity/starboard/pkg/configauditreport"
 	"github.com/aquasecurity/starboard/pkg/ext"
+	"github.com/aquasecurity/starboard/pkg/plugin/aqua"
 	"github.com/aquasecurity/starboard/pkg/plugin/polaris"
 	"github.com/aquasecurity/starboard/pkg/starboard"
 	"github.com/aquasecurity/starboard/pkg/trivy"


Test patch:
diff --git a/pkg/aqua/client/auth.go b/pkg/plugin/aqua/client/auth.go
similarity index 100%
rename from pkg/aqua/client/auth.go
rename to pkg/plugin/aqua/client/auth.go
diff --git a/pkg/aqua/client/client.go b/pkg/plugin/aqua/client/client.go
similarity index 100%
rename from pkg/aqua/client/client.go
rename to pkg/plugin/aqua/client/client.go
diff --git a/pkg/aqua/client/client_integration_test.go b/pkg/plugin/aqua/client/client_integration_test.go
similarity index 100%
rename from pkg/aqua/client/client_integration_test.go
rename to pkg/plugin/aqua/client/client_integration_test.go
diff --git a/pkg/aqua/client/client_suite_test.go b/pkg/plugin/aqua/client/client_suite_test.go
similarity index 100%
rename from pkg/aqua/client/client_suite_test.go
rename to pkg/plugin/aqua/client/client_suite_test.go
diff --git a/pkg/aqua/client/client_test.go b/pkg/plugin/aqua/client/client_test.go
similarity index 98%
rename from pkg/aqua/client/client_test.go
rename to pkg/plugin/aqua/client/client_test.go
index 9ce7a0b..b2537bd 100644
--- a/pkg/aqua/client/client_test.go
+++ b/pkg/plugin/aqua/client/client_test.go
@@ -3,7 +3,7 @@ package client_test
 import (
 	"net/http"
 
-	"github.com/aquasecurity/starboard/pkg/aqua/client"
+	"github.com/aquasecurity/starboard/pkg/plugin/aqua/client"
 	. "github.com/onsi/ginkgo"
 	. "github.com/onsi/gomega"
 	. "github.com/onsi/gomega/ghttp"