Skip to content

Commit

Permalink
ci: fix TestContainerVulnerabilityCommandsEndToEnd (#1484)
Browse files Browse the repository at this point in the history
* ci: fix TestContainerVulnerabilityCommandsEndToEnd

Signed-off-by: Salim Afiune Maya <[email protected]>

* fix(cli): ctr show-assessment speed from 6m to 30s

Just by using the `Returns` field on the search. 🤦

```
➜  go-sdk git:(afiune/ci/fix) date;./bin/lacework-cli-darwin-amd64 vuln container show-assessment sha256:a65572164cb78c4d04f57bd66201c775e2dab08fce394806a03a933c5daf9e48 --image_id --nocache;date
Tue Dec 12 17:26:07 PST 2023
Flag --image_id has been deprecated, by default we now look up both, image_id and image_digest at once.
                                  CONTAINER IMAGE DETAILS                                          VULNERABILITIES
------------------------------------------------------------------------------------------+---------------------------------
    ID          sha256:a65572164cb78c4d04f57bd66201c775e2dab08fce394806a03a933c5daf9e48       SEVERITY   COUNT   FIXABLE
    Digest      sha256:77b2d2246518044ef95e3dbd029e51dd477788e5bf8e278e418685aabc3fe28a     -----------+-------+----------
    Registry    index.docker.io                                                               Critical      45        30
    Repository  techallylw/test-cli-dirty                                                     High         169        91
    Size        343.9 MB                                                                      Medium       143        85
    Created At  2020-11-12T00:29:45Z                                                          Low            0         0
    Tags        latest                                                                        Info         345         6

Try adding '--details' to increase details shown about the vulnerability assessment.
Tue Dec 12 17:26:36 PST 2023
➜  go-sdk git:(afiune/ci/fix) ✗ date;lacework vuln container show-assessment sha256:a65572164cb78c4d04f57bd66201c775e2dab08fce394806a03a933c5daf9e48 --image_id --nocache;date
Tue Dec 12 17:26:57 PST 2023
Flag --image_id has been deprecated, by default we now look up both, image_id and image_digest at once.
                                  CONTAINER IMAGE DETAILS                                          VULNERABILITIES
------------------------------------------------------------------------------------------+---------------------------------
    ID          sha256:a65572164cb78c4d04f57bd66201c775e2dab08fce394806a03a933c5daf9e48       SEVERITY   COUNT   FIXABLE
    Digest      sha256:77b2d2246518044ef95e3dbd029e51dd477788e5bf8e278e418685aabc3fe28a     -----------+-------+----------
    Registry    index.docker.io                                                               Critical      45        30
    Repository  techallylw/test-cli-dirty                                                     High         169        91
    Size        343.9 MB                                                                      Medium       143        85
    Created At  2020-11-12T00:29:45Z                                                          Low            0         0
    Tags        latest                                                                        Info         345         6

Try adding '--details' to increase details shown about the vulnerability assessment.
Tue Dec 12 17:31:08 PST 2023
➜  go-sdk git:(afiune/ci/fix) ✗
```

Signed-off-by: Salim Afiune Maya <[email protected]>

---------

Signed-off-by: Salim Afiune Maya <[email protected]>
  • Loading branch information
afiune authored Dec 13, 2023
1 parent b754b4e commit 0f1e35d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 2 additions & 4 deletions cli/cmd/vuln_container_show_assessments.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,8 @@ func searchLastestEvaluationGuid(sha string) (string, error) {
// provided sha was not an image digest, try using it as an image id instead
cli.Log.Infow("retrieve image assessment", "image_id", sha)
assessment, err = cli.LwApi.V2.Vulnerabilities.Containers.SearchAllPages(api.SearchFilter{
TimeFilter: &api.TimeFilter{
StartTime: &before,
EndTime: &now,
},
Returns: filter.Returns,
TimeFilter: filter.TimeFilter,
Filters: []api.Filter{{
Expression: "eq",
Field: "evalCtx.image_info.id",
Expand Down
2 changes: 0 additions & 2 deletions integration/container_vulnerability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,7 @@ type containerVulnerabilityScan struct {
Status string `json:"status"`
}

// Unstable test disabled as part of GROW-1396
func TestContainerVulnerabilityCommandsEndToEnd(t *testing.T) {
t.Parallel()
var (
out bytes.Buffer
err bytes.Buffer
Expand Down

0 comments on commit 0f1e35d

Please sign in to comment.