Skip to content

Commit

Permalink
[identity] Update to include subclusters, user IDs, deployments
Browse files Browse the repository at this point in the history
We want to be able to track when an identity token comes from a
particular subcluster or deployment.

This change adds that functionality.
  • Loading branch information
lhchavez committed Sep 6, 2023
1 parent 32face7 commit 97bda83
Show file tree
Hide file tree
Showing 9 changed files with 286 additions and 126 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ignore = E203,W503,ANN101,ANN102,S322,ANN206,S201,D105,D107,ANN401
per-file-ignores =
src/replit/__init__.py:F401
src/replit/web/__init__.py:F401
tests/test_identity.py:S105,S106
exclude =
src/replit/goval/api

Expand Down
39 changes: 39 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Upgrade protobufs

In order to upgrade the protobuf definitions, the following script can be used.

```shell
#!/bin/bash

set -e

GOVAL_DIR="${GOVAL_DIR:-${HOME}/goval}"
WORK_DIR="$(mktemp -d)"

function cleanup {
rm -rf "${WORK_DIR}"
}
trap cleanup EXIT

# Download the latest protobuf binaries.
curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v24.2/protoc-24.2-linux-x86_64.zip -o "${WORK_DIR}/protoc.zip"
(cd "${WORK_DIR}" && unzip protoc.zip)
mkdir -p "${WORK_DIR}/replit/goval"

rsync \
-Lazr \
--exclude='api/npm' \
--include='*/' \
--include='*.proto' \
--exclude='*' \
"${GOVAL_DIR}/api" \
"${WORK_DIR}/replit/goval"
find "${WORK_DIR}" -name '*.proto' | xargs sed -i 's@import "api/@import "replit/goval/api/@g'
"${WORK_DIR}/bin/protoc" \
-I="${WORK_DIR}" \
--python_out=src/ \
"${WORK_DIR}/replit/goval/api/signing.proto" \
"${WORK_DIR}/replit/goval/api/client.proto" \
"${WORK_DIR}/replit/goval/api/repl/repl.proto" \
"${WORK_DIR}/replit/goval/api/features/features.proto"
```
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ replit = "replit.__main__:cli"
exclude = [
"_pb2.py$", # Generated code
]

[tool.black]
exclude = "src/replit/goval/api"
78 changes: 35 additions & 43 deletions src/replit/goval/api/client_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 15 additions & 17 deletions src/replit/goval/api/features/features_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 97bda83

Please sign in to comment.