diff --git a/.github/workflows/monitor-config.json b/.github/workflows/monitor-config.json index 6f35882143..b5fe7ed723 100644 --- a/.github/workflows/monitor-config.json +++ b/.github/workflows/monitor-config.json @@ -1,30 +1,10 @@ { "core": { "generateCommand": "generateCoreChainsToMonitor", - "configFile": "__auto-generated-core-chains.json", - "slackTokens": { - "assertion": "CORE_CHAIN_ASSERTION_MONITORING_SLACK_TOKEN", - "batch-poster": "CORE_CHAIN_BATCH_POSTER_MONITORING_SLACK_TOKEN", - "retryable": "CORE_CHAIN_RETRYABLE_MONITORING_SLACK_TOKEN" - }, - "slackChannels": { - "assertion": "CORE_CHAIN_ASSERTION_MONITORING_SLACK_CHANNEL", - "batch-poster": "CORE_CHAIN_BATCH_POSTER_MONITORING_SLACK_CHANNEL", - "retryable": "CORE_CHAIN_RETRYABLE_MONITORING_SLACK_CHANNEL" - } + "configFile": "__auto-generated-core-chains.json" }, "orbit": { "generateCommand": "generateOrbitChainsToMonitor", - "configFile": "__auto-generated-orbit-chains.json", - "slackTokens": { - "assertion": "ORBIT_CHAIN_ASSERTION_MONITORING_SLACK_TOKEN", - "batch-poster": "ORBIT_CHAIN_BATCH_POSTER_MONITORING_SLACK_TOKEN", - "retryable": "ORBIT_RETRYABLE_MONITORING_SLACK_TOKEN" - }, - "slackChannels": { - "assertion": "ORBIT_CHAIN_ASSERTION_MONITORING_SLACK_CHANNEL", - "batch-poster": "ORBIT_CHAIN_BATCH_POSTER_MONITORING_SLACK_CHANNEL", - "retryable": "ORBIT_RETRYABLE_MONITORING_SLACK_CHANNEL" - } + "configFile": "__auto-generated-orbit-chains.json" } } diff --git a/.github/workflows/monitoring.yml b/.github/workflows/monitoring.yml index 8ef55910ac..4af2017e34 100644 --- a/.github/workflows/monitoring.yml +++ b/.github/workflows/monitoring.yml @@ -1,24 +1,30 @@ -name: Monitoring +name: Reusable Monitoring Workflow on: - push: - workflow_dispatch: - schedule: - - cron: "0 */6 * * *" # Run every 6 hours + workflow_call: + inputs: + chain: + required: true + type: string + monitor: + required: true + type: string env: NEXT_PUBLIC_INFURA_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_KEY }} NOVA_MONITOR_RPC_URL: ${{ secrets.NOVA_MONITOR_RPC_URL }} ARB_ONE_MONITOR_RPC_URL: ${{ secrets.ARB_ONE_MONITOR_RPC_URL }} NODE_ENV: "CI" + RETRYABLE_MONITORING_SLACK_TOKEN: ${{ secrets.RETRYABLE_MONITORING_SLACK_TOKEN }} + RETRYABLE_MONITORING_SLACK_CHANNEL: ${{ secrets.RETRYABLE_MONITORING_SLACK_CHANNEL }} + BATCH_POSTER_MONITORING_SLACK_TOKEN: ${{ secrets.BATCH_POSTER_MONITORING_SLACK_TOKEN }} + BATCH_POSTER_MONITORING_SLACK_CHANNEL: ${{ secrets.BATCH_POSTER_MONITORING_SLACK_CHANNEL }} + ASSERTION_MONITORING_SLACK_TOKEN: ${{ secrets.ASSERTION_MONITORING_SLACK_TOKEN }} + ASSERTION_MONITORING_SLACK_CHANNEL: ${{ secrets.ASSERTION_MONITORING_SLACK_CHANNEL }} jobs: run-monitoring: runs-on: ubuntu-latest - strategy: - matrix: - chain: [core, orbit] - monitor: [assertion, batch-poster, retryable] steps: - name: Checkout repositories uses: actions/checkout@v4 @@ -43,25 +49,17 @@ jobs: - name: Load configuration id: config run: | - CONFIG=$(cat .github/workflows/monitor-config.json | jq -r '.${{ matrix.chain }}') + CONFIG=$(cat .github/workflows/monitor-config.json | jq -r '.${{ inputs.chain }}') echo "generate_command=$(echo $CONFIG | jq -r '.generateCommand')" >> $GITHUB_OUTPUT echo "config_file=$(echo $CONFIG | jq -r '.configFile')" >> $GITHUB_OUTPUT - echo "slack_token=$(echo $CONFIG | jq -r '.slackTokens.${{ matrix.monitor }}')" >> $GITHUB_OUTPUT - echo "slack_channel=$(echo $CONFIG | jq -r '.slackChannels.${{ matrix.monitor }}')" >> $GITHUB_OUTPUT - name: Generate chains JSON run: yarn workspace arb-token-bridge-ui ${{ steps.config.outputs.generate_command }} env: - BATCH_POSTER_MONITORING: ${{ matrix.monitor == 'batch-poster' }} + BATCH_POSTER_MONITORING: ${{ inputs.monitor == 'batch-poster' }} - name: Copy chains JSON to Arbitrum Monitoring - run: cp ./packages/arb-token-bridge-ui/public/${{ steps.config.outputs.config_file }} ./arbitrum-monitoring/packages/${{ matrix.monitor }}-monitor/config.json + run: cp ./packages/arb-token-bridge-ui/public/${{ steps.config.outputs.config_file }} ./arbitrum-monitoring/packages/${{ inputs.monitor }}-monitor/config.json - name: Run monitoring command - run: cd ./arbitrum-monitoring && yarn ${{ matrix.monitor }}-monitor --enableAlerting - env: - SLACK_TOKEN: ${{ secrets[steps.config.outputs.slack_token] }} - SLACK_CHANNEL: ${{ secrets[steps.config.outputs.slack_channel] }} - - - name: Clean up - run: rm ./packages/arb-token-bridge-ui/public/${{ steps.config.outputs.config_file }} + run: cd ./arbitrum-monitoring && yarn ${{ inputs.monitor }}-monitor --enableAlerting diff --git a/.github/workflows/six-hour-monitoring.yml b/.github/workflows/six-hour-monitoring.yml new file mode 100644 index 0000000000..3a1c7457d2 --- /dev/null +++ b/.github/workflows/six-hour-monitoring.yml @@ -0,0 +1,19 @@ +name: 6-Hour Monitoring + +on: + push: + workflow_dispatch: + schedule: + - cron: "0 */6 * * *" # Run every 6 hours + +jobs: + run-monitoring: + strategy: + matrix: + chain: [core, orbit] + monitor: [assertion, batch-poster] + uses: ./.github/workflows/monitoring.yml + with: + chain: ${{ matrix.chain }} + monitor: ${{ matrix.monitor }} + secrets: inherit diff --git a/.github/workflows/twenty-four-hour-monitoring.yml b/.github/workflows/twenty-four-hour-monitoring.yml new file mode 100644 index 0000000000..4c3a4868ea --- /dev/null +++ b/.github/workflows/twenty-four-hour-monitoring.yml @@ -0,0 +1,18 @@ +name: 24-Hour Monitoring + +on: + push: + workflow_dispatch: + schedule: + - cron: "0 0 * * *" # Run every 24 hours at midnight UTC + +jobs: + run-retryable-monitoring: + strategy: + matrix: + chain: [core, orbit] + uses: ./.github/workflows/monitoring.yml + with: + chain: ${{ matrix.chain }} + monitor: retryable + secrets: inherit