Skip to content

Commit 160edbd

Browse files
committed
Merge remote-tracking branch 'github/main' into fix/sanitize-identifiers
2 parents e49a57d + 6c6f0de commit 160edbd

File tree

9 files changed

+143
-21
lines changed

9 files changed

+143
-21
lines changed

.github/workflows/api-pull-request.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,15 @@ jobs:
4444
- name: Cloning repo
4545
uses: actions/checkout@v4
4646

47-
- name: Install poetry
48-
run: pipx install poetry
47+
- name: Install Poetry
48+
run: make install-poetry
4949

5050
- uses: actions/setup-python@v5
5151
with:
5252
python-version: ${{ matrix.python-version }}
53-
cache: 'poetry'
53+
cache: poetry
5454

5555
- name: Install Dependencies
56-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
5756
run: make install-packages
5857

5958
- name: Create analytics database
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: API Run Makefile Target
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
target:
7+
description: The Makefile target to run (e.g. 'add-known-sdk-version')
8+
required: true
9+
opts:
10+
description: Options to pass (e.g. '--sdk flagsmith-python-sdk --version 1.2.3')
11+
required: false
12+
default: ""
13+
pr-title:
14+
description: The title to use for the PR
15+
required: true
16+
pr-notes:
17+
description: Additional notes to add to the PR body
18+
required: false
19+
default: ""
20+
21+
permissions:
22+
contents: write
23+
pull-requests: write
24+
25+
defaults:
26+
run:
27+
working-directory: api
28+
29+
jobs:
30+
run-makefile-target:
31+
runs-on: depot-ubuntu-latest
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Install Poetry
37+
run: make install-poetry
38+
39+
- uses: actions/setup-python@v5
40+
with:
41+
python-version: 3.11
42+
cache: poetry
43+
44+
- name: Install Dependencies
45+
run: make install-packages
46+
47+
- name: Run `make ${{ inputs.target }} opts=${{ inputs.opts }}`
48+
env:
49+
opts: ${{ inputs.opts }}
50+
run: make ${{ inputs.target }}
51+
52+
- name: Create Pull Request
53+
uses: peter-evans/create-pull-request@v5
54+
with:
55+
branch: chore/make-${{ inputs.target }}-${{ github.run_id }}
56+
title: ${{ inputs.pr-title }}
57+
body: |
58+
Results of `make ${{ inputs.target }} opts="${{ inputs.opts }}"` ran on commit ${{ github.sha }}.
59+
60+
${{ inputs.pr-notes }}

.github/workflows/api-tests-with-private-packages.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ jobs:
3030
- name: Cloning repo
3131
uses: actions/checkout@v4
3232

33-
- name: Install poetry
34-
run: pipx install poetry
33+
- name: Install Poetry
34+
run: make install-poetry
35+
3536
- uses: actions/setup-python@v5
3637
with:
3738
python-version: '3.12'
38-
cache: 'poetry'
39+
cache: poetry
3940

4041
- name: Install SAML Dependencies
4142
run: sudo apt-get install -y xmlsec1
4243

4344
- name: Install packages and Tests
44-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
4545
shell: bash
4646
run: |
4747
echo "https://${{ secrets.GH_PRIVATE_ACCESS_TOKEN }}:@github.com" > ${HOME}/.git-credentials

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
33
# Ruff version.
4-
rev: v0.12.11
4+
rev: v0.12.12
55
hooks:
66
# Run the linter.
77
- id: ruff

api/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,7 @@ integrate-private-tests:
152152
.PHONY: generate-docs
153153
generate-docs:
154154
poetry run flagsmith docgen metrics > ../docs/docs/system-administration/metrics.md
155+
156+
.PHONY: add-known-sdk-version
157+
add-known-sdk-version:
158+
poetry run python scripts/add-known-sdk-version.py $(opts)

