From 9e21f3d07201c54f210d67742f71639045517530 Mon Sep 17 00:00:00 2001 From: Vlado Djerek Date: Tue, 24 Oct 2023 15:24:52 +0200 Subject: [PATCH] adding metrics report (#29010) * adding metrics report * change concurrency group Co-authored-by: Andrey Devyatkin * misc fixes * Update .github/workflows/beam_Metrics_Report.yml Co-authored-by: Andrey Devyatkin --------- Co-authored-by: Andrey Devyatkin --- .github/workflows/beam_Metrics_Report.yml | 114 ++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 .github/workflows/beam_Metrics_Report.yml diff --git a/.github/workflows/beam_Metrics_Report.yml b/.github/workflows/beam_Metrics_Report.yml new file mode 100644 index 000000000000..418b6bde43d3 --- /dev/null +++ b/.github/workflows/beam_Metrics_Report.yml @@ -0,0 +1,114 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Beam Metrics Report + +on: + # issue_comment: + # types: [created] + # schedule: + # - cron: '0 */23 * * *' + workflow_dispatch: + +# This allows a subsequently queued workflow run to interrupt previous runs +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.issue.number || github.sha || github.head_ref || github.ref }}-${{ github.event.schedule || github.event.comment.id || github.event.sender.login }}' + cancel-in-progress: true + +env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }} + GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }} + GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }} + +#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event +permissions: + actions: write + pull-requests: read + checks: read + contents: read + deployments: read + id-token: none + issues: read + discussions: read + packages: read + pages: read + repository-projects: read + security-events: read + statuses: read + +jobs: + beam_Metrics_Report: + name: ${{matrix.job_name}} (${{matrix.job_phrase}}) + runs-on: [self-hosted, ubuntu-20.04, main] + timeout-minutes: 100 + strategy: + matrix: + job_name: [beam_Metrics_Report] + job_phrase: [Run Metrics Report] + if: | + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch' || + github.event.comment.body == 'Run Metrics Report' + steps: + - uses: actions/checkout@v3 + - name: Generate a token + id: generate_token + uses: actions/create-github-app-token@v1 + with: + app_id: ${{ secrets.GH_APP_ID }} + private_key: ${{ secrets.GH_APP_PRIVATE_KEY }} + - name: Setup repository + uses: ./.github/actions/setup-action + with: + comment_phrase: ${{ matrix.job_phrase }} + github_token: ${{ steps.generate_token.outputs.token }} + github_job: ${{ matrix.job_name }} (${{ matrix.job_phrase }}) + steps_context: ${{ toJson(steps) }} + - name: Setup environment + uses: ./.github/actions/setup-environment-action + with: + python-version: 3.8 + - name: Run Metrics Report + uses: ./.github/actions/gradle-command-self-hosted-action + with: + gradle-command: :beam-test-jenkins:generateMetricsReport + arguments: --info -PinfluxDb=beam_test_metrics -PinfluxHost='10.128.0.96' -PinfluxPort=8086 + env: + INFLUXDB_USER: ${{ secrets.INFLUXDB_USER }} + INFLUXDB_USER_PASSWORD: ${{ secrets.INFLUXDB_USER_PASSWORD }} + - name: Archive Report + uses: actions/upload-artifact@v3 + with: + name: Metrics Report + path: "${{ github.workspace }}/.test-infra/jenkins/metrics_report/beam-metrics_report.html" + - name: Generate Date + run: | + date=$(date -u +"%Y-%m-%d") + echo "date=$date" >> $GITHUB_ENV + - name: Send mail + uses: dawidd6/action-send-mail@v3 + with: + server_address: smtp.gmail.com + server_port: 465 + secure: true + username: ${{ secrets.ISSUE_REPORT_SENDER_EMAIL_ADDRESS }} + password: ${{ secrets.ISSUE_REPORT_SENDER_EMAIL_PASSWORD }} + subject: Beam Metrics Report ${{ env.date }} + to: dannymccormick@google.com #dev@beam.apache.org + cc: vlado.djerek@akvelon.com + from: gactions@beam.apache.org # + html_body: file://${{ github.workspace }}/.test-infra/jenkins/metrics_report/beam-metrics_report.html