Task for the scan report xxx not found
search cancel

Task for the scan report xxx not found

book

Article ID: 297316

calendar_today

Updated On:

Products

VMware Tanzu Toolkit for Kubernetes

Issue/Introduction

After upgrade to Harbor v2.4.1, when pulling images from harbor, the error message received:
 
# docker pull image-name-sha 

Pulling from harbor/docker-hub/library/nginx unknown: current image with "Error" status of vulnerability scanning cannot be pulled due to configured policy in 'Prevent images with vulnerability severity of "Critical" or higher from running.' To continue with pull, please contact your project administrator for help.

in core.log the error shown
[WARNING] [/controller/scan/base_controller.go:966]: task for the scan report xxxx not found


Environment

Product Version: 1.0

Resolution

This is caused by the scan reports of old version which is not supported by the trivy in harbor 2.4.

As the workaround you can  connect to the harbor database and run the following sql.
alias docker='/var/vcap/packages/docker/bin/docker -H unix:///var/vcap/sys/run/docker/dockerd.sock' docker exec -it harbor-db bash 

psql -U postgres -d registry 

DELETE FROM scan_report WHERE mime_type='application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0' AND registration_uuid IN (SELECT uuid FROM scanner_registration WHERE name='Trivy' AND immutable='true')