Skip to content

Commit

Permalink
Update the replication rule related to the Chartmuseum
Browse files Browse the repository at this point in the history
Update replication_policy as Harbor v2.8.0 deprecates chartmuseum.
Harbor deprecates chartmuseum as of v2.8.0
Epic: goharbor#17958
Discussion: goharbor#15057

Signed-off-by: Yang Jiao <jiaoya@vmware.com>
  • Loading branch information
Yang Jiao committed Feb 24, 2023
1 parent 9973d99 commit 12fa40f
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion make/migrations/postgresql/0110_2.8.0_schema.up.sql
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
/* remove the redundant data from table artifact_blob */
delete from artifact_blob afb where not exists (select digest from blob b where b.digest = afb.digest_af);
delete from artifact_blob afb where not exists (select digest from blob b where b.digest = afb.digest_af);
/* Update the replication_policy whose source resource filter is chart(chartmuseum) to Deactivated */
WITH filter_objects AS (
SELECT id, jsonb_array_elements(filters::jsonb) AS filter
FROM replication_policy
)
UPDATE replication_policy AS rp
SET enabled = false,
filters = (
SELECT jsonb_agg(fo.filter)
FROM filter_objects AS fo
WHERE fo.id = rp.id AND NOT(filter ->> 'type' = 'resource' AND filter ->> 'value' = 'chart')
),
description = 'Chartmuseum is deprecated in Harbor v2.8.0, because the Source resource filter of this rule is chart(chartmuseum), so please update this rule.'
WHERE id IN (
SELECT id
FROM filter_objects
WHERE (filter ->> 'type' = 'resource' AND filter ->> 'value' = 'chart')
);

0 comments on commit 12fa40f

Please sign in to comment.