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

chore(release): pull hotfix-release/3.69.0-SDK-2776 into main #1972

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
167 changes: 85 additions & 82 deletions .github/workflows/deploy.yml

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion .github/workflows/draft-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,17 @@ env:
NODE_OPTIONS: '--no-warnings'

jobs:
validate-actor:
# Only allow to draft a new release from develop and hotfix branches
if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/')
uses: ./.github/workflows/validate-actor.yml
secrets:
PAT: ${{ secrets.PAT }}

draft-new-release:
needs: validate-actor
name: Draft a new release
runs-on: [self-hosted, Linux, X64]
if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/')
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/rollback.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ on:
workflow_dispatch:

jobs:
validate-actor:
# Only allow to be deployed from tags and main branch
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
uses: ./.github/workflows/validate-actor.yml
secrets:
PAT: ${{ secrets.PAT }}

deploy:
needs: validate-actor
name: Rollback production deployment
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
uses: ./.github/workflows/deploy.yml
with:
environment: 'production'
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/update-cache-policy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Update cache control policy

on:
workflow_dispatch:
inputs:
policy_type:
type: choice
description: Select the cache control policy type
required: true
options:
- no-store
- max-age=3600

permissions:
id-token: write # allows the JWT to be requested from GitHub's OIDC provider
contents: read # This is required for actions/checkout

jobs:
validate-actor:
# Only allow to be deployed from tags and main branch
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
uses: ./.github/workflows/validate-actor.yml
secrets:
PAT: ${{ secrets.PAT }}

update-cache-policy:
needs: validate-actor
name: Update cache control policy for SDK artifacts
runs-on: [self-hosted, Linux, X64]

steps:
- name: Install AWS CLI
uses: unfor19/install-aws-cli-action@master

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_PROD_ACCOUNT_ID }}:role/${{ secrets.AWS_PROD_S3_SYNC_ROLE }}
aws-region: us-east-1

- name: Determine the cache control policy
id: determine_policy
run: |
echo "cache_control_policy=${{ github.event.inputs.policy_type || inputs.policy_type }}" >> $GITHUB_ENV
- name: Update cache control policy
run: |
# Get the number of CPU cores in the runner and leave one core free
num_cores=$(nproc --ignore=1 || echo 1) # Default to 1 if nproc is unavailable
# Use a factor to set the parallel jobs (e.g., number of cores or slightly lower)
parallel_jobs=$((num_cores * 2))
echo "Detected $num_cores cores. Using $parallel_jobs parallel jobs."
prefixes=("adobe-analytics-js" "v3" "v1.1")
for prefix in "${prefixes[@]}"; do
echo "Processing prefix: $prefix"
aws s3api list-objects --bucket ${{ secrets.AWS_PROD_S3_BUCKET_NAME }} --prefix "$prefix" --query "Contents[].Key" --output text | tr '\t' '\n' | \
parallel --retries 10 -j "$parallel_jobs" "aws s3api copy-object \
--bucket ${{ secrets.AWS_PROD_S3_BUCKET_NAME }} \
--copy-source ${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/{} \
--key {} \
--metadata-directive REPLACE \
--cache-control '${{ env.cache_control_policy }}'"
done
30 changes: 30 additions & 0 deletions .github/workflows/validate-actor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Validate Actor

on:
workflow_call:
secrets:
PAT:
required: true

jobs:
validate-actor:
runs-on: [self-hosted, Linux, X64]
steps:
- name: Validate if actor is allowed to trigger the workflow
env:
ORG_NAME: rudderlabs
TEAM_NAME: js-sdk
run: |
actor=${{ github.actor || github.triggering_actor }}
response=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/${{ env.ORG_NAME }}/teams/${{ env.TEAM_NAME }}/memberships/$actor)

