From d7b7f1e4084cb8cdd1bd54e585b85aa1b209ab6c Mon Sep 17 00:00:00 2001 From: Vinay Teki Date: Wed, 19 Feb 2025 18:06:31 +0530 Subject: [PATCH 1/3] chore: enabled and disable hosted alerts prs --- .../workflows/prepare-for-prod-dt-deploy.yml | 5 ++ .github/workflows/update-operator-alerts.yml | 56 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 .github/workflows/update-operator-alerts.yml diff --git a/.github/workflows/prepare-for-prod-dt-deploy.yml b/.github/workflows/prepare-for-prod-dt-deploy.yml index c3a9bd1a7e5..7cb90c5fe9b 100644 --- a/.github/workflows/prepare-for-prod-dt-deploy.yml +++ b/.github/workflows/prepare-for-prod-dt-deploy.yml @@ -150,6 +150,11 @@ jobs: gh pr create --fill + - name: Update Operator Alerts Configuration + uses: ./.github/workflows/update-operator-alerts.yml + with: + tag_name: ${{ needs.generate-tag-names.outputs.tag_name }} + - name: Update helm charts and raise pull request for enterprise customers on dedicated transformers env: GITHUB_TOKEN: ${{ secrets.PAT }} diff --git a/.github/workflows/update-operator-alerts.yml b/.github/workflows/update-operator-alerts.yml new file mode 100644 index 00000000000..a899c5666b6 --- /dev/null +++ b/.github/workflows/update-operator-alerts.yml @@ -0,0 +1,56 @@ +name: Update Operator Alerts Configuration + +on: + workflow_call: + inputs: + tag_name: + required: false + type: string + +jobs: + update-alerts: + runs-on: ubuntu-latest + steps: + - name: Checkout operator repo + uses: actions/checkout@v4.2.1 + with: + repository: rudderlabs/rudderstack-operator + token: ${{ secrets.PAT }} + fetch-depth: 1 + + - name: Initialize Git Config + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "noreply@github.com" + + - name: Set tag name + id: set_tag + run: | + if [ -z "${{ inputs.tag_name }}" ]; then + echo "tag=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT + else + echo "tag=${{ inputs.tag_name }}" >> $GITHUB_OUTPUT + fi + + - name: Create PR for enabled alerts + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + run: | + git checkout -b transformer-hosted-alerts-enabled-${{ steps.set_tag.outputs.tag }} + yq eval -i '.enabled_on_hosted="true"' operator-helm/alerts/cross-customer-pipelines/integrations/generic-transformation-errors.yaml + git add operator-helm/alerts/cross-customer-pipelines/integrations/generic-transformation-errors.yaml + git commit -m "chore: enable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" + git push -u origin transformer-alerts-enabled-${{ steps.set_tag.outputs.tag }} + gh pr create --title "Enable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" --body "Enable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" --base main + + - name: Create PR for disabled alerts + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + run: | + git checkout main + git checkout -b transformer-hosted-alerts-disabled-${{ steps.set_tag.outputs.tag }} + yq eval -i '.enabled_on_hosted="false"' operator-helm/alerts/cross-customer-pipelines/integrations/generic-transformation-errors.yaml + git add operator-helm/alerts/cross-customer-pipelines/integrations/generic-transformation-errors.yaml + git commit -m "chore: disable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" + git push -u origin transformer-alerts-disabled-${{ steps.set_tag.outputs.tag }} + gh pr create --title "Disable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" --body "Disable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" --base main \ No newline at end of file From 5dde82c40aa2767058a10e8d8cb3af080e722fd7 Mon Sep 17 00:00:00 2001 From: Vinay Teki Date: Wed, 19 Feb 2025 18:07:54 +0530 Subject: [PATCH 2/3] chore: enabled and disable hosted alerts prs --- .github/workflows/update-operator-alerts.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/update-operator-alerts.yml b/.github/workflows/update-operator-alerts.yml index a899c5666b6..829baad0cd3 100644 --- a/.github/workflows/update-operator-alerts.yml +++ b/.github/workflows/update-operator-alerts.yml @@ -6,6 +6,12 @@ on: tag_name: required: false type: string + workflow_dispatch: + inputs: + tag_name: + description: 'Tag name for the release (defaults to current date if empty)' + required: false + type: string jobs: update-alerts: From 2cc291d8f8f5abfc3849d32af52c665557669ee6 Mon Sep 17 00:00:00 2001 From: Vinay Teki Date: Wed, 19 Feb 2025 20:06:34 +0530 Subject: [PATCH 3/3] chore: better error handling for prs --- .github/workflows/update-operator-alerts.yml | 29 ++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-operator-alerts.yml b/.github/workflows/update-operator-alerts.yml index 829baad0cd3..f6b3d58aef0 100644 --- a/.github/workflows/update-operator-alerts.yml +++ b/.github/workflows/update-operator-alerts.yml @@ -42,21 +42,40 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.PAT }} run: | + git checkout master + git pull origin master git checkout -b transformer-hosted-alerts-enabled-${{ steps.set_tag.outputs.tag }} yq eval -i '.enabled_on_hosted="true"' operator-helm/alerts/cross-customer-pipelines/integrations/generic-transformation-errors.yaml git add operator-helm/alerts/cross-customer-pipelines/integrations/generic-transformation-errors.yaml git commit -m "chore: enable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" - git push -u origin transformer-alerts-enabled-${{ steps.set_tag.outputs.tag }} - gh pr create --title "Enable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" --body "Enable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" --base main + git push -u origin transformer-hosted-alerts-enabled-${{ steps.set_tag.outputs.tag }} + # Add error handling for PR creation + if gh pr create --title "chore: enable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" \ + --body "chore: enable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" \ + --base master; then + echo "PR created successfully" + else + echo "Failed to create PR, checking if changes exist" + exit 1 + fi - name: Create PR for disabled alerts env: GITHUB_TOKEN: ${{ secrets.PAT }} run: | - git checkout main + git checkout master + git pull origin master git checkout -b transformer-hosted-alerts-disabled-${{ steps.set_tag.outputs.tag }} yq eval -i '.enabled_on_hosted="false"' operator-helm/alerts/cross-customer-pipelines/integrations/generic-transformation-errors.yaml git add operator-helm/alerts/cross-customer-pipelines/integrations/generic-transformation-errors.yaml git commit -m "chore: disable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" - git push -u origin transformer-alerts-disabled-${{ steps.set_tag.outputs.tag }} - gh pr create --title "Disable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" --body "Disable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" --base main \ No newline at end of file + git push -u origin transformer-hosted-alerts-disabled-${{ steps.set_tag.outputs.tag }} + # Add error handling for PR creation + if gh pr create --title "chore: disable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" \ + --body "chore: disable transformer hosted alerts for release ${{ steps.set_tag.outputs.tag }}" \ + --base master; then + echo "PR created successfully" + else + echo "Failed to create PR, checking if changes exist" + exit 1 + fi \ No newline at end of file