Skip to content

Commit 660c559

Browse files
authored
Merge pull request #9 from linuxfoundation/misc-fixes
Update to reflect requirement changes
2 parents f4cfa78 + afe22c7 commit 660c559

File tree

6 files changed

+95
-75
lines changed

6 files changed

+95
-75
lines changed

charts/lfx-v1-sync-helper/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ apiVersion: v2
55
name: lfx-v1-sync-helper
66
description: LFX Platform v1 Sync Helper chart
77
type: application
8-
version: 0.2.0
8+
version: 0.2.1

charts/lfx-v1-sync-helper/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ EOF
6262

6363
# Install from the OCI registry
6464
helm install -n lfx lfx-v1-sync-helper \
65-
oci://ghcr.io/linuxfoundation/lfx-v1-sync-helper/chart \
65+
oci://ghcr.io/linuxfoundation/lfx-v1-sync-helper/chart/lfx-v1-sync-helper \
6666
-f values.yaml
6767
```
6868

charts/lfx-v1-sync-helper/values.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ app:
1919
# NATS_URL is required
2020
NATS_URL:
2121
value: nats://lfx-platform-nats.lfx.svc.cluster.local:4222
22-
# LOG_LEVEL is optional
23-
LOG_LEVEL:
24-
value: info
2522
# DEBUG is optional
2623
DEBUG:
2724
value: "false"
@@ -155,6 +152,6 @@ auth0:
155152
# name of the secret containing Auth0 client ID and private key
156153
name: v1-sync-helper-auth0-credentials
157154
# key in the secret which contains the Auth0 client ID
158-
clientIdKey: client-id
155+
clientIdKey: client_id
159156
# key in the secret which contains the Auth0 private key
160-
privateKeyKey: private-key
157+
privateKeyKey: client_private_key

v1-sync-helper/config.go

Lines changed: 58 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -10,58 +10,65 @@ import (
1010
"os"
1111
)
1212

13-
// ProjectAllowlist contains the list of project slugs that are allowed to be synced.
14-
// All entries should be lowercase for case-insensitive matching.
15-
var ProjectAllowlist = []string{
13+
// projectAllowlist contains the list of project slugs that are allowed to be
14+
// synced, but whose child projects are NOT, unless explicitly listed. *All
15+
// entries must be lowercase* (lookups downcase for case-insensitive matching).
16+
var projectAllowlist = []string{
1617
"tlf",
17-
"lf-charities",
18-
"lfprojects",
19-
"jdf",
20-
"jdf-llc",
21-
"jdf-international",
22-
"lfenergy",
23-
"tazama",
24-
"chiplet",
25-
"cnab",
26-
"spif",
27-
"uptane",
28-
"isac-simo",
29-
"oeew",
30-
"mlf",
31-
"co-packaged-optics-collaboration",
32-
"clusterduck",
33-
"liquid-prep",
34-
"authentication",
35-
"quantum-ir",
36-
"claims-and-credentials",
37-
"secure-data-storage",
38-
"aomedia",
39-
"iovisor",
40-
"lfc",
41-
"spdx-working-group",
42-
"droneaid",
43-
"open-chain-working-group",
44-
"murmur-project",
45-
"rend-o-matic",
46-
"easycla",
47-
"identifiers-and-discovery",
48-
"korg",
49-
"lottie-animation-community",
50-
"cii",
51-
"did-communication",
52-
"3mf-working-group",
53-
"call-for-code",
54-
"pyrrha",
55-
"decentralized-identity-foundation-dif",
56-
"spif-working-group",
57-
"opentempus",
58-
"open-yvy",
59-
"openharvest",
60-
"jdf3mf",
61-
"racial-justice",
62-
"celf",
63-
"sdog",
64-
"project-origin",
18+
// "lfprojects",
19+
// "lf-charities",
20+
// "jdf",
21+
// "jdf-llc",
22+
// "jdf-international",
23+
// "lfenergy",
24+
}
25+
26+
// ProjectFamilyAllowlist contains the list of projects slugs that are allowed
27+
// to be synced along with their child projects. *All entries must be
28+
// lowercase* (lookups downcase for case-insensitive matching).
29+
var projectFamilyAllowlist = []string{
30+
// "tazama",
31+
// "chiplet",
32+
// "cnab",
33+
// "spif",
34+
// "uptane",
35+
// "isac-simo",
36+
// "oeew",
37+
// "mlf",
38+
// "co-packaged-optics-collaboration",
39+
// "clusterduck",
40+
// "liquid-prep",
41+
// "authentication",
42+
// "quantum-ir",
43+
// "claims-and-credentials",
44+
// "secure-data-storage",
45+
// "aomedia",
46+
// "iovisor",
47+
// "lfc",
48+
// "spdx-working-group",
49+
// "droneaid",
50+
// "open-chain-working-group",
51+
// "murmur-project",
52+
// "rend-o-matic",
53+
// "easycla",
54+
// "identifiers-and-discovery",
55+
// "korg",
56+
// "lottie-animation-community",
57+
// "cii",
58+
// "did-communication",
59+
// "3mf-working-group",
60+
// "call-for-code",
61+
// "pyrrha",
62+
// "decentralized-identity-foundation-dif",
63+
// "spif-working-group",
64+
// "opentempus",
65+
// "open-yvy",
66+
// "openharvest",
67+
// "jdf3mf",
68+
// "racial-justice",
69+
// "celf",
70+
// "sdog",
71+
// "project-origin",
6572
}
6673

6774
// Config holds all configuration values for the v1-sync-helper service

v1-sync-helper/handlers_committees.go

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package main
77
import (
88
"context"
99
"fmt"
10+
"strings"
1011

1112
committeeservice "github.com/linuxfoundation/lfx-v2-committee-service/gen/committee_service"
1213
"github.com/nats-io/nats.go/jetstream"
@@ -26,13 +27,14 @@ var allowedCommitteeCategories = map[string]bool{
2627
"Marketing Committee/Sub Committee": true,
2728
"Marketing Mailing List": true,
2829
"Marketing Oversight Committee/Marketing Advisory Committee": true,
29-
"Other": true,
30-
"Product Security": true,
31-
"Special Interest Group": true,
32-
"Technical Mailing List": true,
33-
"Technical Oversight Committee/Technical Advisory Committee": true,
34-
"Technical Steering Committee": true,
35-
"Working Group": true,
30+
"Other": true,
31+
"Product Security": true,
32+
"Special Interest Group": true,
33+
"Technical Advisory Committee": true,
34+
"Technical Mailing List": true,
35+
"Technical Oversight Committee": true,
36+
"Technical Steering Committee": true,
37+
"Working Group": true,
3638
}
3739

3840
// allowedAppointedByValues defines the valid values for appointed_by__c mapping to appointed_by.
@@ -101,11 +103,25 @@ func mapAppointedByToValidValue(ctx context.Context, appointedBy string) string
101103
}
102104

103105
// mapTypeToCategory filters and maps type__c to category.
104-
func mapTypeToCategory(ctx context.Context, typeVal string) *string {
106+
func mapTypeToCategory(ctx context.Context, typeVal, committeeName string) *string {
105107
if typeVal == "" {
106108
return nil
107109
}
108110

111+
if typeVal == "Technical Oversight Committee/Technical Advisory Committee" {
112+
// Special case mapping.
113+
if strings.Contains(strings.ToLower(committeeName), "advisory") {
114+
mapped := "Technical Advisory Committee"
115+
return &mapped
116+
}
117+
if strings.Contains(strings.ToLower(committeeName), "tac") {
118+
mapped := "Technical Advisory Committee"
119+
return &mapped
120+
}
121+
mapped := "Technical Oversight Committee"
122+
return &mapped
123+
}
124+
109125
if allowedCommitteeCategories[typeVal] {
110126
return &typeVal
111127
}
@@ -233,7 +249,7 @@ func mapV1DataToCommitteeCreatePayload(ctx context.Context, v1Data map[string]an
233249
}
234250

235251
if typeVal, ok := v1Data["type__c"].(string); ok && typeVal != "" {
236-
if category := mapTypeToCategory(ctx, typeVal); category != nil {
252+
if category := mapTypeToCategory(ctx, typeVal, name); category != nil {
237253
payload.Category = *category // Map Type to Category with validation.
238254
}
239255
}
@@ -308,7 +324,7 @@ func mapV1DataToCommitteeUpdateBasePayload(ctx context.Context, committeeUID str
308324
}
309325

310326
if typeVal, ok := v1Data["type__c"].(string); ok && typeVal != "" {
311-
if category := mapTypeToCategory(ctx, typeVal); category != nil {
327+
if category := mapTypeToCategory(ctx, typeVal, name); category != nil {
312328
payload.Category = *category // Map Type to Category with validation.
313329
}
314330
}

v1-sync-helper/handlers_projects.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ func isProjectAllowed(ctx context.Context, v1Data map[string]any, mappingsKV jet
6161
slug, _ := v1Data["slug__c"].(string)
6262
slug = strings.ToLower(slug)
6363

64-
// Check if the project's slug is in the allowlist.
65-
if slices.Contains(ProjectAllowlist, slug) {
64+
// Check if the project's slug is in either allowlist.
65+
if slices.Contains(projectAllowlist, slug) || slices.Contains(projectFamilyAllowlist, slug) {
6666
return true, "project slug is in allowlist"
6767
}
6868

@@ -97,15 +97,15 @@ func isProjectAllowed(ctx context.Context, v1Data map[string]any, mappingsKV jet
9797
}
9898
parentSlug = strings.ToLower(parentSlug)
9999

100-
// Check if parent is one of the "overarching" grouping projects.
101-
overarchingProjects := []string{"tlf", "lf-charities", "lfprojects", "jdf", "jdf-llc", "jdf-international", "lfenergy"}
102-
if slices.Contains(overarchingProjects, parentSlug) {
100+
// Check if parent is one of the "overarching" grouping projects which does
101+
// not allow all children.
102+
if slices.Contains(projectAllowlist, parentSlug) {
103103
// For children of overarching projects, only allow if child slug is in allowlist.
104104
return false, fmt.Sprintf("child of overarching project %s but child slug not in allowlist", parentSlug)
105105
}
106106

107-
// Parent is not an overarching project, so this is a child of an allowlisted project.
108-
// These are always allowed.
107+
// Parent is not an overarching project, so this is a "descendant" of an
108+
// allowlisted project "family".
109109
return true, fmt.Sprintf("child of allowlisted project %s", parentSlug)
110110
}
111111

0 commit comments

Comments
 (0)