if echo "$response" | grep -q '"state": "active"'; then
echo "$actor is a member of $TEAM_NAME team"
else
echo "$actor is NOT a member of $TEAM_NAME team"
exit 1
fi
6 changes: 3 additions & 3 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": "@rudderstack/analytics-js-monorepo",
"version": "3.68.0",
"version": "3.69.0",
"private": true,
"description": "Monorepo for RudderStack Analytics JS SDK",
"workspaces": [
Expand Down
6 changes: 6 additions & 0 deletions packages/analytics-js-plugins/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

## [3.6.19](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected]...@rudderstack/[email protected]) (2024-12-13)

### Dependency Updates

* `@rudderstack/analytics-js` updated to version `3.11.15`
* `@rudderstack/analytics-js-cookies` updated to version `0.4.16`
## [3.6.18](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected]...@rudderstack/[email protected]) (2024-12-06)

### Dependency Updates
Expand Down
6 changes: 3 additions & 3 deletions packages/analytics-js-plugins/CHANGELOG_LATEST.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## [3.6.18](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected].17...@rudderstack/[email protected].18) (2024-12-06)
## [3.6.19](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected].18...@rudderstack/[email protected].19) (2024-12-13)

### Dependency Updates

* `@rudderstack/analytics-js-common` updated to version `3.14.13`
* `@rudderstack/analytics-js` updated to version `3.11.14`
* `@rudderstack/analytics-js` updated to version `3.11.15`
* `@rudderstack/analytics-js-cookies` updated to version `0.4.16`
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ describe('Plugin - Bugsnag', () => {
installType: 'npm',
}),
},
session: {
sessionInfo: signal({ id: 'test-session-id' }),
},
autoTrack: {
pageLifecycle: {
visitId: signal('test-visit-id'),
},
},
};

let state: any;
Expand Down
36 changes: 34 additions & 2 deletions packages/analytics-js-plugins/__tests__/bugsnag/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ beforeEach(() => {
lifecycle: {
writeKey: signal('dummy-write-key'),
},
session: {
sessionInfo: signal({ id: 'test-session-id' }),
},
autoTrack: {
pageLifecycle: {
visitId: signal('test-visit-id'),
},
},
};
});

Expand Down Expand Up @@ -235,6 +243,14 @@ describe('Bugsnag utilities', () => {
installType: 'npm',
},
},
session: {
sessionInfo: { id: 'test-session-id' },
},
autoTrack: {
pageLifecycle: {
visitId: 'test-visit-id',
},
},
},
});

Expand Down Expand Up @@ -277,6 +293,14 @@ describe('Bugsnag utilities', () => {
installType: 'npm',
},
},
session: {
sessionInfo: { id: 'test-session-id' },
},
autoTrack: {
pageLifecycle: {
visitId: 'test-visit-id',
},
},
},
});

