From 6d47f0cd92f25719fd87a91923138e9287235625 Mon Sep 17 00:00:00 2001 From: Parth Patel <88045217+pxp928@users.noreply.github.com> Date: Fri, 4 Oct 2024 13:58:01 -0400 Subject: [PATCH] add comment on certifier when last-scan is set or not set (#2167) Signed-off-by: pxp928 --- pkg/certifier/components/root_package/root_package.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/certifier/components/root_package/root_package.go b/pkg/certifier/components/root_package/root_package.go index e1e4d2f163..1455b28617 100644 --- a/pkg/certifier/components/root_package/root_package.go +++ b/pkg/certifier/components/root_package/root_package.go @@ -23,6 +23,7 @@ import ( "github.com/Khan/genqlient/graphql" "github.com/guacsec/guac/pkg/assembler/clients/generated" "github.com/guacsec/guac/pkg/certifier" + "github.com/guacsec/guac/pkg/logging" ) const guacType string = "guac" @@ -66,6 +67,15 @@ func (p *packageQuery) GetComponents(ctx context.Context, compChan chan<- interf return fmt.Errorf("compChan cannot be nil") } + // logger + logger := logging.FromContext(ctx) + if p.lastScan != nil { + lastScanTime := time.Now().Add(time.Duration(-*p.lastScan) * time.Hour).UTC() + logger.Infof("last-scan set to: %d hours, last scan time set to: %v", *p.lastScan, lastScanTime) + } else { + logger.Infof("last-scan not set, running on full package list") + } + tickInterval := 5 * time.Second // nodeChan to receive components