api/scripts/add-known-sdk-version.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import argparse
2+
import re
3+
from pathlib import Path
4+
5+
MODULE_PATH = "app_analytics/constants.py"
6+
VERSIONS_CONSTANT_NAME = "SDK_USER_AGENT_KNOWN_VERSIONS"
7+
8+
9+
def add_version(sdk_name: str, new_version: str) -> None:
10+
"""Add a new version to known versions constants"""
11+
contents = Path(MODULE_PATH).read_text()
12+
13+
# Add SDK version
14+
contents = re.sub(
15+
pattern=rf"""
16+
^ # Expect to have definition at module-level
17+
(?P<constant_def>{VERSIONS_CONSTANT_NAME}[^=]*=\s*\{{)
18+
(?P<prior_sdks>[^\}}]+)
19+
(?P<sdk_def>"{sdk_name}"\s*:\s*\[)
20+
(?P<sdk_versions>[^\]]*)
21+
(?P<latest_version>"(?:unknown|\d[^"]+)"),?
22+
""",
23+
repl=(
24+
r"\g<constant_def>\g<prior_sdks>\g<sdk_def>\g<sdk_versions>\g<latest_version>"
25+
f',\n "{new_version}",\n '
26+
),
27+
string=contents,
28+
count=1,
29+
flags=re.MULTILINE | re.VERBOSE,
30+
)
31+
32+
Path(MODULE_PATH).write_text(contents)
33+
34+
35+
def main() -> None:
36+
parser = argparse.ArgumentParser(
37+
description="Add a known SDK version to an existing constants entry."
38+
)
39+
parser.add_argument(
40+
"--sdk",
41+
type=str,
42+
required=True,
43+
help="The SDK name, e.g. flagsmith-js-sdk",
44+
)
45+
parser.add_argument(
46+
"--version",
47+
type=str,
48+
required=True,
49+
help="The SDK version, e.g. 9.4.0",
50+
)
51+
args = parser.parse_args()
52+
add_version(args.sdk, args.version)
53+
54+
55+
if __name__ == "__main__":
56+
main()

docs/docs/clients/client-side/javascript.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,6 @@ const font_size = flagsmith.getValue('font_size', { fallback: 12 });
365365

366366
## Datadog RUM JavaScript SDK Integration
367367

368-
:::caution
369-
370-
This feature is still in beta with Datadog. Contact your Datadog representative before enabling the integration below.
371-
372-
:::
373-
374368
The Flagsmith JavaScript SDK can be configured so that feature enabled state and remote config can be stored as
375369
[Datadog RUM feature flags](https://docs.datadoghq.com/real_user_monitoring/guide/setup-feature-flag-data-collection/?tab=npm#analyze-your-feature-flag-performance-in-rum)
376370
and user traits can be stored as

docs/docs/deployment/hosting/kubernetes.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,17 +221,26 @@ api:
221221

222222
By default, no resource limits or requests are set.
223223

224-
TODO: recommend some defaults
224+
Our recommended limits are 1vCPU and 2GB RAM for all of our pods, but this might vary depending on your usage pattern
225+
and hosting environment.
225226

226227
### Replicas
227228

228-
By default, 1 replica of each of the frontend and api is used.
229+
By default, 1 replica of each of the frontend, API, and task processor is used. We recommend tailoring these to your
230+
requirements based on expected load, and your hosting environment. As the API will be the most heavily used service, we
231+
would recommend adding more replicas to your API than the other services. A standard configuration, with some built in
232+
fault tolerance, might look something like:
229233

230-
TODO: recommend some defaults.
234+
```yaml
235+
frontend:
236+
replicacount: 2
231237
232-
TODO: consider some autoscaling options.
238+
api:
239+
replicacount: 4
233240
234-
TODO: create a pod-disruption-budget
241+
taskProcessor:
242+
replicacount: 2
243+
```
235244

236245
### Deployment strategy
237246

sdk/evaluation-result.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"description": "Evaluation result object containing the used context, flag evaluation results, and segments used in the evaluation.",
6969
"properties": {
7070
"context": {
71-
"$ref": "https://github.com/Flagsmith/flagsmith/blob/chore/features-contexts-in-eval-context-schema/sdk/evaluation-context.json"
71+
"$ref": "https://raw.githubusercontent.com/Flagsmith/flagsmith/main/sdk/evaluation-context.json"
7272
},
7373
"flags": {
7474
"description": "List of feature flags evaluated for the context.",

0 commit comments

Comments
 (0)