Skip to content

Commit 5f12b87

Browse files
authored
Merge pull request #4 from linuxfoundation/andrest50/v1-meetings-mock
Andres: Add v1 meeting mock data
2 parents 8c1ef94 + 54aa0f2 commit 5f12b87

File tree

11 files changed

+1096
-73
lines changed

11 files changed

+1096
-73
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,15 @@ export OPENFGA_STORE_ID="your-store-id-here"
3939

4040
#### Authentication Tokens
4141

42-
Generate impersonated Heimdall JWTs for service calls using the provided helper script:
42+
A Heimdall JWT secret is needed to use the `!jwt` macro in playbooks. If you
43+
export it as an environmental variable, you can pass it to the mock data tool
44+
as a command line argument. No `export` step is needed as this is used only
45+
to populate arguments to the mock data tool shell invocation.
4346

4447
```bash
45-
PROJECTS_TOKEN="$(./scripts/mock-heimdall-jwt.sh lfx-v2-project-service "clients@m2m_helper")"
46-
COMMITTEES_TOKEN="$(./scripts/mock-heimdall-jwt.sh lfx-v2-committee-service "clients@m2m_helper")"
47-
export PROJECTS_TOKEN COMMITTEES_TOKEN
48+
JWT_RSA_SECRET="$(kubectl get secret/heimdall-signer-cert -n lfx -o json | jq -r '.data["signer.pem"]' | base64 --decode)"
4849
```
4950

50-
*Note: in the future we may replace this with a YAML `!jwt` macro, and pass in the just the signing key as an environment variable.*
51-
5251
## Usage
5352

