From be2cd9dcdef0cf880749ff2ee81d6674a06a6355 Mon Sep 17 00:00:00 2001 From: Vlado Djerek Date: Tue, 24 Oct 2023 20:23:52 +0200 Subject: [PATCH] change report generator to be aware of GH and passtrough vars to tox (#29121) * change report generator to be aware of GH and passtrough vars to tox * Update .test-infra/jenkins/metrics_report/report_generator.py Rework the logic of github detection * remove github run id env from tox config as its not used --- .github/workflows/beam_Metrics_Report.yml | 9 +-------- .test-infra/jenkins/metrics_report/report_generator.py | 9 ++++++--- .test-infra/jenkins/metrics_report/tox.ini | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/beam_Metrics_Report.yml b/.github/workflows/beam_Metrics_Report.yml index 418b6bde43d3..0c88171f50c1 100644 --- a/.github/workflows/beam_Metrics_Report.yml +++ b/.github/workflows/beam_Metrics_Report.yml @@ -65,19 +65,12 @@ jobs: 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_token: ${{ secrets.GITHUB_TOKEN }} github_job: ${{ matrix.job_name }} (${{ matrix.job_phrase }}) - steps_context: ${{ toJson(steps) }} - name: Setup environment uses: ./.github/actions/setup-environment-action with: diff --git a/.test-infra/jenkins/metrics_report/report_generator.py b/.test-infra/jenkins/metrics_report/report_generator.py index 7923fcce9dab..bdaada04f30d 100644 --- a/.test-infra/jenkins/metrics_report/report_generator.py +++ b/.test-infra/jenkins/metrics_report/report_generator.py @@ -27,11 +27,14 @@ INFLUXDB_USER = os.getenv("INFLUXDB_USER") INFLUXDB_USER_PASSWORD = os.getenv("INFLUXDB_USER_PASSWORD") -WORKING_SPACE = os.getenv("WORKSPACE", "") +WORKING_SPACE = os.getenv("GITHUB_WORKSPACE", os.getenv("WORKSPACE", "")) +if "GITHUB_WORKSPACE" in os.environ: + path_prefix = "" +else: + path_prefix= "src/" PERF_DASHBOARDS = os.path.join( WORKING_SPACE, - "src/.test-infra/metrics/grafana/dashboards/perftests_metrics/") - + path_prefix+".test-infra/metrics/grafana/dashboards/perftests_metrics/") TABLE_FIELD_NAMES = [ "Measurement", "Metric", diff --git a/.test-infra/jenkins/metrics_report/tox.ini b/.test-infra/jenkins/metrics_report/tox.ini index dbf68016c57b..026db5dc4860 100644 --- a/.test-infra/jenkins/metrics_report/tox.ini +++ b/.test-infra/jenkins/metrics_report/tox.ini @@ -32,5 +32,5 @@ commands = python -m unittest dashboards_parser.py [testenv:py38-generate-report] deps = -r requirements.txt -passenv = WORKSPACE,INFLUXDB_USER,INFLUXDB_USER_PASSWORD +passenv = WORKSPACE,INFLUXDB_USER,INFLUXDB_USER_PASSWORD,GITHUB_WORKSPACE commands = python report_generator.py {posargs}