Do not scan versions released more than 1 year ago (#1614)

Signed-off-by: Sergio Castaño Arteaga <tegioz@icloud.com>
This commit is contained in:
Sergio C. Arteaga 2021-10-14 10:34:41 +02:00 committed by GitHub
parent edbea62e6e
commit 008ebc8d50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View File

@ -24,6 +24,7 @@ returns setof json as $$
join repository r using (repository_id)
where containers_images is not null
and r.scanner_disabled = false
and s.ts > (current_timestamp - '1 year'::interval)
and (
security_report is null
or (security_report_created_at < (current_timestamp - '1 day'::interval) and s.version = p.latest_version)

View File

@ -12,6 +12,7 @@ select plan(2);
\set package2ID '00000000-0000-0000-0000-000000000002'
\set package3ID '00000000-0000-0000-0000-000000000003'
\set package4ID '00000000-0000-0000-0000-000000000004'
\set package5ID '00000000-0000-0000-0000-000000000005'
-- No snapshots at this point
select is(
@ -166,6 +167,30 @@ insert into snapshot (
'[{"image": "quay.io/org/pkg4:1.0.0"}]',
'2020-06-16 11:20:33+02'
);
insert into package (
package_id,
name,
latest_version,
repository_id
) values (
:'package5ID',
'package5',
'1.0.0',
:'repo1ID'
);
insert into snapshot (
package_id,
version,
containers_images,
ts,
created_at
) values (
:'package5ID',
'1.0.0',
'[{"image": "quay.io/org/pkg5:1.0.0"}]',
'2010-06-16 11:20:33+02',
'2010-06-16 11:20:33+02'
);
-- Run some tests
select is(