5453
### Running Mock Data Generation
@@ -58,14 +57,16 @@ Use uv to run the mock data tool (uv will automatically manage Python versions a
5857
```bash
5958
# Test the script (uv will create the virtual environment automatically).
6059
uv run lfx-v2-mockdata --help
60+
6161
# Load some data!
62-
uv run lfx-v2-mockdata -t playbooks/projects/{root_project_access,base_projects,extra_projects} playbooks/committees/base_committees
62+
uv run lfx-v2-mockdata --jwt-rsa-secret "$JWT_RSA_SECRET" -t playbooks/projects/{root_project_access,base_projects,extra_projects} playbooks/committees/base_committees
6363
```
6464

6565
**Important Notes:**
6666
- **Order matters!** Playbook directories run in the order specified on the command line.
6767
- Within each directory, playbooks execute in alphabetical order.
6868
- Dependencies between playbooks should be considered when organizing execution order. Multiple passes are made to allow `!ref` calls to be resolved, but the right order will improve performance and help avoid max-retry errors.
69+
- The `!jwt` macro will attempt to detect the JWKS key ID from the endpoint at `http://lfx-platform-heimdall.lfx.svc.cluster.local:4457/.well-known/jwks`. If this URL is not accessible from the execution environment, you must pass an explicit JWT key ID using the `--jwt-key-id` argument.
6970

7071
### Wiping Existing Data
7172

playbooks/committees/base_committees/buf_committees.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ buf_committees:
1414
url: {{ environ.COMMITTEES_URL | default("http://lfx-v2-committee-service.lfx.svc.cluster.local:8080/committees") }}
1515
method: POST
1616
headers:
17-
Authorization: Bearer {{ environ.COMMITTEES_TOKEN | default("-") }}
17+
Authorization: !jwt bearer=true,aud=lfx-v2-committee-service,principal=clients@m2m_helper
1818
steps:
1919
- json:
2020
name: Governing Board
@@ -60,9 +60,9 @@ buf_board_members:
6060
url: !sub "{{ environ.COMMITTEES_URL | default('http://lfx-v2-committee-service.lfx.svc.cluster.local:8080/committees') }}/${ buf_committees.steps[?json.name == 'Governing Board']._response.uid | [0] }/members?v=1"
6161
method: POST
6262
headers:
63-
Authorization: Bearer {{ environ.COMMITTEES_TOKEN | default("-") }}
63+
Authorization: !jwt bearer=true,aud=lfx-v2-committee-service,principal=clients@m2m_helper
6464
steps:
65-
{% for i in range(1) %}
65+
{% for i in range(8) %}
6666
- json:
6767
appointed_by: Membership Entitlement
6868
email: {{ fake.ascii_company_email() }}
@@ -71,17 +71,19 @@ buf_board_members:
7171
organization:
7272
name: {{ fake.company() }}
7373
website: {{ fake.url() }}
74-
{% if i == 0 %}
7574
role:
75+
{% if i == 0 %}
7676
name: Chair
77-
{% endif %}
77+
{% else %}
78+
name: None
79+
{% endif %}
7880
status: Active
7981
voting:
8082
{% set start_date = fake.date_this_year() %}
8183
# 365 days later
8284
{% set end_date = start_date + timedelta(days=365) %}
83-
start_date: "{{ start_date.isoformat().replace('+00:00', 'Z') }}"
84-
end_date: "{{ end_date.isoformat().replace('+00:00', 'Z') }}"
85+
start_date: "{{ start_date.isoformat() }}"
86+
end_date: "{{ end_date.isoformat() }}"
8587
status: {{ [
8688
"Alternate Voting Rep",
8789
"Voting Rep",

playbooks/projects/base_projects/1_tlf.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ base_projects:
77
url: {{ environ.PROJECTS_URL | default("http://lfx-v2-project-service.lfx.svc.cluster.local:8080/projects") }}
88
method: POST
99
headers:
10-
Authorization: Bearer {{ environ.PROJECTS_TOKEN | default("-") }}
10+
Authorization: !jwt bearer=true,aud=lfx-v2-project-service,principal=clients@m2m_helper
1111
steps:
1212
- json:
1313
slug: tlf

playbooks/projects/base_projects/2_incorporated.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ extra_incorporated:
1010
url: {{ environ.PROJECTS_URL | default("http://lfx-v2-project-service.lfx.svc.cluster.local:8080/projects") }}
1111
method: POST
1212
headers:
13-
Authorization: Bearer {{ environ.PROJECTS_TOKEN | default("-") }}
13+
Authorization: !jwt bearer=true,aud=lfx-v2-project-service,principal=clients@m2m_helper
1414
steps:
1515
{% for outer in range(12) %}
16-
{% set project_name = generate_name(style='capital') %}
16+
{% set project_name = fake.catch_phrase().title() %}
1717
{% set outer_stage = ["Active", "Formation - Engaged"] | random %}
1818
- json:
1919
slug: extra_inc_{{ outer }}
2020
name: &extra_inc_{{ outer }}_name
2121
{{ project_name + ([" Foundation", " Project", ""] | random) }}
2222
description: >-
2323
{{ project_name }}
24-
{{ lorem.get_sentence().lower() }}
25-
{{ lorem.get_sentence() }}
24+
{{ fake.sentence().lower() }}
25+
{{ fake.sentence() }}
2626
public: {{ outer_stage == "Active" }}
2727
parent_uid: !ref "root_project.steps[0]._response"
2828
legal_entity_name: *extra_inc_{{ outer }}_name
2929
legal_entity_type: Incorporated Entity
3030
repository_url: https://example.com/extra_inc_{{ outer }}
3131
stage: {{ outer_stage }}
3232
{% for inner in range([0, 0, 1, 2] | random) %}
33-
{% set inner_project_name = generate_name(style='capital') %}
33+
{% set inner_project_name = fake.catch_phrase().title() %}
3434
{% set inner_stage = ["Active", "Formation - Engaged"] | random %}
3535
- json:
3636
slug: extra_inc_{{ outer }}_{{ inner }}

playbooks/projects/base_projects/3_umbrellas.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sample_umbrella_buf:
77
url: {{ environ.PROJECTS_URL | default("http://lfx-v2-project-service.lfx.svc.cluster.local:8080/projects") }}
88
method: POST
99
headers:
10-
Authorization: Bearer {{ environ.PROJECTS_TOKEN | default("-") }}
10+
Authorization: !jwt bearer=true,aud=lfx-v2-project-service,principal=clients@m2m_helper
1111
steps:
1212
- json:
1313
slug: buf
@@ -26,14 +26,14 @@ sample_umbrella_buf:
2626
stage: Active
2727
website_url: https://buf-foundation.example/
2828
{% for buf_child in range(25) %}
29-
{% set buf_child_name = generate_name(style='capital') %}
29+
{% set buf_child_name = fake.catch_phrase().title() %}
3030
- json:
3131
slug: {{ buf_child_name | lower | replace(" ", "-") }}
3232
name: {{ buf_child_name }} Project
3333
description: >-
3434
{{ buf_child_name }}
35-
{{ lorem.get_sentence().lower() }}
36-
{{ lorem.get_sentence() }}
35+
{{ fake.sentence().lower() }}
36+
{{ fake.sentence() }}
3737
public: true
3838
# Children's parent is the umbrella; legal parent is Linux Foundation.
3939
parent_uid: !ref "sample_umbrella_buf.steps[0]._response.uid"
@@ -69,14 +69,14 @@ sample_umbrella_iubp:
6969
repository_url: https://example.com/iubp-consortium
7070
website_url: https://iubp.example/
7171
{% for iubp_child in range(15) %}
72-
{% set iubp_child_name = generate_name(style='capital') %}
72+
{% set iubp_child_name = fake.catch_phrase().title() %}
7373
- json:
7474
slug: {{ iubp_child_name | lower | replace(" ", "-") }}
7575
name: {{ iubp_child_name }} Project
7676
description: >-
7777
{{ iubp_child_name }}
78-
{{ lorem.get_sentence().lower() }}
79-
{{ lorem.get_sentence() }}
78+
{{ fake.sentence().lower() }}
79+
{{ fake.sentence() }}
8080
public: true
8181
# Of course, despite looking like valid Series LLC names, these are of
8282
# course FAKE and for testing only.

playbooks/projects/extra_projects/n_depth.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,29 @@ n_depth:
1515
url: {{ environ.PROJECTS_URL | default("http://lfx-v2-project-service.lfx.svc.cluster.local:8080/projects") }}
1616
method: POST
1717
headers:
18-
Authorization: Bearer {{ environ.PROJECTS_TOKEN | default("-") }}
18+
Authorization: !jwt bearer=true,aud=lfx-v2-project-service,principal=clients@m2m_helper
1919
steps:
20-
{% set project_name = generate_name(style='capital') %}
20+
{% set project_name = fake.catch_phrase().title() %}
2121
- json:
2222
slug: depth_test_0
2323
name: {{ project_name + " Foundation" }}
2424
description: >-
2525
{{ project_name }}
26-
{{ lorem.get_sentence().lower() }}
27-
{{ lorem.get_sentence() }}
26+
{{ fake.sentence().lower() }}
27+
{{ fake.sentence() }}
2828
public: true
2929
parent_uid: !ref "n_depth_tlf_lookup.steps[0]._response"
3030
legal_parent_uid: !ref "n_depth_tlf_lookup.steps[0]._response"
3131
stage: Active
3232
{% for depth in range(1, 15) %}
33-
{% set project_name = generate_name(style='capital') %}
33+
{% set project_name = fake.catch_phrase().title() %}
3434
- json:
3535
slug: depth_test_{{ depth }}
3636
name: {{ project_name + " Project" }}
3737
description: >-
3838
{{ project_name }}
39-
{{ lorem.get_sentence().lower() }}
40-
{{ lorem.get_sentence() }}
39+
{{ fake.sentence().lower() }}
40+
{{ fake.sentence() }}
4141
public: true
4242
parent_uid: !ref "n_depth.steps[?json.slug == 'depth_test_{{ depth - 1 }}']._response.uid | [0]"
4343
legal_parent_uid: !ref "n_depth_tlf_lookup.steps[0]._response"

playbooks/projects/recreate_root_project/root.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ recreate_root_project_slug:
1212
key: slug/ROOT
1313
steps:
1414
- raw: &root_project_uid
15-
"{{ environ.PROJECTS_ROOT_UID | default(uuid()) }}"
15+
"{{ environ.PROJECTS_ROOT_UID | default(fake.uuid4()) }}"
1616

1717
recreate_root_project:
1818
type: nats-kv-put

0 commit comments

Comments
 (0)