-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(metadata): add vulnerability-database-updated-at in metadata #12
feat(metadata): add vulnerability-database-updated-at in metadata #12
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12 +/- ##
=========================================
Coverage ? 51.75%
=========================================
Files ? 13
Lines ? 541
Branches ? 0
=========================================
Hits ? 280
Misses ? 244
Partials ? 17
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do changes
@@ -33,6 +33,7 @@ Configuration of the adapter is done via environment variables at startup. | |||
| `SCANNER_API_SERVER_WRITE_TIMEOUT` | `15s` | The maximum duration before timing out writes of the response. | | |||
| `SCANNER_API_SERVER_IDLE_TIMEOUT` | `60s` | The maximum amount of time to wait for the next request when keep-alives are enabled. | | |||
| `SCANNER_CLAIR_URL` | `http://harbor-harbor-clair:6060` | Clair URL | | |||
| `SCANNER_CLAIR_DATABASE_URL` | | The Clair database URL, it is used to fetch vulnerability database updated time of the Clair. Its format is `postgresql://user:password@host/db?sslmode=disable` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| |
two columns?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are three columns in the table, the middle one is the default value of the config, for SCANNER_CLAIR_DATABASE_URL
is empty string which means not return the vulnerability database updated time in the metadata of the scanner.
endpointURL string | ||
// need to customize the logger to write output to job log. | ||
client *http.Client | ||
} | ||
|
||
// NewClient constructs a new client for Clair REST API pointing to the specified endpoint URL. | ||
func NewClient(tlsConfig etc.TLSConfig, cfg etc.ClairConfig) Client { | ||
var db *sql.DB | ||
if cfg.DatabaseURL != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should return an error here as CVE timestamp is an optional feature. Logging it is ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this feature enabled only clair database url configed, return error is ok when users enable this feature but adapter can not connect the db
pkg/http/api/v1/handler_test.go
Outdated
"net/http" | ||
"net/http/httptest" | ||
"strings" | ||
"testing" | ||
"time" | ||
|
||
"github.com/goharbor/harbor-scanner-clair/pkg/harbor" | ||
"github.com/goharbor/harbor-scanner-clair/pkg/job" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
03cdeab
to
e12025a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Signed-off-by: He Weiwei <hweiwei@vmware.com>
e12025a
to
85ce953
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
as we both approved this PR, let's merge it. |
returns
harbor.scanner-adapter/vulnerability-database-updated-at
in metadata when config clair database url for the scannerSigned-off-by: He Weiwei hweiwei@vmware.com