Skip to content

Commit 6c1b62b

Browse files
committed
chore: release v0.9.1 with FeatBit 5.2.1 support
- Upgrade FeatBit application version from 5.2.0 to 5.2.1 - Update all service image tags to 5.2.1 - Add v5.2.1 database migration scripts for PostgreSQL and MongoDB - Fix incorrect developer policy ID (939f -> 939d) - Add key field to policies and segments tables/collections - Update example configurations (AKS, standard deployments) - Add comprehensive upgrade documentation in RELEASE-v0.9.1.md
1 parent e602ed3 commit 6c1b62b

File tree

8 files changed

+398
-16
lines changed

8 files changed

+398
-16
lines changed

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ charts/featbit/
107107
image:
108108
registry: docker.io
109109
repository: featbit/<service>
110-
tag: "5.2.0"
110+
tag: "5.2.1"
111111

112112
service:
113113
type: ClusterIP
@@ -229,4 +229,4 @@ Create in `examples/standard/` or `examples/pro/`:
229229

230230
- Main repository: https://github.com/featbit/featbit
231231
- Chart repository: https://github.com/featbit/featbit-charts
232-
- Current version: 0.9.0 (App: 5.2.0)
232+
- Current version: 0.9.1 (App: 5.2.1)

charts/featbit/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.9.0
18+
version: 0.9.1
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to
2222
# follow Semantic Versioning. They should reflect the version the application is using.
2323
# It is recommended to use it with quotes.
24-
appVersion: "5.2.0"
24+
appVersion: "5.2.1"
2525

2626
kubeVersion: ">=1.23-0"
2727

charts/featbit/examples/aks/featbit-aks-values.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ui:
1616
image:
1717
registry: docker.io
1818
repository: featbit/featbit-ui
19-
tag: "5.2.0"
19+
tag: "5.2.1"
2020
pullPolicy: IfNotPresent
2121

2222
podSecurityContext:
@@ -65,7 +65,7 @@ api:
6565
image:
6666
registry: docker.io
6767
repository: featbit/featbit-api-server
68-
tag: "5.2.0"
68+
tag: "5.2.1"
6969
pullPolicy: IfNotPresent
7070

7171
podSecurityContext:
@@ -133,7 +133,7 @@ els:
133133
image:
134134
registry: docker.io
135135
repository: featbit/featbit-evaluation-server
136-
tag: "5.2.0"
136+
tag: "5.2.1"
137137
pullPolicy: IfNotPresent
138138

139139
podSecurityContext:
@@ -202,7 +202,7 @@ das:
202202
image:
203203
registry: docker.io
204204
repository: featbit/featbit-data-analytics-server
205-
tag: "5.2.0"
205+
tag: "5.2.1"
206206
pullPolicy: IfNotPresent
207207

208208
podSecurityContext:

charts/featbit/examples/standard/featbit-aks-via-ingress-frontdoor.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ui:
2424
image:
2525
registry: docker.io
2626
repository: featbit/featbit-ui
27-
tag: "5.2.0"
27+
tag: "5.2.1"
2828
pullPolicy: IfNotPresent
2929

3030
service:
@@ -59,7 +59,7 @@ api:
5959
image:
6060
registry: docker.io
6161
repository: featbit/featbit-api-server
62-
tag: "5.2.0"
62+
tag: "5.2.1"
6363
pullPolicy: IfNotPresent
6464

6565
service:
@@ -94,7 +94,7 @@ els:
9494
image:
9595
registry: docker.io
9696
repository: featbit/featbit-evaluation-server
97-
tag: "5.2.0"
97+
tag: "5.2.1"
9898
pullPolicy: IfNotPresent
9999

100100
service:
@@ -129,7 +129,7 @@ da-server:
129129
image:
130130
registry: docker.io
131131
repository: featbit/featbit-data-analytics-server
132-
tag: "5.2.0"
132+
tag: "5.2.1"
133133
pullPolicy: IfNotPresent
134134

135135
service:

