Skip to content

fix(hack): make get-grafana-dashboards.sh more robust#6643

Merged
ti-chi-bot[bot] merged 1 commit intopingcap:mainfrom
fgksgf:fix/broken-script
Jan 8, 2026
Merged

fix(hack): make get-grafana-dashboards.sh more robust#6643
ti-chi-bot[bot] merged 1 commit intopingcap:mainfrom
fgksgf:fix/broken-script

Conversation

@fgksgf
Copy link
Member

@fgksgf fgksgf commented Jan 7, 2026

  • Add copy_if_exists() to safely handle missing directories
  • Add clone_repo() with error handling for git clone failures
  • Add trap cleanup for automatic temp directory removal
  • Use set -euo pipefail for stricter error detection
  • Add usage documentation and code comments

@fgksgf fgksgf requested a review from Copilot January 7, 2026 04:14
@ti-chi-bot ti-chi-bot bot requested a review from shonge January 7, 2026 04:14
@github-actions github-actions bot added the v2 for operator v2 label Jan 7, 2026
@ti-chi-bot ti-chi-bot bot added the size/L label Jan 7, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Grafana dashboard download script to be more robust and maintainable by adding comprehensive error handling, cleanup mechanisms, and better code organization.

Key Changes:

  • Removed the non-existent tidb/metrics/grafana path that was causing 404 errors
  • Added structured error handling with clone_repo() and copy_if_exists() helper functions to gracefully handle missing directories and git clone failures
  • Implemented automatic cleanup of temporary directories using a trap handler and enabled stricter bash error detection with set -euo pipefail

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter
Copy link

codecov-commenter commented Jan 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.33%. Comparing base (7b359cb) to head (6b08d7e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6643   +/-   ##
=======================================
  Coverage   39.33%   39.33%           
=======================================
  Files         351      351           
  Lines       20665    20665           
=======================================
  Hits         8129     8129           
  Misses      12536    12536           
Flag Coverage Δ
unittest 39.33% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fgksgf fgksgf force-pushed the fix/broken-script branch 2 times, most recently from 5403e0b to 657493a Compare January 7, 2026 06:45
- Add copy_if_exists() to safely handle missing directories
- Add clone_repo() with error handling for git clone failures
- Add trap cleanup for automatic temp directory removal
- Use set -euo pipefail for stricter error detection
- Add usage documentation and code comments
- Pass destination as explicit parameter to copy_if_exists()
@fgksgf fgksgf force-pushed the fix/broken-script branch from 657493a to 6b08d7e Compare January 7, 2026 06:51
@fgksgf
Copy link
Member Author

fgksgf commented Jan 8, 2026

/test pull-e2e

1 similar comment
@fgksgf
Copy link
Member Author

fgksgf commented Jan 8, 2026

/test pull-e2e

@liubog2008
Copy link
Member

/lgtm

@ti-chi-bot ti-chi-bot bot added the lgtm label Jan 8, 2026
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jan 8, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liubog2008

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jan 8, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-01-08 08:41:38.670825813 +0000 UTC m=+864454.489134235: ☑️ agreed by liubog2008.

@ti-chi-bot ti-chi-bot bot added the approved label Jan 8, 2026
@ti-chi-bot ti-chi-bot bot merged commit 620cd56 into pingcap:main Jan 8, 2026
10 checks passed
@fgksgf fgksgf deleted the fix/broken-script branch January 8, 2026 09:03
@liubog2008
Copy link
Member

/cherry-pick release-2.0

@ti-chi-bot
Copy link
Member

@liubog2008: new pull request created to branch release-2.0: #6645.

Details

In response to this:

/cherry-pick release-2.0

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@fgksgf
Copy link
Member Author

fgksgf commented Jan 13, 2026

/cherry-pick release-2.0

@ti-chi-bot
Copy link
Member

@fgksgf: new pull request could not be created: failed to create pull request against pingcap/tidb-operator#release-2.0 from head ti-chi-bot:cherry-pick-6643-to-release-2.0: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"No commits between pingcap:release-2.0 and ti-chi-bot:cherry-pick-6643-to-release-2.0"}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request","status":"422"}

Details

In response to this:

/cherry-pick release-2.0

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants