-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add experimental support for containers images (#1777)
Closes #1685 Signed-off-by: Sergio Castaño Arteaga <tegioz@icloud.com> Signed-off-by: Cintia Sanchez Garcia <cynthiasg@icloud.com> Co-authored-by: Sergio Castaño Arteaga <tegioz@icloud.com> Co-authored-by: Cintia Sanchez Garcia <cynthiasg@icloud.com>
- Loading branch information
1 parent
b21846c
commit 14b5d2b
Showing
126 changed files
with
2,934 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- is_latest checks if the package version we are trying to register is the | ||
-- latest or not. For repositories of container image kind, we check the latest | ||
-- version timestamp. For the other kinds, we check the latest version, which | ||
-- must be a valid semver. | ||
create or replace function is_latest( | ||
p_kind integer, | ||
p_version text, | ||
p_previous_latest_version text, | ||
p_ts timestamptz, | ||
p_previous_latest_version_ts timestamptz | ||
) | ||
returns boolean as $$ | ||
begin | ||
case p_kind | ||
when 12 then -- Container image | ||
return p_ts >= p_previous_latest_version_ts; | ||
else -- Any other kind | ||
return semver_gte(p_version, p_previous_latest_version); | ||
end case; | ||
end | ||
$$ language plpgsql; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
insert into repository_kind values (12, 'Containers images'); | ||
alter table snapshot drop constraint snapshot_package_id_digest_key; | ||
alter table repository add column data jsonb; | ||
|
||
---- create above / drop below ---- | ||
|
||
delete from repository_kind where repository_kind_id = 12; | ||
alter table snapshot add constraint snapshot_package_id_digest_key unique (package_id, digest); | ||
alter table repository drop column data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
-- Start transaction and plan tests | ||
begin; | ||
select plan(2); | ||
|
||
-- Test function | ||
select is( | ||
is_latest( | ||
0, | ||
'1.0.1', | ||
'1.0.0', | ||
current_timestamp - '2 days'::interval, | ||
current_timestamp - '1 day'::interval | ||
), | ||
true | ||
); | ||
select is( | ||
is_latest( | ||
12, | ||
'1.0.1', | ||
'1.0.0', | ||
current_timestamp - '2 days'::interval, | ||
current_timestamp - '1 day'::interval | ||
), | ||
false | ||
); | ||
|
||
-- Finish tests and rollback transaction | ||
select * from finish(); | ||
rollback; |
Oops, something went wrong.