charts/featbit/templates/mongodb-init-scripts-configmap.yaml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,4 +522,122 @@ data:
522522
}
523523
}
524524
);
525+
526+
06_v5.2.1.js: |-
527+
const dbName = "{{ $db }}";
528+
print('use', dbName, 'database')
529+
db = db.getSiblingDB(dbName)
530+
531+
const slugify = str => str
532+
.toLowerCase()
533+
.trim()
534+
.replace(/[^\w\s-]/g, '')
535+
.replace(/[\s_-]+/g, '-')
536+
.replace(/^-+|-+$/g, '');
537+
538+
// https://github.com/featbit/featbit/pull/841
539+
// added key to Policies collection
540+
541+
// fill keys if not exist
542+
db.Policies.find({
543+
$or: [
544+
{ key: { $exists: false } },
545+
{ key: null }
546+
]
547+
}).forEach(doc => {
548+
db.Policies.updateOne(
549+
{ _id: doc._id },
550+
{ $set: { key: slugify(doc.name) } }
551+
);
552+
});
553+
554+
// make sure keys are unique per organization
555+
db.Policies.aggregate([
556+
{
557+
$group: {
558+
_id: {
559+
organizationId: "$organizationId",
560+
key: "$key"
561+
},
562+
ids: { $push: "$_id" }
563+
}
564+
},
565+
{
566+
$match: {
567+
"_id.key": { $ne: null },
568+
"ids.1": { $exists: true }
569+
}
570+
}
571+
]).forEach(group => {
572+
group.ids.forEach((id, index) => {
573+
if (index === 0) return;
574+
575+
db.Policies.updateOne(
576+
{ _id: id },
577+
{
578+
$set: {
579+
key: `${group._id.key}-${index + 1}`
580+
}
581+
}
582+
);
583+
});
584+
});
585+
586+
// https://github.com/featbit/featbit/pull/844
587+
// added key to Segments collection
588+
db.Segments.find({
589+
$or: [
590+
{ key: { $exists: false } },
591+
{ key: null }
592+
]
593+
}).forEach(doc => {
594+
db.Segments.updateOne(
595+
{ _id: doc._id },
596+
{ $set: { key: slugify(doc.name) } }
597+
);
598+
});
599+
600+
// make sure keys are unique
601+
db.Segments.aggregate([
602+
{
603+
$match: {
604+
key: { $ne: null },
605+
type: { $in: ["shared", "environment-specific"] }
606+
}
607+
},
608+
{
609+
$group: {
610+
_id: {
611+
type: "$type",
612+
scopeId: {
613+
$cond: [
614+
{ $eq: ["$type", "shared"] },
615+
"$workspaceId",
616+
"$envId"
617+
]
618+
},
619+
key: "$key"
620+
},
621+
ids: { $push: "$_id" }
622+
}
623+
},
624+
{
625+
$match: {
626+
"ids.1": { $exists: true }
627+
}
628+
}
629+
]).forEach(group => {
630+
group.ids.forEach((id, index) => {
631+
if (index === 0) return;
632+
633+
db.Segments.updateOne(
634+
{ _id: id },
635+
{
636+
$set: {
637+
key: `${group._id.key}-${index + 1}`
638+
}
639+
}
640+
);
641+
});
642+
});
525643
{{- end -}}

