Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump glean-parser from 12.0.1 to 13.0.0 #4498

Merged
merged 3 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions .circleci/python_job.bash
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,22 @@ function run_build_glean {
set -x
glean_parser translate --format python_server --output ${OUTPUT_FOLDER} ${INPUT_YAML}
black ${OUTPUT_FOLDER}
{ set +x; } 2>/dev/null
case "$OSTYPE" in
darwin* | bsd*)
echo "Using BSD sed";
set -x;
sed -i '' \
-e 's/^AUTOGENERATED BY glean_parser \(.* DO NOT EDIT.\) DO NOT COMMIT.$/AUTOGENERATED BY glean_parser \1 To recreate, run:\n\nbash .circleci\/python_job.bash run build_glean/' \
${OUTPUT_FOLDER}/server_events.py;;
${OUTPUT_FOLDER}/server_events.py;
{ set +x; } 2>/dev/null;;
linux*)
echo "Using GNU sed";
set -x;
sed -i \
-e 's/^AUTOGENERATED BY glean_parser \(.* DO NOT EDIT.\) DO NOT COMMIT.$/AUTOGENERATED BY glean_parser \1 To recreate, run:\n\nbash .circleci\/python_job.bash run build_glean/' \
${OUTPUT_FOLDER}/server_events.py;;
${OUTPUT_FOLDER}/server_events.py;
{ set +x; } 2>/dev/null;;
*)
echo "Unknown OSTYPE '${OSTYPE}'";;
esac
Expand All @@ -107,19 +112,27 @@ function run_check_glean {
echo "Re-running glean_parser..."
echo
run_build_glean $GLEAN_TEST_FOLDER
set +x
{ set +x; } 2>/dev/null

echo
echo "Checking new files against checked-in files..."
local HAS_DIFFS=0
local HAS_FILES=0
local EXIT_CODE=0
for FILENAME in `find ${GLEAN_TEST_FOLDER} -type f -exec basename \{\} \;`
for FILENAME in `find ${GLEAN_TEST_FOLDER} -type f -name '*.py' -exec basename \{\} \;`
do
HAS_FILES=1
if [[ 0 -ne `cmp --silent "${GLEAN_TEST_FOLDER}/${FILENAME}" "${GLEAN_OUTPUT_FOLDER}/${FILENAME}"` ]]
RETVAL=0
/usr/bin/cmp --silent "${GLEAN_TEST_FOLDER}/${FILENAME}" "${GLEAN_OUTPUT_FOLDER}/${FILENAME}" || RETVAL=$?
if [ $RETVAL -eq 1 ]
then
HAS_DIFFS=1
elif [ $RETVAL -gt 1 ]
then
echo "cmp returned $RETVAL!"
set -x
/usr/bin/cmp --silent "${GLEAN_TEST_FOLDER}/${FILENAME}" "${GLEAN_OUTPUT_FOLDER}/${FILENAME}"
exit 1
fi
done
if [ $HAS_FILES -eq 0 ]
Expand All @@ -130,7 +143,8 @@ function run_check_glean {
if [ $HAS_DIFFS -eq 1 ]
then
echo "*** Differences detected - need to re-run glean_parser ***"
diff $GLEAN_OUTPUT_FOLDER $GLEAN_TEST_FOLDER
diff --exclude '__pycache__' $GLEAN_OUTPUT_FOLDER $GLEAN_TEST_FOLDER || true
echo "*** End of differences***"
EXIT_CODE=1
fi
if [ "$GLEAN_TEST_FOLDER" != "" ]
Expand All @@ -141,6 +155,15 @@ function run_check_glean {
if [ $EXIT_CODE -eq 0 ]
then
echo "✓ Files are identical"
elif [ $HAS_DIFFS -eq 1 ]
then
echo
echo "To fix, run:"
echo
echo " bash .circleci/python_job.bash run build_glean"
echo
echo "and add as a commit to this pull request."
exit 1
else
exit 1
fi
Expand Down
4 changes: 2 additions & 2 deletions privaterelay/glean/server_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.

AUTOGENERATED BY glean_parser v12.0.1. DO NOT EDIT. To recreate, run:
AUTOGENERATED BY glean_parser v13.0.0. DO NOT EDIT. To recreate, run:

bash .circleci/python_job.bash run build_glean
"""
Expand Down Expand Up @@ -48,7 +48,7 @@ def _record(self, user_agent: str, ip_address: str, event: dict[str, Any]) -> No
# `Unknown` fields below are required in the Glean schema, however they are
# not useful in server context
"client_info": {
"telemetry_sdk_build": "glean_parser v12.0.1",
"telemetry_sdk_build": "glean_parser v13.0.0",
"first_run_date": "Unknown",
"os": "Unknown",
"os_version": "Unknown",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ django-waffle==4.1.0
dockerflow==2024.3.0
drf-spectacular==0.27.1
drf-spectacular-sidecar==2024.3.1
glean_parser==12.0.1
glean_parser==13.0.0
google-measurement-protocol==1.1.0
google-cloud-profiler==4.1.0
gunicorn==21.2.0
Expand Down