Skip to content

Commit

Permalink
Merge pull request #1646 from rudderlabs/hotfix-release/v1.89.0
Browse files Browse the repository at this point in the history
chore(release): pull hotfix-release/v1.89.0 into main
  • Loading branch information
yashasvibajpai authored Aug 29, 2024
2 parents 82bfa12 + c7fe324 commit 6a6de51
Show file tree
Hide file tree
Showing 34 changed files with 5,421 additions and 718 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@ git

reports
.eslintcache
.vscode

__pycache__
8 changes: 8 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File with Arguments",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"args": "${command:pickArgs}"
},
{
"name": "Run Validations Test",
"type": "node",
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.89.0](https://github.com/rudderlabs/rudder-config-schema/compare/v1.88.0...v1.89.0) (2024-08-27)


### Features

* make legacy consent management fields source type specific ([#1642](https://github.com/rudderlabs/rudder-config-schema/issues/1642)) ([e429505](https://github.com/rudderlabs/rudder-config-schema/commit/e429505e92f2e3da65a4bd52fc1ffd2abdb17875))


### Bug Fixes

* stale config report format ([cbb1f29](https://github.com/rudderlabs/rudder-config-schema/commit/cbb1f2912628d00afb52d776441ebe6f444e81a9))

## [1.88.0](https://github.com/rudderlabs/rudder-config-schema/compare/v1.87.2...v1.88.0) (2024-08-27)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-config-schema",
"version": "1.88.0",
"version": "1.89.0",
"description": "",
"main": "src/index.ts",
"private": true,
Expand Down
81 changes: 63 additions & 18 deletions scripts/deployToDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def get_command_line_arguments():
# CONSTANTS
HEADER = {"Content-Type": "application/json"}
AUTH = (USERNAME, PASSWORD)
REQUEST_TIMEOUT = 10 # seconds
#########################


Expand All @@ -61,13 +62,13 @@ def parse_response(resp):

def get_persisted_store(base_url, selector):
request_url = f"{base_url}/{selector}-definitions"
response = requests.get(request_url)
response = requests.get(request_url, timeout=REQUEST_TIMEOUT)
return json.loads(response.text)


def get_config_definition(base_url, selector, name):
request_url = f"{base_url}/{selector}-definitions/{name}"
response = requests.get(request_url)
response = requests.get(request_url, timeout=REQUEST_TIMEOUT)
return response


Expand All @@ -89,13 +90,25 @@ def get_file_content(name, selector):

def update_config_definition(selector, name, fileData):
url = f"{CONTROL_PLANE_URL}/{selector}-definitions/{name}"
resp = requests.post(url=url, headers=HEADER, data=json.dumps(fileData), auth=AUTH)
resp = requests.post(
url=url,
headers=HEADER,
data=json.dumps(fileData),
auth=AUTH,
timeout=REQUEST_TIMEOUT,
)
return parse_response(resp)


def create_config_definition(selector, fileData):
url = f"{CONTROL_PLANE_URL}/{selector}-definitions/"
resp = requests.post(url=url, headers=HEADER, data=json.dumps(fileData), auth=AUTH)
resp = requests.post(
url=url,
headers=HEADER,
data=json.dumps(fileData),
auth=AUTH,
timeout=REQUEST_TIMEOUT,
)
return parse_response(resp)


Expand All @@ -112,7 +125,11 @@ def update_config(data_diff, selector):
url = f"{CONTROL_PLANE_URL}/{selector}-definitions/{nameInConfig}"

resp = requests.post(
url=url, headers=HEADER, data=json.dumps(fileData), auth=AUTH
url=url,
headers=HEADER,
data=json.dumps(fileData),
auth=AUTH,
timeout=REQUEST_TIMEOUT,
)
status, response = parse_response(resp)
diff["update"] = {"status": status, "response": response}
Expand Down Expand Up @@ -156,7 +173,7 @@ def update_diff_db(selector):
)
else:
final_report.append(
{"name": updated_data["name"], "action": "na", "status": ""}
{"name": updated_data["name"], "action": "N/A", "status": ""}
)

else:
Expand All @@ -168,6 +185,10 @@ def update_diff_db(selector):
return final_report


def get_formatted_json(data):
return json.dumps(data, indent=2)


def get_stale_data(selector, report):
stale_config_report = []
persisted_data_set = get_persisted_store(CONTROL_PLANE_URL, selector)
Expand All @@ -176,29 +197,53 @@ def get_stale_data(selector, report):

for item in persisted_items:
if item not in file_items:
stale_config_report.append({item})
stale_config_report.append(item)

return stale_config_report


if __name__ == "__main__":
print("\n")
print("#" * 50)
print("Running Destination Definitions Updates")
dest_final_report = update_diff_db("destination")

print("\n")
print("#" * 50)
print("Destination Definition Update Report")
print(dest_final_report)
print("Destination Stale Config Report")
print(get_stale_data("destination", dest_final_report))
print(get_formatted_json(dest_final_report))

print("\n")
print("#" * 50)
print("Stale Destinations Report")
print(get_formatted_json(get_stale_data("destination", dest_final_report)))

print("\n")
print("#" * 50)
print("Running Source Definitions Updates")
src_final_report = update_diff_db("source")

print("\n")
print("#" * 50)
print("Source Definition Update Report")
print(src_final_report)
print("Source Stale Config Report")
print(get_stale_data("source", src_final_report))
print(get_formatted_json(src_final_report))

print("\n")
print("#" * 50)
print("Stale Sources Report")
print(get_formatted_json(get_stale_data("source", src_final_report)))

print("Running Wht Lib Projects Definitions Updates")
print("\n")
print("#" * 50)
print("Running Wht Lib Project Definitions Updates")
wht_final_report = update_diff_db("wht-lib-project")
print("Wht lib project Definition Update Report")
print(wht_final_report)
print("Wht lib project Stale Config Report")
print(get_stale_data("wht-lib-project", wht_final_report))

print("\n")
print("#" * 50)
print("Wht Lib Project Definition Update Report")
print(get_formatted_json(wht_final_report))

print("\n")
print("#" * 50)
print("Stale Wht Lib Projects Report")
print(get_formatted_json(get_stale_data("wht-lib-project", wht_final_report)))
Loading

0 comments on commit 6a6de51

Please sign in to comment.