charts/featbit/templates/postgresql-init-scripts-configmap.yaml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,4 +871,142 @@ data:
871871
FROM jsonb_array_elements(COALESCE(policy.statements,
872872
'[]'::jsonb)) s
873873
WHERE s ->> 'resourceType' = 'flag');
874+
875+
07_v5.2.1.sql: |-
876+
\connect {{ $db }}
877+
878+
-- https://github.com/featbit/featbit/pull/836
879+
-- fix incorrect developer_policy_id
880+
881+
DO
882+
$$
883+
DECLARE
884+
old_developer_policy_id UUID := '66f3687f-939f-4257-bd3f-c3553d39e1b6';
885+
new_developer_policy_id UUID := '66f3687f-939d-4257-bd3f-c3553d39e1b6';
886+
BEGIN
887+
-- 1. Update the id of the built-in developer policy
888+
UPDATE policies
889+
SET id = new_developer_policy_id
890+
WHERE id = old_developer_policy_id
891+
AND type = 'SysManaged'
892+
AND name = 'Developer';
893+
894+
-- 2. Update organizations table - fix default_permissions jsonb
895+
UPDATE organizations
896+
SET default_permissions = jsonb_set(
897+
default_permissions,
898+
'{policyIds}',
899+
(
900+
SELECT jsonb_agg(
901+
CASE
902+
WHEN elem::text = concat('"', old_developer_policy_id::text, '"')
903+
THEN to_jsonb(new_developer_policy_id::text)
904+
ELSE elem
905+
END
906+
)
907+
FROM jsonb_array_elements(default_permissions -> 'policyIds') AS elem
908+
)
909+
)
910+
WHERE default_permissions -> 'policyIds' @> to_jsonb(old_developer_policy_id::text);
911+
912+
-- 3. Update member_policies table
913+
UPDATE member_policies
914+
SET policy_id = new_developer_policy_id
915+
WHERE policy_id = old_developer_policy_id;
916+
917+
-- 4. Update group_policies table
918+
UPDATE group_policies
919+
SET policy_id = new_developer_policy_id
920+
WHERE policy_id = old_developer_policy_id;
921+
922+
END
923+
$$;
924+
925+
-- https://github.com/featbit/featbit/pull/841
926+
-- added key to policies table
927+
ALTER TABLE policies
928+
ADD COLUMN IF NOT EXISTS key varchar(128);
929+
930+
-- fill keys if null
931+
UPDATE policies
932+
SET key =
933+
regexp_replace(
934+
regexp_replace(
935+
regexp_replace(
936+
lower(trim(name)),
937+
'[^\\w\\s-]', '', 'g'
938+
),
939+
'[\\s_-]+', '-', 'g'
940+
),
941+
'^-+|-+$', '', 'g'
942+
)
943+
WHERE key IS NULL;
944+
945+
-- make sure keys are unique per organization
946+
WITH ranked AS (
947+
SELECT
948+
id,
949+
organization_id,
950+
key,
951+
ROW_NUMBER() OVER (
952+
PARTITION BY organization_id, key
953+
ORDER BY created_at, id
954+
) AS rn
955+
FROM policies
956+
WHERE key IS NOT NULL
957+
)
958+
UPDATE policies p
959+
SET key = p.key || '-' || ranked.rn
960+
FROM ranked
961+
WHERE p.id = ranked.id
962+
AND ranked.rn > 1;
963+
964+
-- make key not nullable
965+
ALTER TABLE policies
966+
ALTER COLUMN key SET NOT NULL;
967+
968+
-- https://github.com/featbit/featbit/pull/844
969+
-- added key to segments table
970+
ALTER TABLE segments
971+
ADD COLUMN IF NOT EXISTS key varchar(128);
972+
973+
UPDATE segments
974+
SET key =
975+
regexp_replace(
976+
regexp_replace(
977+
regexp_replace(
978+
lower(trim(name)),
979+
'[^\\w\\s-]', '', 'g'
980+
),
981+
'[\\s_-]+', '-', 'g'
982+
),
983+
'^-+|-+$', '', 'g'
984+
)
985+
WHERE key IS NULL;
986+
987+
WITH ranked AS (
988+
SELECT
989+
id,
990+
key,
991+
ROW_NUMBER() OVER (
992+
PARTITION BY
993+
CASE
994+
WHEN type = 'shared' THEN workspace_id
995+
WHEN type = 'environment-specific' THEN env_id
996+
END,
997+
key
998+
ORDER BY created_at, id
999+
) AS rn
1000+
FROM segments
1001+
WHERE key IS NOT NULL
1002+
AND type IN ('shared', 'environment-specific')
1003+
)
1004+
UPDATE segments s
1005+
SET key = s.key || '-' || ranked.rn
1006+
FROM ranked
1007+
WHERE s.id = ranked.id
1008+
AND ranked.rn > 1;
1009+
1010+
ALTER TABLE segments
1011+
ALTER COLUMN key SET NOT NULL;
8741012
{{- end -}}

0 commit comments

Comments
 (0)