-
Notifications
You must be signed in to change notification settings - Fork 1
refactor: redesign SGW upgrades + greenboard uploads #414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vipbhardwaj
wants to merge
10
commits into
main
Choose a base branch
from
sgw-upg-test-redesign
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4867257
refactor: redesign SGW upgrades + greenboard uploads
vipbhardwaj 53a6ada
fix: int-based sorting for build
vipbhardwaj 98c0f4c
fix: logging code isn't a test step
vipbhardwaj bf1076d
feat: JUnit + 1-doc/test + refactored shell files to be able to run t…
vipbhardwaj 21e4c86
Merge branch 'main' into sgw-upg-test-redesign
vipbhardwaj 4d00950
Potential fix for pull request finding
vipbhardwaj f39cd4d
Potential fix for pull request finding
vipbhardwaj 4826f7a
Potential fix for pull request finding
vipbhardwaj c7551d6
Potential fix for pull request finding
vipbhardwaj 8f06014
removed trailing whitespace
vipbhardwaj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| """ | ||
| ``python -m cbltest.greenboard_upload`` — aggregate JUnit XMLs + meta sidecars | ||
| in a results directory and push a single greenboard doc. | ||
|
|
||
| Invoked by every ``test.sh`` / ``run_test.sh`` at the end of a Jenkins build | ||
| via an EXIT trap. See :py:meth:`cbltest.greenboarduploader.GreenboardUploader.upload_from_results_dir` | ||
| for the aggregation + no-upload rules. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import os | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| import click | ||
|
|
||
| from cbltest.configparser import _parse_config | ||
| from cbltest.greenboarduploader import GreenboardUploader | ||
| from cbltest.logging import cbl_info, cbl_warning | ||
|
|
||
|
|
||
| @click.command() | ||
| @click.option( | ||
| "--config", | ||
| "config_path", | ||
| required=True, | ||
| type=click.Path(exists=True, dir_okay=False), | ||
| help="Path to the test config JSON (same one pytest was run with).", | ||
| ) | ||
| @click.option( | ||
| "--results-dir", | ||
| required=True, | ||
| type=click.Path(file_okay=False), | ||
| help="Directory holding junit_*.xml + meta_*.json from all pytest runs " | ||
| "in this Jenkins build.", | ||
| ) | ||
| @click.option( | ||
| "--upgrade-to", | ||
| default=None, | ||
| help="Target SGW version for upgrade tests; included on the doc as " | ||
| "`upgradeTo`. Omit for non-upgrade pipelines.", | ||
| ) | ||
| def main(config_path: str, results_dir: str, upgrade_to: str | None) -> None: | ||
| parsed = _parse_config(config_path) | ||
| if ( | ||
| parsed.greenboard_url is None | ||
| or parsed.greenboard_username is None | ||
| or parsed.greenboard_password is None | ||
| ): | ||
| cbl_info("No greenboard config in test config; skipping upload") | ||
| return | ||
|
|
||
| build_url = os.environ.get("BUILD_URL") or None | ||
|
|
||
| try: | ||
| GreenboardUploader.upload_from_results_dir( | ||
| parsed.greenboard_url, | ||
| parsed.greenboard_username, | ||
| parsed.greenboard_password, | ||
| Path(results_dir), | ||
| build_url=build_url, | ||
| upgrade_to=upgrade_to, | ||
| ) | ||
| except Exception as e: | ||
| # Never let an upload failure mask the underlying test exit code in | ||
| # the shell trap — log and exit clean. The trap already ORs with | ||
| # `|| true`, but be defensive here too. | ||
| cbl_warning(f"Greenboard aggregator failed: {e}") | ||
| sys.exit(0) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.