Skip to content

Commit

Permalink
Merge branch 'develop' into feat.path-params-http
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepdsvs authored Dec 16, 2024
2 parents 8984b6b + 2c683fe commit 67de4a3
Show file tree
Hide file tree
Showing 42 changed files with 1,762 additions and 110 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/check-generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "::error::Generated constants are not up-to-date. Run 'npm run generate:constants' and commit the changes.";
echo "Here are the differences:";
git diff || true 2>&1;
exit 1;
else
echo "Git state is clean.";
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/raise-pr-for-constants.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Raise PR for Destination Constants

on:
push:
branches:
- develop

permissions:
contents: write
pull-requests: write

env:
BRANCH_NAME: fix/gh-update-destinations-ts
SRC_FILE: generated/Destinations.ts
DEST_PATH: packages/analytics-js-common/src/constants/integrations/Destinations.ts

jobs:
check_changes_and_raise_pr:
runs-on: ubuntu-latest
steps:
- name: Checkout Source Repo
uses: actions/checkout@v4
with:
ref: develop

- name: Checkout Destination Repo
run: |
git clone https://github.com/rudderlabs/rudder-sdk-js.git dest-repo || exit 1
cd dest-repo
git checkout ${{ env.BRANCH_NAME }} || git checkout -b ${{ env.BRANCH_NAME }}
- name: Compare Destinations.ts
id: compare_files
run: |
if cmp -s "${{ env.SRC_FILE }}" "dest-repo/${{ env.DEST_PATH }}"; then
echo "No changes detected."
echo "pr_required=false" >> $GITHUB_OUTPUT
else
echo "Changes detected."
echo "pr_required=true" >> $GITHUB_OUTPUT
fi
- name: Commit and Push Changes
if: steps.compare_files.outputs.pr_required == 'true'
run: |
cd dest-repo
cp "../generated/Destinations.ts" "packages/analytics-js-common/src/constants/integrations/Destinations.ts"
git add packages/analytics-js-common/src/constants/integrations/Destinations.ts
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git config --global url."https://${{ secrets.PAT }}@github.com/".insteadOf "https://github.com/"
git commit -m "fix: update destinations.ts"
git push origin ${{ env.BRANCH_NAME }}
- name: Create or Update PR
if: steps.compare_files.outputs.pr_required == 'true'
env:
GH_TOKEN: ${{ secrets.PAT }}
run: |
cd dest-repo
EXISTING_PR=$(gh pr list --head "$BRANCH_NAME" --json number --jq ".[0].number")
if [ -z "$EXISTING_PR" ]; then
# Create the PR body content in a variable
PR_BODY="This PR updates the destination constants file.
**Changes:**
- Updated \`Destinations.ts\` with latest constants
**NOTE:** This PR was automatically generated by GitHub Actions."
# Create a new PR
gh pr create \
--title "fix: update destination constants" \
--body "$PR_BODY" \
--label "github_actions,dependencies"
else
echo "PR already exists: $EXISTING_PR"
fi
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@

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.99.1](https://github.com/rudderlabs/rudder-config-schema/compare/v1.99.0...v1.99.1) (2024-12-12)


### Bug Fixes

* **http:** update the default for propertiesMapping ([#1838](https://github.com/rudderlabs/rudder-config-schema/issues/1838)) ([5fc592f](https://github.com/rudderlabs/rudder-config-schema/commit/5fc592f4d52697737f6716a93e5b6372d3211e98))

## [1.99.0](https://github.com/rudderlabs/rudder-config-schema/compare/v1.98.2...v1.99.0) (2024-12-10)


### Features

* add iubenda to a subset of destinations ([#1795](https://github.com/rudderlabs/rudder-config-schema/issues/1795)) ([65b6f16](https://github.com/rudderlabs/rudder-config-schema/commit/65b6f16bc5de853c0dca0b6fe031f3e323b3ba73))
* add iubenda to shopify source in tiktok ads dest ([#1824](https://github.com/rudderlabs/rudder-config-schema/issues/1824)) ([0d681b1](https://github.com/rudderlabs/rudder-config-schema/commit/0d681b10bd46b1bdb84d42b48b06f1d01daad785))
* generate destination constants ([#1800](https://github.com/rudderlabs/rudder-config-schema/issues/1800)) ([5f58915](https://github.com/rudderlabs/rudder-config-schema/commit/5f589157b7c947ae7fd4ae46fe908588f8c67abf))
* update mapping component regex for HTTP destination ([#1820](https://github.com/rudderlabs/rudder-config-schema/issues/1820)) ([54c5b17](https://github.com/rudderlabs/rudder-config-schema/commit/54c5b17e87eccbf77dc911ed1449f272917f3084))


### Bug Fixes

* constants pr workflow to keep all steps under the same job ([#1834](https://github.com/rudderlabs/rudder-config-schema/issues/1834)) ([e57aa07](https://github.com/rudderlabs/rudder-config-schema/commit/e57aa07e578f4017d06465baf82bca580233f8aa))
* **http:** updated property mapping regex ([#1830](https://github.com/rudderlabs/rudder-config-schema/issues/1830)) ([186f04a](https://github.com/rudderlabs/rudder-config-schema/commit/186f04a63533a4240998e7eb26afd3a8b610e629))
* pr body in constants pr workflow ([133681a](https://github.com/rudderlabs/rudder-config-schema/commit/133681ab820690d07c3c3364d573557215ea5fe9))
* tokens in constants pr workflow ([05eaf6e](https://github.com/rudderlabs/rudder-config-schema/commit/05eaf6e594d2106844797a3ff88787f7752afcc0))
* tokens in constants pr workflow ([676e0b0](https://github.com/rudderlabs/rudder-config-schema/commit/676e0b0ffb9adf5a7a13544be7d1a601f602ec50))

### [1.98.2](https://github.com/rudderlabs/rudder-config-schema/compare/v1.98.1...v1.98.2) (2024-12-04)


Expand Down
4 changes: 2 additions & 2 deletions generated/Destinations.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
GENERATED - DO NOT EDIT
This file is generated from the templates/Destinations.dart.template file.
Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.dart
Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.dart
NOTE: Containly only constants for device mode destinations
NOTE: Contains only constants for device mode destinations
*/

class Destinations {
Expand Down
4 changes: 2 additions & 2 deletions generated/Destinations.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
GENERATED - DO NOT EDIT
This file is generated from the templates/Destinations.java.template file.
Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.java
Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.java
NOTE: Containly only constants for device mode destinations
NOTE: Contains only constants for device mode destinations
*/

public class Destinations {
Expand Down
4 changes: 2 additions & 2 deletions generated/Destinations.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
GENERATED - DO NOT EDIT
This file is generated from the templates/Destinations.kt.template file.
Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.kt
Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.kt
NOTE: Containly only constants for device mode destinations
NOTE: Contains only constants for device mode destinations
*/

object Destinations {
Expand Down
4 changes: 2 additions & 2 deletions generated/Destinations.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
GENERATED - DO NOT EDIT
This file is generated from the templates/Destinations.m.template file.
Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.m
Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.m
NOTE: Containly only constants for device mode destinations */
NOTE: Contains only constants for device mode destinations */

#import <Foundation/Foundation.h>

Expand Down
4 changes: 2 additions & 2 deletions generated/Destinations.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
GENERATED - DO NOT EDIT
This file is generated from the templates/Destinations.swift.template file.
Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.swift
Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.swift

NOTE: Containly only constants for device mode destinations
NOTE: Contains only constants for device mode destinations
*/

struct Destinations {
Expand Down
4 changes: 2 additions & 2 deletions generated/Destinations.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
GENERATED - DO NOT EDIT
This file is generated from the templates/Destinations.ts.template file.
Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.ts
Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.ts
NOTE: Containly only constants for device mode destinations
NOTE: Contains only constants for device mode destinations
*/
export const ACTIVE_CAMPAIGN_NAME = 'ACTIVE_CAMPAIGN';
export const ACTIVE_CAMPAIGN_DISPLAY_NAME = 'ActiveCampaign';
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.98.2",
"version": "1.99.1",
"description": "",
"main": "src/index.ts",
"private": true,
Expand Down
116 changes: 59 additions & 57 deletions scripts/deployToDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,67 @@
from constants import CONFIG_DIR


ALL_SELECTORS = ["destination", "source", "wht-lib-project"]


def get_command_line_arguments():
parser = argparse.ArgumentParser(description="Script to deploy config files to DB.")
parser.add_argument("control_plane_url", nargs="?", help="Control plane URL")
parser.add_argument("username", nargs="?", help="Control plane admin username")
parser.add_argument("password", nargs="?", help="Control plane admin password")
parser.add_argument(
"selector",
nargs="?",
help="Specify destination, source or wht-lib-project",
default=None,
)
parser.add_argument(
"item_name", nargs="?", help="Specific item name to update.", default=None
)

args = parser.parse_args()

control_plane_url = args.control_plane_url or os.getenv("CONTROL_PLANE_URL")
username = args.username or os.getenv("API_USER")
password = args.password or os.getenv("API_PASSWORD")
selector = args.selector or os.getenv("SELECTOR")
item_name = args.item_name or os.getenv("ITEM_NAME")

missing_args = []
invalid_args = []

if control_plane_url is None:
missing_args.append(
"1st positional argument or CONTROL_PLANE_URL environment variable"
invalid_args.append(
"1st positional argument or CONTROL_PLANE_URL environment variable is missing"
)
if username is None:
missing_args.append("2nd positional argument or API_USER environment variable")
invalid_args.append(
"2nd positional argument or API_USER environment variable is missing"
)
if password is None:
missing_args.append(
"3rd positional argument or API_PASSWORD environment variable"
invalid_args.append(
"3rd positional argument or API_PASSWORD environment variable is missing"
)
if selector is None:
SELECTORS = ALL_SELECTORS
elif selector not in ALL_SELECTORS:
invalid_args.append(
"4th positional argument or SELECTOR environment variable is invalid"
)
else:
SELECTORS = [selector]

if missing_args:
print("Error: Missing the following arguments or environment variables:")
for arg in missing_args:
if invalid_args:
print("Error: The following arguments or environment variables are invalid:")
for arg in invalid_args:
print(arg)
sys.exit(1)

return control_plane_url, username, password
return control_plane_url, username, password, SELECTORS, item_name


CONTROL_PLANE_URL, USERNAME, PASSWORD = get_command_line_arguments()
CONTROL_PLANE_URL, USERNAME, PASSWORD, SELECTORS, ITEM_NAME = (
get_command_line_arguments()
)

# CONSTANTS
HEADER = {"Content-Type": "application/json"}
Expand Down Expand Up @@ -139,11 +165,16 @@ def update_config(data_diff, selector):
return json.dumps(results, indent=2)


def update_diff_db(selector):
def update_diff_db(selector, item_name=None):
final_report = []

## data sets
current_items = os.listdir(f"./{CONFIG_DIR}/{selector}s")
if item_name:
current_items = [item_name]
else:
current_items = os.listdir(f"./{CONFIG_DIR}/{selector}s")

print(f"Current items: {current_items}")

for item in current_items:
# check if item is a directory
Expand Down Expand Up @@ -203,47 +234,18 @@ def get_stale_data(selector, 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(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(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("\n")
print("#" * 50)
print("Running Wht Lib Project Definitions Updates")
wht_final_report = update_diff_db("wht-lib-project")

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)))
for selector in SELECTORS:
print("\n")
print("#" * 50)
print("Running {} Definitions Updates".format(selector.capitalize()))
final_report = update_diff_db(selector, ITEM_NAME)

print("\n")
print("#" * 50)
print("{} Definition Update Report".format(selector.capitalize()))
print(get_formatted_json(final_report))

print("\n")
print("#" * 50)
print("Stale {}s Report".format(selector.capitalize()))
print(get_formatted_json(get_stale_data(selector, final_report)))
Loading

0 comments on commit 67de4a3

Please sign in to comment.