Bug 1889247 - Sort search-config-v2 remote settings collection. r=Standard8,leplatrem

This patch sorts all the keys of search-config-v2 dump in alphabetical
order. It also sorts each object by recordType and engine identifier in
alphabetical order.

Differential Revision: https://phabricator.services.mozilla.com/D206557
This commit is contained in:
mcheang 2024-04-08 19:46:17 +00:00
parent f335515418
commit 39f44a548d

View File

@ -318,7 +318,13 @@ function compare_remote_settings_files {
remote_records_url="$REMOTE_SETTINGS_SERVER/buckets/${bucket}/collections/${collection}/changeset?_expected=${last_modified}"
local_location_output="$REMOTE_SETTINGS_OUTPUT/${bucket}/${collection}.json"
mkdir -p "$REMOTE_SETTINGS_OUTPUT/${bucket}"
${WGET} -qO- "$remote_records_url" | ${JQ} '{"data": .changes, "timestamp": .timestamp}' > "${local_location_output}"
# We sort both the keys and the records in search-config-v2 to make it
# easier to read and to experiment with making changes via the dump file.
if [ "${collection}" = "search-config-v2" ]; then
${WGET} -qO- "$remote_records_url" | ${JQ} --sort-keys '{"data": .changes | sort_by(.recordType, .identifier), "timestamp": .timestamp}' > "${local_location_output}"
else
${WGET} -qO- "$remote_records_url" | ${JQ} '{"data": .changes, "timestamp": .timestamp}' > "${local_location_output}"
fi
# 5. Download attachments if needed.
if [ "${bucket}" = "blocklists" ] && [ "${collection}" = "addons-bloomfilters" ]; then