Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:rudderlabs/rudder-transformer in…
Browse files Browse the repository at this point in the history
…to snyk-upgrade-e03378da281046b42c8ac4c560345112
  • Loading branch information
Sai Sankeerth committed Sep 3, 2024
2 parents 4c9a75b + 675ecf4 commit 86b3f5c
Show file tree
Hide file tree
Showing 623 changed files with 63,125 additions and 25,101 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ src/v0/destinations/personalize/scripts/
test/integrations/destinations/testTypes.d.ts
*.config*.js
scripts/skipPrepareScript.js
*.yaml
*.yml
.eslintignore
.prettierignore
*.json
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module",
"project": "./tsconfig.json"
"project": "./tsconfig.json",
"extraFileExtensions": [".yaml"]
},
"rules": {
"unicorn/filename-case": [
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build-pr-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- reopened
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
generate-tag-names:
runs-on: ubuntu-latest
Expand Down
83 changes: 71 additions & 12 deletions .github/workflows/build-push-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ on:
type: string
build_type:
type: string
use_merge_sha:
type: boolean
default: false
skip_tests:
type: boolean
default: false
description: if this option is true, we would skip tests while building docker image
workflow_url:
type: string
secrets:
DOCKERHUB_PROD_TOKEN:
required: true
Expand All @@ -31,27 +40,74 @@ env:
DOCKERHUB_USERNAME: rudderlabs

jobs:
get_sha:
runs-on: ubuntu-latest
name: Get SHA information
outputs:
sha: ${{steps.getSHA.outputs.SHA}}
steps:
- name: Checkout SHA
id: getSHA
run: |
if ${{inputs.use_merge_sha}} == true; then
sha=$(echo ${{github.sha}})
else
sha=$(echo ${{ github.event.pull_request.head.sha }})
fi
echo "SHA: $sha"
echo "SHA=$sha" >> $GITHUB_OUTPUT
get_changed_files:
runs-on: ubuntu-latest
name: Get Changed files
outputs:
should_execute_tests: ${{ steps.processing.outputs.should_execute_tests }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 1
- id: files
uses: Ana06/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
format: 'json'
- id: processing
run: |
readarray -t modified_files <<<"$(jq -r '.[]' <<<'${{ steps.files.outputs.modified }}')"
echo "Modified files: $modified_files"
found=false
for modified_file in "${modified_files[@]}"; do
if [[ "$modified_file" == "Dockerfile" || "$modified_file" == "docker-compose.yml" || "$modified_file" == "Dockerfile" || "$modified_file" == "Dockerfile-ut-func" ]]; then
found=true
break
fi
done
echo "Match Found: $found"
echo "::set-output name=should_execute_tests::$found"
build-transformer-image-arm64:
name: Build Transformer Docker Image ARM64
runs-on: [self-hosted, Linux, ARM64]
needs: [get_sha, get_changed_files]
steps:
- name: Checkout
uses: actions/[email protected]
with:
ref: ${{ github.event.pull_request.head.sha }}
ref: ${{ needs.get_sha.outputs.sha }}
fetch-depth: 1

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.0.0
uses: docker/setup-buildx-action@v3.6.1

- name: Login to DockerHub
uses: docker/login-action@v2.1.0
uses: docker/login-action@v3.3.0
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

- name: Build Docker Image
uses: docker/build-push-action@v5.1.0
uses: docker/build-push-action@v6.7.0
with:
context: .
file: ${{ inputs.dockerfile }}
Expand All @@ -62,12 +118,13 @@ jobs:
# cache-to: type=gha,mode=max

- name: Run Tests
if: ${{ inputs.skip_tests != true || needs.get_changed_files.outputs.should_execute_tests == true }}
run: |
docker run ${{ inputs.build_tag }} npm run test:js:ci
docker run ${{ inputs.build_tag }} npm run test:ts:ci
- name: Build and Push Multi-platform Images
uses: docker/build-push-action@v5.1.0
uses: docker/build-push-action@v6.7.0
with:
context: .
file: ${{ inputs.dockerfile }}
Expand All @@ -85,24 +142,25 @@ jobs:
build-transformer-image-amd64:
name: Build Transformer Docker Image AMD64
runs-on: [self-hosted, Linux, X64]
needs: [get_sha, get_changed_files]
steps:
- name: Checkout
uses: actions/[email protected]
with:
ref: ${{ github.event.pull_request.head.sha }}
ref: ${{ needs.get_sha.outputs.sha }}
fetch-depth: 1

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.0.0
uses: docker/setup-buildx-action@v3.6.1

- name: Login to DockerHub
uses: docker/login-action@v2.1.0
uses: docker/login-action@v3.3.0
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

- name: Build Docker Image
uses: docker/build-push-action@v5.1.0
uses: docker/build-push-action@v6.7.0
with:
context: .
file: ${{ inputs.dockerfile }}
Expand All @@ -113,12 +171,13 @@ jobs:
# cache-to: type=gha,mode=max

- name: Run Tests
if: ${{ inputs.skip_tests != true || needs.get_changed_files.outputs.should_execute_tests == true }}
run: |
docker run ${{ inputs.build_tag }} npm run test:js:ci
docker run ${{ inputs.build_tag }} npm run test:ts:ci
- name: Build and Push Multi-platform Images
uses: docker/build-push-action@v5.1.0
uses: docker/build-push-action@v6.7.0
with:
context: .
file: ${{ inputs.dockerfile }}
Expand All @@ -140,10 +199,10 @@ jobs:

steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.0.0
uses: docker/setup-buildx-action@v3.6.1

- name: Login to DockerHub
uses: docker/login-action@v2.1.0
uses: docker/login-action@v3.3.0
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
- reopened
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
check-pr-title:
name: Check PR Title
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Commitlint

on: [push]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
commitlint:
runs-on: ubuntu-latest
Expand All @@ -12,7 +16,7 @@ jobs:
fetch-depth: 0

- name: Setup Node
uses: actions/[email protected].1
uses: actions/[email protected].3
with:
node-version-file: '.nvmrc'
cache: 'npm'
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/component-test-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- reopened
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true

permissions:
id-token: write # allows the JWT to be requested from GitHub's OIDC provider
contents: read # This is required for actions/checkout
Expand All @@ -28,7 +32,7 @@ jobs:
fetch-depth: 1

- name: Setup Node
uses: actions/[email protected].2
uses: actions/[email protected].3
with:
node-version-file: '.nvmrc'
cache: 'npm'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/draft-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fetch-depth: 0

- name: Setup Node
uses: actions/[email protected].2
uses: actions/[email protected].3
with:
node-version-file: '.nvmrc'
cache: 'npm'
Expand Down
34 changes: 31 additions & 3 deletions .github/workflows/dt-test-and-report-code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,35 @@ on:
pull_request:
types: ['opened', 'reopened', 'synchronize']

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
get_workflow_url:
runs-on: ubuntu-latest
steps:
- id: get_url
run: |
curl -s https://api.github.com/repos/${{ github.repository }}/actions/workflows/${{ github.workflow }}/runs/${{ github.run_id }} | jq -r .html_url >> workflow_url.txt
echo "::set-output name=workflow_url::$(cat workflow_url.txt)"
outputs:
url: ${{ steps.get_url.outputs.workflow_url }}

coverage:
name: Code Coverage
runs-on: ubuntu-latest

needs: [get_workflow_url]
outputs:
tests_run_outcome: ${{steps.run_tests.outcome}}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 1

- name: Setup Node
uses: actions/[email protected].2
uses: actions/[email protected].3
with:
node-version-file: '.nvmrc'
cache: 'npm'
Expand All @@ -29,6 +45,8 @@ jobs:
run: npm ci

- name: Run Tests
id: run_tests
continue-on-error: true
run: |
# Supress logging in tests
LOG_LEVEL=100 npm run test:js:ci
Expand Down Expand Up @@ -62,7 +80,17 @@ jobs:
- name: SonarCloud Scan
if: always()
uses: SonarSource/sonarcloud-github-action@v2.1.1
uses: SonarSource/sonarcloud-github-action@v3.0.0
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

notify:
name: slack notification on failure
needs: [get_workflow_url, coverage]
if: needs.coverage.outputs.tests_run_outcome == 'failure' || failure()
uses: ./.github/workflows/slack-notify.yml
with:
workflow_url: ${{ needs.get_workflow_url.outputs.url }}
should_notify: ${{startsWith(github.event.pull_request.head.ref, 'hotfix-release/')}}
secrets: inherit
5 changes: 5 additions & 0 deletions .github/workflows/prepare-for-dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
branches:
- develop

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
report-coverage:
name: Report Code Coverage
Expand Down Expand Up @@ -56,6 +60,7 @@ jobs:
dockerfile: Dockerfile
load_target: development
push_target: production
use_merge_sha: true
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/prepare-for-prod-dt-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
report-coverage:
name: Report Code Coverage
Expand Down Expand Up @@ -53,6 +57,8 @@ jobs:
load_target: development
push_target: production
build_type: dt
use_merge_sha: true
skip_tests: ${{startsWith(github.event.pull_request.head.ref, 'hotfix-release/')}}
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/prepare-for-prod-ut-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
report-coverage:
name: Report Code Coverage
Expand Down Expand Up @@ -56,6 +60,8 @@ jobs:
load_target: development
push_target: production
build_type: ut
use_merge_sha: true
skip_tests: ${{startsWith(github.event.pull_request.head.ref, 'hotfix-release/')}}
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

Expand Down
Loading

0 comments on commit 86b3f5c

Please sign in to comment.