diff --git a/.github/workflows/build-pr-artifacts.yml b/.github/workflows/build-pr-artifacts.yml deleted file mode 100644 index 9938563bf0..0000000000 --- a/.github/workflows/build-pr-artifacts.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Build Artifacts for PRs - -on: - pull_request: - types: - - opened - - reopened - - synchronize - -jobs: - generate-tag-names: - runs-on: ubuntu-latest - name: Generate Tag Names - # Skip for the release pull requests as staging artifacts will be generated - if: startsWith(github.event.pull_request.head.ref, 'release/') != true && startsWith(github.event.pull_request.head.ref, 'hotfix-release/') != true && github.event.pull_request.head.ref != 'main' - outputs: - tag_name: ${{ steps.gen_tag_names.outputs.tag_name }} - tag_name_ut: ${{ steps.gen_tag_names.outputs.tag_name_ut }} - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 1 - - # Replace problematic characters in branch name (like '/') with safe characters (like '.') - - name: Generate Tag Names - id: gen_tag_names - run: | - tag_name=$(echo ${{ github.head_ref }} | tr "/" .) - echo "Tag Name: $tag_name" - echo "tag_name=$tag_name" >> $GITHUB_OUTPUT - - tag_name_ut="ut-$tag_name" - echo "UT Tag Name: $tag_name_ut" - echo "tag_name_ut=$tag_name_ut" >> $GITHUB_OUTPUT - - build-transformer-image: - name: Build Transformer Docker Image - PR - # Skip for the release pull requests as staging artifacts will be generated - # Skip main to develop sync pull requests - if: startsWith(github.event.pull_request.head.ref, 'release/') != true && startsWith(github.event.pull_request.head.ref, 'hotfix-release/') != true && github.event.pull_request.head.ref != 'main' - needs: [generate-tag-names] - uses: ./.github/workflows/build-push-docker-image.yml - with: - build_tag: rudderstack/develop-rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name }} - push_tags: rudderstack/develop-rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name }} - img_tag: ${{ needs.generate-tag-names.outputs.tag_name }} - dockerfile: Dockerfile - load_target: development - push_target: production - secrets: - DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }} - - build-user-transformer-image: - name: Build User Transformer Docker Image - PR - # Skip for the release pull requests as staging artifacts will be generated - if: startsWith(github.event.pull_request.head.ref, 'release/') != true && startsWith(github.event.pull_request.head.ref, 'hotfix-release/') != true && github.event.pull_request.head.ref != 'main' - needs: [generate-tag-names] - uses: ./.github/workflows/build-push-docker-image.yml - with: - build_tag: rudderstack/develop-rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name_ut }} - push_tags: rudderstack/develop-rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name_ut }} - img_tag: ${{ needs.generate-tag-names.outputs.tag_name_ut }} - dockerfile: Dockerfile-ut-func - load_target: development - push_target: production - secrets: - DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }} diff --git a/.github/workflows/build-push-docker-image.yml b/.github/workflows/build-push-docker-image.yml deleted file mode 100644 index 9f6709a040..0000000000 --- a/.github/workflows/build-push-docker-image.yml +++ /dev/null @@ -1,163 +0,0 @@ -name: Build Transformer Docker Image - -on: - workflow_call: - inputs: - build_tag: - required: true - type: string - push_tags: - required: true - type: string - img_tag: - required: true - type: string - dockerfile: - required: true - type: string - load_target: - required: true - type: string - push_target: - required: true - type: string - build_type: - type: string - secrets: - DOCKERHUB_PROD_TOKEN: - required: true - -env: - DOCKERHUB_USERNAME: rudderlabs - -jobs: - build-transformer-image-arm64: - name: Build Transformer Docker Image ARM64 - runs-on: [self-hosted, Linux, ARM64] - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 1 - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3.0.0 - - - name: Login to DockerHub - uses: docker/login-action@v2.1.0 - with: - username: ${{ env.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PROD_TOKEN }} - - - name: Build Docker Image - uses: docker/build-push-action@v5.1.0 - with: - context: . - file: ${{ inputs.dockerfile }} - target: ${{ inputs.load_target }} - load: true - tags: ${{ inputs.build_tag }} - # cache-from: type=gha - # cache-to: type=gha,mode=max - - - name: Run Tests - 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 - with: - context: . - file: ${{ inputs.dockerfile }} - target: ${{ inputs.push_target }} - push: true - tags: ${{ inputs.push_tags }}-arm64 - platforms: | - linux/arm64 - build-args: | - version=${{ inputs.img_tag }}-arm64 - GIT_COMMIT_SHA=${{ github.sha }} - # cache-from: type=gha - # cache-to: type=gha,mode=max - - build-transformer-image-amd64: - name: Build Transformer Docker Image AMD64 - runs-on: [self-hosted, Linux, X64] - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 1 - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3.0.0 - - - name: Login to DockerHub - uses: docker/login-action@v2.1.0 - with: - username: ${{ env.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PROD_TOKEN }} - - - name: Build Docker Image - uses: docker/build-push-action@v5.1.0 - with: - context: . - file: ${{ inputs.dockerfile }} - target: ${{ inputs.load_target }} - load: true - tags: ${{ inputs.build_tag }} - # cache-from: type=gha - # cache-to: type=gha,mode=max - - - name: Run Tests - 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 - with: - context: . - file: ${{ inputs.dockerfile }} - target: ${{ inputs.push_target }} - push: true - tags: ${{ inputs.push_tags }}-amd64 - platforms: | - linux/amd64 - build-args: | - version=${{ inputs.img_tag }}-amd64 - GIT_COMMIT_SHA=${{ github.sha }} - # cache-from: type=gha - # cache-to: type=gha,mode=max - - create-manifest: - name: Create multi-arch manifest - runs-on: ubuntu-latest - needs: [build-transformer-image-amd64, build-transformer-image-arm64] - - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3.0.0 - - - name: Login to DockerHub - uses: docker/login-action@v2.1.0 - with: - username: ${{ env.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PROD_TOKEN }} - - - name: Create multi-arch manifest - run: | - docker buildx imagetools create -t ${{ inputs.push_tags }} ${{ inputs.push_tags }}-amd64 ${{ inputs.push_tags }}-arm64 - - - name: Create latest multi-arch manifest - # To be triggered only for release/hotfix PR merges coming from `prepare-for-prod-dt-deploy.yaml` - if: ${{ inputs.build_type == 'dt' }} - run: | - docker buildx imagetools create -t rudderstack/rudder-transformer:latest ${{ inputs.push_tags }}-amd64 ${{ inputs.push_tags }}-arm64 - - - name: Create latest ut multi-arch manifest - # To be triggered only for release/hotfix PR merges coming from `prepare-for-prod-ut-deploy.yaml` - if: ${{ inputs.build_type == 'ut' }} - run: | - docker buildx imagetools create -t rudderstack/rudder-transformer:ut-latest ${{ inputs.push_tags }}-amd64 ${{ inputs.push_tags }}-arm64 diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml deleted file mode 100644 index 48098e276c..0000000000 --- a/.github/workflows/check-pr-title.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Check PR Title - -on: - pull_request: - types: - - opened - - edited - - reopened - - synchronize - -jobs: - check-pr-title: - name: Check PR Title - runs-on: ubuntu-latest - steps: - - name: Check PR Title - uses: rudderlabs/github-action-check-pr-title@v1.0.7 diff --git a/.github/workflows/create-hotfix-branch.yml b/.github/workflows/create-hotfix-branch.yml deleted file mode 100644 index a164c25bee..0000000000 --- a/.github/workflows/create-hotfix-branch.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Create New Hotfix Branch - -on: - workflow_dispatch: - inputs: - hotfix_name: - description: Hotfix branch name - required: true - -jobs: - create-branch: - name: Create New Hotfix Branch - runs-on: ubuntu-latest - - # Only allow these users to create new hotfix branch from 'main' - if: github.ref == 'refs/heads/main' && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'koladilip' || github.actor == 'saikumarrs' || github.actor == 'sandeepdsvs' || github.actor == 'shrouti1507' || github.actor == 'anantjain45823' || github.actor == 'chandumlg' || github.actor == 'mihir-4116' || github.actor == 'ujjwal-ab') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'saikumarrs' || github.triggering_actor == 'sandeepdsvs' || github.triggering_actor == 'koladilip' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'anantjain45823' || github.triggering_actor == 'chandumlg' || github.triggering_actor == 'mihir-4116' || github.triggering_actor == 'ujjwal-ab') - steps: - - name: Create Branch - uses: peterjgrainger/action-create-branch@v2.4.0 - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - with: - branch: 'hotfix/${{ inputs.hotfix_name }}' diff --git a/.github/workflows/draft-new-release.yml b/.github/workflows/draft-new-release.yml deleted file mode 100644 index 33b0396705..0000000000 --- a/.github/workflows/draft-new-release.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: Draft New Release - -on: workflow_dispatch - -jobs: - draft-new-release: - name: Draft New Release - runs-on: ubuntu-latest - - # Only allow release stakeholders to initiate releases - if: (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/')) && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'saikumarrs' || github.actor == 'sandeepdsvs' || github.actor == 'koladilip' || github.actor == 'shrouti1507' || github.actor == 'anantjain45823' || github.actor == 'chandumlg' || github.actor == 'mihir-4116' || github.actor == 'yashasvibajpai' || github.actor == 'sanpj2292' || github.actor == 'ujjwal-ab') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'koladilip' || github.triggering_actor == 'saikumarrs' || github.triggering_actor == 'sandeepdsvs' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'anantjain45823' || github.triggering_actor == 'chandumlg' || github.triggering_actor == 'mihir-4116' || github.triggering_actor == 'yashasvibajpai' || github.triggering_actor == 'sanpj2292' || github.triggering_actor == 'ujjwal-ab') - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 0 - - - name: Setup Node - uses: actions/setup-node@v4.0.1 - with: - node-version-file: '.nvmrc' - cache: 'npm' - - - name: Install Dependencies - env: - HUSKY: 0 - run: | - npm ci - - # In order to make a commit, we need to initialize a user. - # You may choose to write something less generic here if you want, it doesn't matter functionality wise. - - name: Initialize Mandatory Git Config - run: | - git config --global user.name "GitHub Actions" - git config --global user.email "noreply@github.com" - - # Calculate the next release version based on conventional semantic release - - name: Create Release Branch - id: create-release - env: - HUSKY: 0 - run: | - source_branch_name=${GITHUB_REF##*/} - release_type=release - grep -q "hotfix/" <<< "${GITHUB_REF}" && release_type=hotfix-release - git fetch origin main - git fetch --tags origin - git merge origin/main - current_version=$(jq -r .version package.json) - - npm run release -- --skip.commit --skip.tag --skip.changelog - new_version=$(jq -r .version package.json) - git reset --hard - - branch_name="${release_type}/v${new_version}" - - echo "Source branch for new release is $source_branch_name" - echo "Current version is $current_version" - echo "Release type is $release_type" - echo "New version is $new_version" - echo "New release branch name is $branch_name" - git checkout -b "$branch_name" - git push --set-upstream origin "$branch_name" - - echo "source_branch_name=$source_branch_name" >> $GITHUB_OUTPUT - echo "branch_name=$branch_name" >> $GITHUB_OUTPUT - echo "new_version=$new_version" >> $GITHUB_OUTPUT - echo "CURRENT_VERSION_VALUE=$current_version" >> $GITHUB_ENV - echo "NEW_VERSION_VALUE=$new_version" >> $GITHUB_ENV - - - name: Update Changelog & Bump Version - id: finish-release - run: | - echo "Current version: $CURRENT_VERSION_VALUE" - echo "New version: $NEW_VERSION_VALUE" - npx replace $CURRENT_VERSION_VALUE $NEW_VERSION_VALUE sonar-project.properties - git add sonar-project.properties - npm run release -- -a --skip.tag --no-verify - git push - - - name: Create Pull Request - uses: repo-sync/pull-request@v2.12.1 - with: - source_branch: ${{ steps.create-release.outputs.branch_name }} - destination_branch: 'main' - github_token: ${{ secrets.PAT }} - pr_title: 'chore(release): pull ${{ steps.create-release.outputs.branch_name }} into main' - pr_body: ':crown: *An automated PR*' diff --git a/.github/workflows/dt-test-and-report-code-coverage.yml b/.github/workflows/dt-test-and-report-code-coverage.yml deleted file mode 100644 index 4096227400..0000000000 --- a/.github/workflows/dt-test-and-report-code-coverage.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: DT Tests -on: - workflow_call: - secrets: - SONAR_TOKEN: - required: true - - pull_request: - types: ['opened', 'reopened', 'synchronize'] - -jobs: - coverage: - name: Code Coverage - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 1 - - - name: Setup Node - uses: actions/setup-node@v4.0.1 - with: - node-version-file: '.nvmrc' - cache: 'npm' - - - name: Install Dependencies - run: npm ci - - - name: Run Tests - run: | - # Supress logging in tests - LOG_LEVEL=100 npm run test:js:ci - LOG_LEVEL=100 npm run test:ts:ci - - - name: Run Lint Checks - run: | - npm run check:lint - npm run lint:fix - - - name: Upload Coverage Reports to Codecov - uses: codecov/codecov-action@v3.1.4 - with: - directory: ./reports/coverage - - - name: Upload TS Coverage Reports to Codecov - uses: codecov/codecov-action@v3.1.4 - with: - directory: ./reports/ts-coverage - - - name: Fix filesystem paths in generated reports - if: always() - run: | - sed -i 's+home/runner/work/rudder-transformer/rudder-transformer+/github/workspace+g' reports/coverage/lcov.info - sed -i 's+home/runner/work/rudder-transformer/rudder-transformer+/github/workspace+g' reports/ts-coverage/lcov.info - sed -i 's+/home/runner/work/rudder-transformer/rudder-transformer+/github/workspace+g' reports/eslint.json - - - name: SonarCloud Scan - if: always() - uses: SonarSource/sonarcloud-github-action@v2.1.1 - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/housekeeping.yml b/.github/workflows/housekeeping.yml deleted file mode 100644 index 388b80c15f..0000000000 --- a/.github/workflows/housekeeping.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Handle Stale PRs, Issues and Branches - -on: - schedule: - # Run everyday at 1 AM - - cron: '0 1 * * *' - workflow_dispatch: - -jobs: - prs: - name: Clean Up Stale PRs and Issues - runs-on: ubuntu-latest - - permissions: - pull-requests: write - - steps: - - uses: actions/stale@v9.0.0 - with: - repo-token: ${{ secrets.PAT }} - operations-per-run: 200 - stale-pr-message: 'This PR is considered to be stale. It has been open for 20 days with no further activity thus it is going to be closed in 7 days. To avoid such a case please consider removing the stale label manually or add a comment to the PR.' - stale-issue-message: 'This issue is considered to be stale. It has been open for 30 days with no further activity thus it is going to be closed in 7 days. To avoid such a case please consider removing the stale label manually or add a comment to the issue.' - days-before-pr-stale: 20 - days-before-pr-close: 7 - days-before-issue-stale: 30 - days-before-issue-close: 7 - stale-pr-label: 'Stale' - stale-issue-label: 'Stale' - - branches: - name: Cleanup Stale Branches - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - - - name: Delete Old Branches - uses: beatlabs/delete-old-branches-action@v0.0.10 - with: - repo_token: ${{ secrets.PAT }} - date: '3 months ago' - dry_run: false - delete_tags: false - extra_protected_branch_regex: ^(main|develop)$ - exclude_open_pr_branches: true diff --git a/.github/workflows/prepare-for-dev-deploy.yml b/.github/workflows/prepare-for-dev-deploy.yml deleted file mode 100644 index cf97772e2e..0000000000 --- a/.github/workflows/prepare-for-dev-deploy.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Prepare for Dev Environment Deployment - -on: - push: - branches: - - develop - pull_request: - types: - - closed - branches: - - develop - -jobs: - report-coverage: - name: Report Code Coverage - if: github.event_name == 'push' - uses: ./.github/workflows/report-code-coverage.yml - secrets: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - generate-tag-names: - runs-on: ubuntu-latest - name: Generate Tag Names - # Only merged pull requests must trigger - if: github.event.pull_request.merged == true - outputs: - tag_name: ${{ steps.gen_tag_names.outputs.tag_name }} - tag_name_ut: ${{ steps.gen_tag_names.outputs.tag_name_ut }} - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 1 - - - name: Generate Tag Names - id: gen_tag_names - run: | - tag_name="latest" - echo "Tag Name: $tag_name" - echo "tag_name=$tag_name" >> $GITHUB_OUTPUT - - tag_name_ut="ut-$tag_name" - echo "UT Tag Name: $tag_name_ut" - echo "tag_name_ut=$tag_name_ut" >> $GITHUB_OUTPUT - - build-transformer-image: - name: Build Transformer Docker Image - Dev - # Only merged pull requests must trigger - if: github.event.pull_request.merged == true - needs: [generate-tag-names] - uses: ./.github/workflows/build-push-docker-image.yml - with: - build_tag: rudderstack/develop-rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name }} - push_tags: rudderstack/develop-rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name }} - img_tag: ${{ needs.generate-tag-names.outputs.tag_name }} - dockerfile: Dockerfile - load_target: development - push_target: production - secrets: - DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }} - - build-user-transformer-image: - name: Build User Transformer Docker Image - Dev - # Only merged pull requests must trigger - if: github.event.pull_request.merged == true - needs: [generate-tag-names] - uses: ./.github/workflows/build-push-docker-image.yml - with: - build_tag: rudderstack/develop-rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name_ut }} - push_tags: rudderstack/develop-rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name_ut }} - img_tag: ${{ needs.generate-tag-names.outputs.tag_name_ut }} - dockerfile: Dockerfile-ut-func - load_target: development - push_target: production - secrets: - DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }} diff --git a/.github/workflows/prepare-for-prod-dt-deploy.yml b/.github/workflows/prepare-for-prod-dt-deploy.yml deleted file mode 100644 index 9669e1bc2c..0000000000 --- a/.github/workflows/prepare-for-prod-dt-deploy.yml +++ /dev/null @@ -1,146 +0,0 @@ -name: Prepare for DT Production Environment Deployment - -on: - push: - branches: - - main - pull_request: - types: - - closed - branches: - - main - -jobs: - report-coverage: - name: Report Code Coverage - if: github.event_name == 'push' - uses: ./.github/workflows/report-code-coverage.yml - secrets: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - generate-tag-names: - runs-on: ubuntu-latest - name: Generate Tag Names - # Only merged pull requests from release candidate branches must trigger - if: ((startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/')) && github.event.pull_request.merged == true) - outputs: - tag_name: ${{ steps.gen_tag_names.outputs.tag_name }} - tag_name_ut: ${{ steps.gen_tag_names.outputs.tag_name_ut }} - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 1 - - - name: Generate Tag Names - id: gen_tag_names - run: | - tag_name=$(jq -r .version package.json) - echo "Tag Name: $tag_name" - echo "tag_name=$tag_name" >> $GITHUB_OUTPUT - - build-transformer-image: - name: Build Transformer Docker Image - Prod - # Only merged pull requests from release candidate branches must trigger - if: ((startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/')) && github.event.pull_request.merged == true) - needs: [generate-tag-names] - uses: ./.github/workflows/build-push-docker-image.yml - with: - build_tag: rudderstack/rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name }} - push_tags: rudderstack/rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name }} - img_tag: ${{ needs.generate-tag-names.outputs.tag_name }} - dockerfile: Dockerfile - load_target: development - push_target: production - build_type: dt - secrets: - DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }} - - create-pull-request: - name: Update Helm Charts For Production and Create Pull Request - runs-on: ubuntu-latest - needs: [generate-tag-names, build-transformer-image] - env: - TAG_NAME: ${{ needs.generate-tag-names.outputs.tag_name }} - TF_IMAGE_REPOSITORY: rudderstack/rudder-transformer - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 1 - - # In order to make a commit, we need to initialize a user. - # You may choose to write something less generic here if you want, it doesn't matter functionality wise. - - name: Initialize Mandatory Git Config - run: | - git config --global user.name "GitHub Actions" - git config --global user.email "noreply@github.com" - - - name: Print Docker Image Tags - run: | - echo "Transformer: $TAG_NAME" - - - name: Clone Devops Repo - run: | - git clone https://${{secrets.PAT}}@github.com/rudderlabs/rudder-devops.git - - - name: Extract branch name - id: extract_branch_name - run: | - cd rudder-devops - branch_name=$(git rev-parse --abbrev-ref HEAD) - echo "branch_name=$branch_name" - echo "branch_name=$branch_name" >> $GITHUB_OUTPUT - - - name: Update Helm Charts and Raise Pull Request - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - run: | - cd rudder-devops - git checkout -b shared-transformer-$TAG_NAME - - cd helm-charts/shared-services/per-az/environment/production - yq eval -i ".rudder-transformer.image.tag=\"$TAG_NAME\"" production.yaml - yq eval -i ".user-transformer.image.tag=\"$TAG_NAME\"" production.yaml - yq eval -i ".rudder-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" production.yaml - yq eval -i ".user-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" production.yaml - git add production.yaml - - yq eval -i ".rudder-transformer.image.tag=\"$TAG_NAME\"" enterprise/enterprise.yaml - yq eval -i ".user-transformer.image.tag=\"$TAG_NAME\"" enterprise/enterprise.yaml - yq eval -i ".rudder-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" enterprise/enterprise.yaml - yq eval -i ".user-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" enterprise/enterprise.yaml - git add enterprise/enterprise.yaml - - yq eval -i ".rudder-transformer.image.tag=\"$TAG_NAME\"" multi-tenant/multi-tenant.yaml - yq eval -i ".user-transformer.image.tag=\"$TAG_NAME\"" multi-tenant/multi-tenant.yaml - yq eval -i ".rudder-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" multi-tenant/multi-tenant.yaml - yq eval -i ".user-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" multi-tenant/multi-tenant.yaml - git add multi-tenant/multi-tenant.yaml - - cd ../../../../config-be-rudder-transformer - yq eval -i ".config-be-rudder-transformer.image.tag=\"$TAG_NAME\"" values.prod.yaml - yq eval -i ".config-be-rudder-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" values.prod.yaml - git add values.prod.yaml - - git commit -m "chore: upgrade shared transformers to $TAG_NAME" - git push -u origin shared-transformer-$TAG_NAME - - gh pr create --fill - - - name: Update Helm Chart and Raise Pull Request For Hosted Transformer - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - run: | - cd rudder-devops - git checkout -b hosted-transformer-$TAG_NAME ${{steps.extract_branch_name.outputs.branch_name}} - - cd customer-objects/multi-tenant-us - yq eval -i ".spec.transformer.image.version=\"$TAG_NAME\"" hostedmtedmt.yaml - yq eval -i ".spec.transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" hostedmtedmt.yaml - git add hostedmtedmt.yaml - - git commit -m "chore: upgrade hosted transformer to $TAG_NAME" - git push -u origin hosted-transformer-$TAG_NAME - - gh pr create --fill diff --git a/.github/workflows/prepare-for-prod-rollback.yml b/.github/workflows/prepare-for-prod-rollback.yml deleted file mode 100644 index 9ac144a21e..0000000000 --- a/.github/workflows/prepare-for-prod-rollback.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Prepare for Rollback in Production Environment - -on: - workflow_dispatch: - -jobs: - create-rollback-pr: - name: Update Helm Charts For Production and Create Pull Request - runs-on: ubuntu-latest - - # Only allow to be deployed from tags and main branch - # Only allow specific actors to trigger - if: (startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/main')) && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'saikumarrs' || github.actor == 'chandumlg') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'saikumarrs' || github.triggering_actor == 'chandumlg') - - steps: - - name: Get Target Version - id: target-version - run: | - version=${{ github.ref_name }} - echo "tag_name=$version" >> $GITHUB_OUTPUT - echo "Target Version: $tag_name" - - # In order to make a commit, we need to initialize a user. - # You may choose to write something less generic here if you want, it doesn't matter functionality wise. - - name: Initialize Mandatory Git Config - run: | - git config --global user.name "GitHub Actions" - git config --global user.email "noreply@github.com" - - - 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 }} - - cd helm-charts/shared-services/per-az - yq eval -i ".rudder-transformer.image.tag=\"${{ steps.target-version.outputs.tag_name }}\"" values.blue-release.yaml - yq eval -i ".user-transformer.image.tag=\"${{ steps.target-version.outputs.tag_name }}\"" values.blue-release.yaml - git add values.blue-release.yaml - - yq eval -i ".rudder-transformer.image.tag=\"${{ steps.target-version.outputs.tag_name }}\"" values.enterprise.yaml - yq eval -i ".user-transformer.image.tag=\"${{ steps.target-version.outputs.tag_name }}\"" values.enterprise.yaml - git add values.enterprise.yaml - - yq eval -i ".rudder-transformer.image.tag=\"${{ steps.target-version.outputs.tag_name }}\"" values.multi-tenant.yaml - yq eval -i ".user-transformer.image.tag=\"${{ steps.target-version.outputs.tag_name }}\"" values.multi-tenant.yaml - git add values.multi-tenant.yaml - - cd ../../config-be-rudder-transformer - yq eval -i ".config-be-rudder-transformer.image.tag=\"${{ steps.target-version.outputs.tag_name }}\"" values.prod.yaml - yq eval -i ".config-be-user-transformer.image.tag=\"${{ steps.target-version.outputs.tag_name }}\"" values.prod.yaml - git add values.prod.yaml - - git commit -m "chore: rollback shared transformers to ${{ steps.target-version.outputs.tag_name }}" - git push -u origin shared-transformer-rollback-${{ steps.target-version.outputs.tag_name }} - - gh pr create --fill diff --git a/.github/workflows/prepare-for-prod-ut-deploy.yml b/.github/workflows/prepare-for-prod-ut-deploy.yml deleted file mode 100644 index ea5928f3b2..0000000000 --- a/.github/workflows/prepare-for-prod-ut-deploy.yml +++ /dev/null @@ -1,131 +0,0 @@ -name: Prepare for UT Production Environment Deployment - -on: - push: - branches: - - main - pull_request: - types: - - closed - branches: - - main - -jobs: - report-coverage: - name: Report Code Coverage - if: github.event_name == 'push' - uses: ./.github/workflows/report-code-coverage.yml - secrets: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - generate-tag-names: - runs-on: ubuntu-latest - name: Generate Tag Names - # Only merged pull requests from release candidate branches must trigger - if: ((startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/')) && github.event.pull_request.merged == true) - outputs: - tag_name_ut: ${{ steps.gen_tag_names.outputs.tag_name_ut }} - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 1 - - - name: Generate Tag Names - id: gen_tag_names - run: | - tag_name=$(jq -r .version package.json) - echo "Tag Name: $tag_name" - echo "tag_name=$tag_name" >> $GITHUB_OUTPUT - - tag_name_ut="ut-$tag_name" - echo "UT Tag Name: $tag_name_ut" - echo "tag_name_ut=$tag_name_ut" >> $GITHUB_OUTPUT - - build-user-transformer-image: - name: Build User Transformer Docker Image - Prod - # Only merged pull requests from release candidate branches must trigger - if: ((startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/')) && github.event.pull_request.merged == true) - needs: [generate-tag-names] - uses: ./.github/workflows/build-push-docker-image.yml - with: - build_tag: rudderstack/rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name_ut }} - push_tags: rudderstack/rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name_ut }} - img_tag: ${{ needs.generate-tag-names.outputs.tag_name_ut }} - dockerfile: Dockerfile-ut-func - load_target: development - push_target: production - build_type: ut - secrets: - DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }} - - create-pull-request: - name: Update Helm Charts For Production and Create Pull Request - runs-on: ubuntu-latest - needs: [generate-tag-names, build-user-transformer-image] - env: - UT_TAG_NAME: ${{ needs.generate-tag-names.outputs.tag_name_ut }} - TF_IMAGE_REPOSITORY: rudderstack/rudder-transformer - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 1 - - # In order to make a commit, we need to initialize a user. - # You may choose to write something less generic here if you want, it doesn't matter functionality wise. - - name: Initialize Mandatory Git Config - run: | - git config --global user.name "GitHub Actions" - git config --global user.email "noreply@github.com" - - - name: Print Docker Image Tags - run: | - echo "User Transformer: $UT_TAG_NAME" - - - name: Clone Devops Repo - run: | - git clone https://${{secrets.PAT}}@github.com/rudderlabs/rudder-devops.git - - - name: Extract branch name - id: extract_branch_name - run: | - cd rudder-devops - branch_name=$(git rev-parse --abbrev-ref HEAD) - echo "branch_name=$branch_name" - echo "branch_name=$branch_name" >> $GITHUB_OUTPUT - - - name: Update Helm Charts and Raise Pull Request - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - run: | - cd rudder-devops - git checkout -b shared-user-transformer-$UT_TAG_NAME - - cd helm-charts/config-be-rudder-transformer - - yq eval -i ".config-be-user-transformer.image.tag=\"$UT_TAG_NAME\"" values.prod.yaml - yq eval -i ".config-be-user-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" values.prod.yaml - git add values.prod.yaml - - git commit -m "chore: upgrade shared user-transformers to $UT_TAG_NAME" - git push -u origin shared-user-transformer-$UT_TAG_NAME - - gh pr create --fill - - - name: Update Helm Chart and Raise Pull Request For Hosted Transformer - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - run: | - cd rudder-devops - git checkout -b hosted-user-transformer-$UT_TAG_NAME ${{steps.extract_branch_name.outputs.branch_name}} - - cd customer-objects/multi-tenant-us - yq eval -i ".spec.user_transformer.image.version=\"$UT_TAG_NAME\"" hostedmtedmt.yaml - yq eval -i ".spec.user_transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" hostedmtedmt.yaml - git add hostedmtedmt.yaml - - git commit -m "chore: upgrade hosted user-transformer to $UT_TAG_NAME" - git push -u origin hosted-user-transformer-$UT_TAG_NAME - - gh pr create --fill diff --git a/.github/workflows/prepare-for-staging-deploy.yml b/.github/workflows/prepare-for-staging-deploy.yml deleted file mode 100644 index 4e8f29cffa..0000000000 --- a/.github/workflows/prepare-for-staging-deploy.yml +++ /dev/null @@ -1,124 +0,0 @@ -name: Prepare for Staging Environment Deployment - -on: - pull_request: - types: - - opened - - reopened - - synchronize - branches: - - main - -jobs: - generate-tag-names: - runs-on: ubuntu-latest - name: Generate Tag Names - # Only pull requests from release candidate branches must trigger - if: (startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/')) - outputs: - tag_name: ${{ steps.gen_tag_names.outputs.tag_name }} - tag_name_ut: ${{ steps.gen_tag_names.outputs.tag_name_ut }} - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 1 - - - name: Generate Tag Names - id: gen_tag_names - run: | - tag_name="staging-$(jq -r .version package.json)" - echo "Tag Name: $tag_name" - echo "tag_name=$tag_name" >> $GITHUB_OUTPUT - - tag_name_ut="ut-$tag_name" - echo "UT Tag Name: $tag_name_ut" - echo "tag_name_ut=$tag_name_ut" >> $GITHUB_OUTPUT - - build-transformer-image: - name: Build Transformer Docker Image - Staging - # Only pull requests from release candidate branches must trigger - if: (startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/')) - needs: [generate-tag-names] - uses: ./.github/workflows/build-push-docker-image.yml - with: - build_tag: rudderstack/rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name }} - push_tags: rudderstack/rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name }} - img_tag: ${{ needs.generate-tag-names.outputs.tag_name }} - dockerfile: Dockerfile - load_target: development - push_target: production - secrets: - DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }} - - build-user-transformer-image: - name: Build User Transformer Docker Image - Staging - # Only pull requests from release candidate branches must trigger - if: (startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/')) - - needs: [generate-tag-names] - uses: ./.github/workflows/build-push-docker-image.yml - with: - build_tag: rudderstack/rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name_ut }} - push_tags: rudderstack/rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name_ut }} - img_tag: ${{ needs.generate-tag-names.outputs.tag_name_ut }} - dockerfile: Dockerfile-ut-func - load_target: development - push_target: production - secrets: - DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }} - - - create-pull-request: - name: Update Helm Charts For Staging and Create Pull Request - runs-on: ubuntu-latest - needs: [generate-tag-names, build-transformer-image, build-user-transformer-image] - env: - TAG_NAME: ${{ needs.generate-tag-names.outputs.tag_name }} - UT_TAG_NAME: ${{ needs.generate-tag-names.outputs.tag_name_ut }} - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 1 - - # In order to make a commit, we need to initialize a user. - # You may choose to write something less generic here if you want, it doesn't matter functionality wise. - - name: Initialize Mandatory Git Config - run: | - git config --global user.name "GitHub Actions" - git config --global user.email "noreply@github.com" - - - name: Print Docker Image Tags - run: | - echo "Transformer: $TAG_NAME" - echo "User Transformer: $UT_TAG_NAME" - - - 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 - BRANCH_NAME="shared-transformer-$TAG_NAME" - echo $BRANCH_NAME - if [ `git ls-remote --heads origin $BRANCH_NAME 2>/dev/null` ] - then - echo "Staging deployment branch already exists!" - else - git checkout -b $BRANCH_NAME - - cd helm-charts/shared-services/per-az/environment/staging - yq eval -i ".rudder-transformer.image.tag=\"$TAG_NAME\"" staging.yaml - yq eval -i ".user-transformer.image.tag=\"$TAG_NAME\"" staging.yaml - git add staging.yaml - - cd ../../../../config-be-rudder-transformer - yq eval -i ".config-be-rudder-transformer.image.tag=\"$TAG_NAME\"" values.staging.yaml - yq eval -i ".config-be-user-transformer.image.tag=\"$TAG_NAME\"" values.staging.yaml - git add values.staging.yaml - - git commit -m "chore: upgrade staging env transformers to \"$TAG_NAME\"" - git push -u origin $BRANCH_NAME - gh pr create --fill - fi diff --git a/.github/workflows/publish-new-release.yml b/.github/workflows/publish-new-release.yml deleted file mode 100644 index 9d1558d826..0000000000 --- a/.github/workflows/publish-new-release.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: Publish New GitHub Release - -on: - pull_request: - types: - - closed - branches: - - main - -jobs: - release: - name: Publish New GitHub Release - runs-on: ubuntu-latest - - if: (startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/')) && github.event.pull_request.merged == true # only merged pull requests must trigger this job - - steps: - - name: Extract Version - id: extract-version - run: | - branch_name="${{ github.event.pull_request.head.ref }}" - version=${branch_name#hotfix-} - version=${version#release/v} - - echo "release_version=$version" >> $GITHUB_OUTPUT - - - name: Checkout - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 0 - - - name: Setup Node - uses: actions/setup-node@v4.0.1 - with: - node-version-file: '.nvmrc' - cache: 'npm' - - - name: Install Dependencies - env: - HUSKY: 0 - run: | - npm ci - - # In order to make a commit, we need to initialize a user. - # You may choose to write something less generic here if you want, it doesn't matter functionality wise. - - name: Initialize Mandatory Git Config - run: | - git config --global user.name "GitHub Actions" - git config --global user.email "noreply@github.com" - - - name: Tag & Create GitHub Release - id: create_release - continue-on-error: true - env: - HUSKY: 0 - GITHUB_TOKEN: ${{ secrets.PAT }} - CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.PAT }} - run: | - git fetch --tags origin - git tag -a v${{ steps.extract-version.outputs.release_version }} -m "chore: release v${{ steps.extract-version.outputs.release_version }}" - git push origin refs/tags/v${{ steps.extract-version.outputs.release_version }} - npm run release:github - echo "DATE=$(date)" >> $GITHUB_ENV - - - name: Pull Changes Into develop Branch - uses: repo-sync/pull-request@v2.12.1 - with: - source_branch: 'main' - destination_branch: 'develop' - github_token: ${{ secrets.PAT }} - pr_title: 'chore(release): pull main into develop post release v${{ steps.extract-version.outputs.release_version }}' - pr_body: ':crown: *An automated PR*' - - - name: Delete Release Branch - uses: koj-co/delete-merged-action@master - if: startsWith(github.event.pull_request.head.ref, 'release/') - with: - branches: 'release/*' - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - - - name: Delete Hotfix Release Branch - uses: koj-co/delete-merged-action@master - if: startsWith(github.event.pull_request.head.ref, 'hotfix-release/') - with: - branches: 'hotfix-release/*' - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - - - name: Notify Slack Channel - id: slack - uses: slackapi/slack-github-action@v1.24.0 - continue-on-error: true - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - PROJECT_NAME: 'Rudder Transformer' - RELEASES_URL: 'https://github.com/rudderlabs/rudder-transformer/releases/tag/' - with: - channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }} - payload: | - { - "text": "*<${{env.RELEASES_URL}}v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\nCC: <@U03KG4BK1L1> <@U02AE5GMMHV> <@U01LVJ30QEB>", - "blocks": [ - { - "type": "header", - "text": { - "type": "plain_text", - "text": ":tada: ${{ env.PROJECT_NAME }} - New GitHub Release :tada:" - } - }, - { - "type": "divider" - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*<${{env.RELEASES_URL}}v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\nCC: <@U03KG4BK1L1> <@U02AE5GMMHV> <@U01LVJ30QEB>" - } - } - ] - } diff --git a/.github/workflows/ut-tests.yml b/.github/workflows/ut-tests.yml deleted file mode 100644 index 530a532325..0000000000 --- a/.github/workflows/ut-tests.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: Tests - -on: - pull_request: - types: - - opened - - reopened - - synchronize - -jobs: - ut_tests: - name: UT Tests - runs-on: ubuntu-latest - steps: - - name: Setup Go - uses: actions/setup-go@v4.1.0 - with: - go-version: 1.17 - - - name: Install Latest Version of Kind - run: go install sigs.k8s.io/kind@v0.17.0 - - - name: Checkout - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 1 - - - name: Setup Node - uses: actions/setup-node@v4.0.1 - with: - node-version-file: '.nvmrc' - cache: 'npm' - - - name: Install Dependencies - run: npm ci - - - name: Create Kind cluster - run: kind create cluster --name kind-cluster --config=test/__tests__/data/worker-nodes-kind.yml - - - name: Create OpenFaaS Namespaces - run: kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml - - - name: Setup Helm - uses: azure/setup-helm@v3 - with: - version: v3.10.0 - - - name: Add OpenFaaS Helm Chart - run: helm repo add openfaas https://openfaas.github.io/faas-netes/ - - - name: Deploy OpenFaaS Helm Chart - run: | - helm repo update \ - && helm upgrade openfaas --install openfaas/openfaas \ - --namespace openfaas \ - --set functionNamespace=openfaas-fn \ - --set basic_auth=false \ - --set generateBasicAuth=false \ - --set ceScaling=true \ - --set async=false \ - --set openfaasImagePullPolicy=IfNotPresent \ - --set gateway.image=rudderlabs/rudder-openfaas-gateway:0.25.2 \ - --set faasnetes.image=rudderlabs/rudder-openfaas-faas-netes:0.15.4 - - - name: Wait for deployment "gateway" rollout - run: kubectl rollout status deploy/gateway --timeout 120s -n openfaas - - - run: kubectl get events -n openfaas - - run: kubectl get pods -n openfaas - - - name: Port Forwarding to port on gateway-external - run: kubectl port-forward service/gateway-external 8080:8080 -n openfaas & - - - name: User Transformation Tests - run: npm run test:ut:integration:ci diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml index 7f87f30795..b11610342d 100644 --- a/.github/workflows/verify.yaml +++ b/.github/workflows/verify.yaml @@ -15,11 +15,12 @@ jobs: # Make sure the actual branch is checked out when running on pull requests ref: ${{ github.head_ref }} - #- name: Prettify code - # uses: creyD/prettier_action@v4.3 - # with: + - name: Prettify code + uses: creyD/prettier_action@v4.3 + with: # This part is also where you can pass other options, for example: - # prettier_options: --write **/*.{js,md} + #prettier_options: --write **/*.{js,md} + dry: true #- run: git diff --exit-code #- name: Error message