Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayachand committed Mar 13, 2024
2 parents 12d9bf1 + bdc0f41 commit 7beb4ce
Show file tree
Hide file tree
Showing 60 changed files with 9,428 additions and 1,777 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/dt-test-and-report-code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
- name: Upload Coverage Reports to Codecov
uses: codecov/[email protected]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
directory: ./reports/coverage

Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/prepare-for-prod-dt-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,39 @@ jobs:
git push -u origin hosted-transformer-$TAG_NAME
gh pr create --fill
- name: Update helm charts and raise pull request for enterprise customers on dedicated transformers
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
run: |
cd rudder-devops
git checkout -b dedicated-transformer-$TAG_NAME
cd customer-objects
declare -a enabled_ut_customers=()
declare -a sub_directories=('enterprise-us' 'enterprise-eu')
# identify the customers enabled in sub-directories
for directory in "${sub_directories[@]}"; do
for f in "./$directory"/*; do
[[ -f $f ]] || continue
enabled="$(yq e '.spec.user_transformer.enabled' $f)"
if [ $enabled == "true" ]; then
enabled_ut_customers+=( $f )
fi
done
done
# bump up the customers version and repository information
for customer in "${enabled_ut_customers[@]}"; do
yq eval -i ".spec.user_transformer.image.version=\"$TAG_NAME\"" $customer
yq eval -i ".spec.user_transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" $customer
git add $customer
done
git commit -m "chore: upgrade dedicated transformers to $TAG_NAME"
git push -u origin dedicated-transformer-$TAG_NAME
gh pr create --fill
40 changes: 39 additions & 1 deletion .github/workflows/prepare-for-prod-rollback.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ jobs:
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Clone Devops Repo
run: |
git clone https://${{secrets.PAT}}@github.com/rudderlabs/rudder-devops.git
- name: Update Helm Charts and Raise Pull Request
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
run: |
git clone https://${{secrets.PAT}}@github.com/rudderlabs/rudder-devops.git
cd rudder-devops
git checkout -b shared-transformer-rollback-${{ steps.target-version.outputs.tag_name }}
Expand All @@ -57,3 +60,38 @@ jobs:
git push -u origin shared-transformer-rollback-${{ steps.target-version.outputs.tag_name }}
gh pr create --fill
- name: Update helm charts and raise pull request for enterprise customers on dedicated transformers
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
run: |
cd rudder-devops
git checkout -b dedicated-transformer-rollback-${{ steps.target-version.outputs.tag_name }}
cd customer-objects
declare -a enabled_ut_customers=()
declare -a sub_directories=('enterprise-us' 'enterprise-eu')
# identify the customers enabled in sub-directories
for directory in "${sub_directories[@]}"; do
for f in "./$directory"/*; do
[[ -f $f ]] || continue
enabled="$(yq e '.spec.user_transformer.enabled' $f)"
if [ $enabled == "true" ]; then
enabled_ut_customers+=( $f )
fi
done
done
# bump up the customers version and repository information
for customer in "${enabled_ut_customers[@]}"; do
yq eval -i ".spec.user_transformer.image.version=\"${{ steps.target-version.outputs.tag_name }}\"" $customer
git add $customer
done
git commit -m "chore: rollback dedicated transformers to ${{ steps.target-version.outputs.tag_name }}"
git push -u origin dedicated-transformer-rollback-${{ steps.target-version.outputs.tag_name }}
gh pr create --fill
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.19.0
18.19.1
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.4
FROM node:18.19.0-alpine3.18 AS base
FROM node:18.19.1-alpine3.18 AS base
ENV HUSKY 0

RUN apk update
Expand Down
8 changes: 6 additions & 2 deletions src/cdk/v2/destinations/algolia/rtWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ bindings:
- path: ../../../../v0/destinations/algolia/config
- name: handleRtTfSingleEventError
path: ../../../../v0/util/index

steps:
- name: validateInput
template: |
Expand All @@ -28,10 +27,14 @@ steps:
$.outputs.transform#idx.error.(
$.handleRtTfSingleEventError(^[idx], .originalError ?? ., {})
)[]
- name: batchSuccessfulEvents
description: Batches the successfulEvents
template: |
let batches = $.chunk($.outputs.successfulEvents, $.MAX_BATCH_SIZE);
const dontBatchTrueEvents = $.outputs.successfulEvents{.metadata.dontBatch}[];
const dontBatchFalseEvents = $.outputs.successfulEvents{!.metadata.dontBatch}[];
let batches = [...$.chunk(dontBatchFalseEvents, $.MAX_BATCH_SIZE), ...$.chunk(dontBatchTrueEvents, 1)];
batches@batch.({
"batchedRequest": {
"body": {
Expand All @@ -56,6 +59,7 @@ steps:
"statusCode": 200,
"destination": batch[0].destination
})[];
- name: finalPayload
template: |
[...$.outputs.failedEvents, ...$.outputs.batchSuccessfulEvents]
65 changes: 65 additions & 0 deletions src/cdk/v2/destinations/koala/procWorkflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
bindings:
- name: EventType
path: ../../../../constants
- path: ../../bindings/jsontemplate
- name: defaultRequestConfig
path: ../../../../v0/util

steps:
- name: validateInput
template: |
$.assert(.message.type, "message Type is not present. Aborting message");
$.assert(.message.type in {{$.EventType.([.IDENTIFY, .TRACK])}},
"message type " + .message.type + " is not supported");
$.assertConfig(.destination.Config.publicKey, "publicKey is not present. Aborting message");
$.context.email = .message.().({{{{$.getGenericPaths("emailOnly")}}}});
$.context.ko_profile_id = .message.traits.ko_profile_id ?? .message.context.traits.ko_profile_id ?? .message.properties.ko_profile_id;
$.assert($.context.email || $.context.ko_profile_id, "Neither email or ko_profile_id are present on traits. Aborting message");
- name: setMessageType
template: |
$.context.messageType = .message.type.toLowerCase();
- name: preparePayloadForIdentify
condition: $.context.messageType === {{$.EventType.IDENTIFY}}
template: |
const traits = .message.traits ?? .message.context.traits ?? {};
const koTraits = traits{~['ko_profile_id']}
const basePayload = {
email: $.context.email,
profile_id: $.context.ko_profile_id,
identifies: [{
type: $.context.messageType,
sent_at: .message.().({{{{$.getGenericPaths("timestamp")}}}}),
traits: koTraits
}]
};
$.context.payload = basePayload
- name: preparePayloadForTrack
condition: $.context.messageType === {{$.EventType.TRACK}}
template: |
const properties = .message.properties ?? {};
const koProperties = properties{~['ko_profile_id']}
const basePayload = {
ip: .message.context.ip ?? .message.request_ip,
email: $.context.email,
profile_id: $.context.ko_profile_id,
events: [{
type: $.context.messageType,
event: .message.event,
message_id: .message.messageId,
sent_at: .message.().({{{{$.getGenericPaths("timestamp")}}}}),
properties: koProperties,
context: .message.context
}]
};
$.context.payload = basePayload
- name: buildResponseForProcessTransformation
template: |
const response = $.defaultRequestConfig();
response.body.JSON = $.context.payload;
response.endpoint = "https://api2.getkoala.com/web/projects/" + .destination.Config.publicKey + "/batch";
response.headers = {
"content-type": "application/json"
};
response
31 changes: 31 additions & 0 deletions src/cdk/v2/destinations/koala/rtWorkflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
bindings:
- name: handleRtTfSingleEventError
path: ../../../../v0/util/index

steps:
- name: validateInput
template: |
$.assert(Array.isArray(^) && ^.length > 0, "Invalid event array")
- name: transform
externalWorkflow:
path: ./procWorkflow.yaml
loopOverInput: true

- name: successfulEvents
template: |
$.outputs.transform#idx.output.({
"batchedRequest": .,
"batched": false,
"destination": ^[idx].destination,
"metadata": ^[idx].metadata[],
"statusCode": 200
})[]
- name: failedEvents
template: |
$.outputs.transform#idx.error.(
$.handleRtTfSingleEventError(^[idx], .originalError ?? ., {})
)[]
- name: finalPayload
template: |
[...$.outputs.failedEvents, ...$.outputs.successfulEvents]
1 change: 1 addition & 0 deletions src/constants/destinationCanonicalNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ const DestCanonicalNames = {
'the trade desk',
],
INTERCOM: ['INTERCOM', 'intercom', 'Intercom'],
koala: ['Koala', 'koala', 'KOALA'],
};

module.exports = { DestHandlerMap, DestCanonicalNames };
10 changes: 5 additions & 5 deletions src/controllers/bulkUpload.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/* eslint-disable global-require, import/no-dynamic-require, @typescript-eslint/no-unused-vars */
import { client as errNotificationClient } from '../util/errorNotifier';
import logger from '../logger';
import {
getJobStatusHandler,
getPollStatusHandler,
getDestFileUploadHandler,
} from '../util/fetchDestinationHandlers';
import { CatchErr, ContextBodySimple } from '../util/types';
// TODO: To be refactored and redisgned

const getDestFileUploadHandler = (version, dest) =>
require(`../${version}/destinations/${dest}/fileUpload`);
const getPollStatusHandler = (version, dest) => require(`../${version}/destinations/${dest}/poll`);
const getJobStatusHandler = (version, dest) =>
require(`../${version}/destinations/${dest}/fetchJobStatus`);
const ERROR_MESSAGE_PROCESSOR_STRING = 'Error occurred while processing payload.';

const getCommonMetadata = (ctx) =>
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/trackingPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class TrackingPlanController {
const events = ctx.request.body;
const requestSize = Number(ctx.request.get('content-length'));
const reqParams = ctx.request.query;
const response = await TrackingPlanservice.validateTrackingPlan(events, requestSize, reqParams);
const response = await TrackingPlanservice.validate(events, requestSize, reqParams);
ctx.body = response.body;
ControllerUtility.postProcess(ctx, response.status);
return ctx;
Expand Down
3 changes: 2 additions & 1 deletion src/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"REDDIT": true,
"THE_TRADE_DESK": true,
"INTERCOM": true,
"NINETAILED": true
"NINETAILED": true,
"KOALA": true
},
"regulations": [
"BRAZE",
Expand Down
Loading

0 comments on commit 7beb4ce

Please sign in to comment.