Expand Down Expand Up @@ -338,7 +362,7 @@ describe('Bugsnag utilities', () => {
maxBreadcrumbs: 40,
releaseStage: 'development',
user: {
id: 'dummy-source-id',
id: 'dummy-source-id..test-session-id..test-visit-id',
},
networkBreadcrumbsEnabled: false,
beforeSend: expect.any(Function),
Expand Down Expand Up @@ -377,7 +401,7 @@ describe('Bugsnag utilities', () => {
maxBreadcrumbs: 40,
releaseStage: 'development',
user: {
id: 'dummy-write-key',
id: 'dummy-write-key..test-session-id..test-visit-id',
},
networkBreadcrumbsEnabled: false,
beforeSend: expect.any(Function),
Expand Down Expand Up @@ -527,6 +551,14 @@ describe('Bugsnag utilities', () => {
installType: 'npm',
},
},
session: {
sessionInfo: { id: 'test-session-id' },
},
autoTrack: {
pageLifecycle: {
visitId: 'test-visit-id',
},
},
});
expect(error.severity).toBe('error');
expect(error.context).toBe('Script load failures');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ describe('Plugin - ErrorReporting', () => {
id: 'test-source-id',
config: {},
}),
session: {
sessionInfo: signal({ id: 'test-session-id' }),
},
autoTrack: {
pageLifecycle: {
visitId: signal('test-visit-id'),
},
},
};

let state: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,14 @@ describe('Error Reporting utilities', () => {
breadcrumbs: signal([]),
},
source: signal({ id: 'sample_source_id' }),
session: {
sessionInfo: signal({ id: 'test-session-id' }),
},
autoTrack: {
pageLifecycle: {
visitId: signal('test-visit-id'),
},
},
};
(window as any).RudderSnippetVersion = 'sample_snippet_version';
const enhancedError = getBugsnagErrorEvent(errorPayload, errorState, appState);
Expand Down Expand Up @@ -392,13 +400,23 @@ describe('Error Reporting utilities', () => {
source: {
id: 'sample_source_id',
},
session: {
sessionInfo: {
id: 'test-session-id',
},
},
autoTrack: {
pageLifecycle: {
visitId: 'test-visit-id',
},
},
},
source: {
snippetVersion: 'sample_snippet_version',
},
},
user: {
id: 'sample_source_id',
id: 'sample_source_id..test-session-id..test-visit-id',
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics-js-plugins/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rudderstack/analytics-js-plugins",
"version": "3.6.18",
"version": "3.6.19",
"private": true,
"description": "RudderStack JavaScript SDK plugins",
"main": "dist/npm/modern/cjs/index.cjs",
Expand Down
6 changes: 3 additions & 3 deletions packages/analytics-js-plugins/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"github": {
"executor": "@jscutlery/semver:github",
"options": {
"tag": "@rudderstack/[email protected].18",
"title": "@rudderstack/[email protected].18",
"discussion-category": "@rudderstack/[email protected].18",
"tag": "@rudderstack/[email protected].19",
"title": "@rudderstack/[email protected].19",
"discussion-category": "@rudderstack/[email protected].19",
"notesFile": "./packages/analytics-js-plugins/CHANGELOG_LATEST.md"
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/analytics-js-plugins/src/bugsnag/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ const getNewClient = (state: ApplicationState, logger?: ILogger): BugsnagLib.Cli
maxBreadcrumbs: 40,
releaseStage: getReleaseStage(),
user: {
id: state.source.value?.id || state.lifecycle.writeKey.value,
// Combination of source, session and visit ids
id: `${state.source.value?.id ?? (state.lifecycle.writeKey.value as string)}..${state.session.sessionInfo.value?.id ?? 'NA'}..${state.autoTrack?.pageLifecycle?.visitId?.value ?? 'NA'}`,
},
logger,
networkBreadcrumbsEnabled: false,
Expand Down
3 changes: 2 additions & 1 deletion packages/analytics-js-plugins/src/errorReporting/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ const getBugsnagErrorEvent = (
},
},
user: {
id: state.source.value?.id ?? (state.lifecycle.writeKey.value as string),
// Combination of source, session and visit ids
id: `${state.source.value?.id ?? (state.lifecycle.writeKey.value as string)}..${state.session.sessionInfo.value?.id ?? 'NA'}..${state.autoTrack?.pageLifecycle?.visitId?.value ?? 'NA'}`,
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics-js/.size-limit.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default [
name: 'Core - Legacy - NPM (CJS)',
path: 'dist/npm/legacy/cjs/index.cjs',
import: '*',
limit: '49 KiB',
limit: '49.1 KiB',
},
{
name: 'Core - Legacy - NPM (UMD)',
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sonar.qualitygate.wait=false
sonar.projectKey=rudderlabs_rudder-sdk-js
sonar.organization=rudderlabs
sonar.projectName=rudder-sdk-js
sonar.projectVersion=3.68.0
sonar.projectVersion=3.69.0

# Meta-data for the project
sonar.links.scm=https://github.com/rudderlabs/rudder-sdk-js
Expand Down
Loading