Harbor vulnerability scanning is not functioning after upgrading from 1.7.5 to 1.8.1
search cancel

Harbor vulnerability scanning is not functioning after upgrading from 1.7.5 to 1.8.1

book

Article ID: 345568

calendar_today

Updated On:

Products

VMware

Issue/Introduction

Symptoms:
  • Harbor vulnerability scanning is not functioning after upgrading from 1.7.5 to 1.8.1

  • In the Harbor Administration > Configuration > Vulnerability tab, you see the warning message similar to:
    Internal Server Error

  • In the harbor-app-logs/core.log file, you see the entries similar to:
    [ERROR] [/common/api/base.go:69]: GET /api/system/scanAll/schedule failed with error: {"code":500,"message":"Internal Server Error"}



Environment

VMware PKS 1.x

Cause

This issue occurs due to the API call “GET /api/system/scanAll/schedule” failed with error:
failed to convert admin job response: unsupported cron format, {"type":"none"}

This issue was due to a bug in the migration script and it is fixed in below PR:
https://github.com/goharbor/harbor/pull/8531 

Resolution

This is known issue in VMware Harbor 1.8.1 and will be fixed in future versions.


Workaround:

To work around this issue:

  1. Log in to Harbor vm from bosh by running the command:
    bosh ssh -d <harbor-deployment-name>

  2. Switch to root mode by running the command: sudo -i

  3. Set the Docker environment variable by running the command:
    alias docker='/var/vcap/packages/docker/bin/docker -H unix:///var/vcap/sys/run/docker/dockerd.sock'

  4. Login to harbor-db container by running the command:
    docker exec -it harbor-db bash

  5. Login to registry database by executing the below commands:
    psql postgres -d registry

  6. Run the below command and find the job which is failed to parse with cron_str as "type":"none"
    registry=#  select * from admin_job where deleted=false;

     id | job_name | job_kind | cron_str | status | job_uuid | creation_time | update_time | deleted
    ----+----------+----------+----------+--------+----------+---------------+-------------+---------
    59 | IMAGE_SCAN_ALL | Periodic | {"type":"none"} | pending | | 2019-07-20 04:58:24.064678 | 2019-07-20 04:58:24.064678 |

  7. Delete the problematic job by executing the below command:
    update admin_job set deleted = true where id = xx;