-
Notifications
You must be signed in to change notification settings - Fork 8
Add a milestone CLOSED validator #229
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
847f4b7
84b8598
40d6dfc
ed00718
221f846
8d60b8f
71dc41d
656ec0b
32966a5
2693a32
a9794a0
934e291
5ce7361
a01d319
9599dc5
acbc2a1
a24368f
0fed428
153a295
37c3721
30a956b
3c25100
6f124c3
abb5370
c7b9975
98a286c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| name: Testops - TestRail Milestone CLOSED - polling | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [ rpapa-release-close] | ||
| workflow_dispatch: | ||
| inputs: | ||
| branchName: | ||
| description: "rpapa branch" | ||
| required: true | ||
| default: "rpapa-release-close" | ||
|
|
||
| env: | ||
| CLOUD_SQL_DATABASE_NAME: preflight | ||
| CLOUD_SQL_DATABASE_USERNAME: ${{ secrets.CLOUD_SQL_DATABASE_USERNAME }} | ||
| CLOUD_SQL_DATABASE_PASSWORD: ${{ secrets.CLOUD_SQL_DATABASE_PASSWORD }} | ||
| CLOUD_SQL_DATABASE_PORT: ${{ secrets.CLOUD_SQL_DATABASE_PORT }} | ||
| TESTRAIL_HOST: ${{ secrets.TESTRAIL_HOST }} | ||
| TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }} | ||
| TESTRAIL_PASSWORD: ${{ secrets.TESTRAIL_PASSWORD }} | ||
| ATLASSIAN_API_TOKEN: ${{ secrets.ATLASSIAN_API_TOKEN }} | ||
| ATLASSIAN_HOST: ${{ secrets.ATLASSIAN_HOST }} | ||
| ATLASSIAN_USERNAME: ${{ secrets.ATLASSIAN_USERNAME }} | ||
| JIRA_HOST: ${{ secrets.JIRA_HOST }} | ||
| JIRA_USER: ${{ secrets.JIRA_USER }} | ||
| JIRA_PASSWORD: ${{ secrets.JIRA_PASSWORD }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| BUGZILLA_API_KEY: ${{ secrets.BUGZILLA_API_KEY }} | ||
| BITRISE_HOST: ${{ secrets.BITRISE_HOST }} | ||
| BITRISE_APP_SLUG: ${{ secrets.BITRISE_APP_SLUG }} | ||
| BITRISE_TOKEN: ${{ secrets.BITRISE_TOKEN }} | ||
| SENTRY_HOST: ${{ secrets.SENTRY_HOST }} | ||
| SENTRY_API_TOKEN: ${{ secrets.SENTRY_API_TOKEN_CSO }} | ||
| SENTRY_ORGANIZATION_SLUG: ${{ secrets.SENTRY_ORGANIZATION_SLUG }} | ||
| SENTRY_IOS_PROJECT_ID: ${{ secrets.SENTRY_IOS_PROJECT_ID }} | ||
| SENTRY_FENIX_PROJECT_ID: ${{ secrets.SENTRY_FENIX_PROJECT_ID }} | ||
| SENTRY_FENIX_BETA_PROJECT_ID: ${{ secrets.SENTRY_FENIX_BETA_PROJECT_ID }} | ||
|
|
||
| jobs: | ||
| reports: | ||
| name: Run reports (${{ matrix.name }}) | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| max-parallel: 6 | ||
| matrix: | ||
| include: | ||
| - name: Mobile Testrail Milestones CLOSED | ||
| args: --platform mobile --project ALL --report-type testrail-milestones-closed | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
| cache: "pip" | ||
| cache-dependency-path: requirements.txt | ||
| - uses: mattes/gce-cloudsql-proxy-action@v1 | ||
| with: | ||
| creds: ${{ secrets.GCLOUD_AUTH }} | ||
| instance: ${{ secrets.CLOUD_SQL_CONNECTION_NAME }} | ||
| port: ${{ secrets.CLOUD_SQL_DATABASE_PORT }} | ||
| - run: pip install -r requirements.txt | ||
| - run: python ./__main__.py ${{ matrix.args }} | ||
|
|
||
| notify: | ||
| name: Slack notify | ||
| runs-on: ubuntu-latest | ||
| needs: [reports, sentry] | ||
| if: always() | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - run: echo "JOB_LOG_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV | ||
| - uses: slackapi/[email protected] | ||
| env: | ||
| WORKFLOW_NAME: ${{ github.workflow }} | ||
| BRANCH: ${{ github.head_ref || github.ref_name }} | ||
| JOB_STATUS: ${{ (needs.reports.result == 'success' && needs.sentry.result == 'success') && ':white_check_mark:' || ':x:' }} | ||
| JOB_STATUS_COLOR: ${{ (needs.reports.result == 'success' && needs.sentry.result == 'success') && '#36a64f' || '#FF0000' }} | ||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_MOBILE_ALERTS_TOOLING }} | ||
| SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
| with: | ||
| webhook: ${{ secrets.SLACK_WEBHOOK_URL_MOBILE_ALERTS_TOOLING }} | ||
| webhook-type: webhook-trigger | ||
| payload-file-path: "./config/payload-slack-content.json" | ||
| payload-templated: true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,13 +21,15 @@ | |
| handle_bitrise_builds, | ||
| ) | ||
|
|
||
| """ | ||
|
||
| from handlers.bugzilla import ( | ||
| handle_bugzilla_desktop_bugs, | ||
| handle_bugzilla_desktop_release_flags_for_bugs, | ||
| handle_bugzilla_meta_bugs, | ||
| handle_bugzilla_qe_verify, | ||
| handle_bugzilla_query_by_keyword, | ||
| ) | ||
| """ | ||
|
|
||
| from handlers.confluence import ( | ||
| handle_confluence_build_validation, | ||
|
|
@@ -53,6 +55,7 @@ | |
| handle_testrail_test_plans_and_runs, | ||
| handle_testrail_test_results, | ||
| handle_testrail_milestones, | ||
| handle_testrail_milestones_closed, | ||
| handle_testrail_users, | ||
| handle_testrail_test_case_coverage, | ||
| # handle_testrail_test_run_counts_update, | ||
|
|
@@ -111,7 +114,7 @@ def parse_args(cmdln_args): | |
| def validate_project(platform, project, report_type): | ||
| # Conditionally require --platform and --project | ||
| # if --report-type is 'test-case-coverage' | ||
| if report_type in ('test-case-coverage', 'testrail-milestones'): | ||
| if report_type in ('test-case-coverage', 'testrail-milestones', 'testrail-milestones-closed'): | ||
| if not project: | ||
| print("--project is required for the report selected") | ||
| if not platform: | ||
|
|
@@ -171,11 +174,11 @@ def expand_project_args(platform, projects): | |
| # === DISPATCH MAP === | ||
| COMMAND_MAP = { | ||
| 'bitrise-builds': handle_bitrise_builds, | ||
| 'bugzilla-desktop-bugs': handle_bugzilla_desktop_bugs, | ||
| 'bugzilla-desktop-release-flags-for-bugs': handle_bugzilla_desktop_release_flags_for_bugs, # noqa | ||
| 'bugzilla-meta-bugs': handle_bugzilla_meta_bugs, | ||
| 'bugzilla-qe-verify': handle_bugzilla_qe_verify, | ||
| 'bugzilla-query-by-keyword': handle_bugzilla_query_by_keyword, | ||
| #'bugzilla-desktop-bugs': handle_bugzilla_desktop_bugs, | ||
|
||
| #'bugzilla-desktop-release-flags-for-bugs': handle_bugzilla_desktop_release_flags_for_bugs, # noqa | ||
| #'bugzilla-meta-bugs': handle_bugzilla_meta_bugs, | ||
| #'bugzilla-qe-verify': handle_bugzilla_qe_verify, | ||
| #'bugzilla-query-by-keyword': handle_bugzilla_query_by_keyword, | ||
| 'confluence-updates': handle_confluence_updates, | ||
| 'confluence-build-validation': handle_confluence_build_validation, | ||
| 'github-issue-regression': handle_github_issue_regression, | ||
|
|
@@ -185,6 +188,7 @@ def expand_project_args(platform, projects): | |
| 'sentry-issues': handle_sentry_issues, | ||
| 'sentry-rates': handle_sentry_rates, | ||
| 'testrail-milestones': handle_testrail_milestones, | ||
| 'testrail-milestones-closed': handle_testrail_milestones_closed, | ||
| 'testrail-users': handle_testrail_users, | ||
| 'testrail-test-case-coverage': handle_testrail_test_case_coverage, | ||
| # 'testrail-test-run-counts': handle_testrail_test_run_counts_update, | ||
|
|
@@ -203,6 +207,7 @@ def main(): | |
| print(f"args.report_type: {args.report_type}") | ||
| print(f"args.arg_list: {args.arg_list}") | ||
|
|
||
|
|
||
| if report_type not in COMMAND_MAP: | ||
| sys.exit(f"Unknown or unsupported report type: {report_type}") | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,7 +42,11 @@ def _tr() -> TestRail(): | |
| # ORCHESTRATOR (BATCH) | ||
| # =================================================================== | ||
|
|
||
| def testrail_milestones(project): | ||
| def run(project, milestone_validate_closed: bool = False): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is only 1 entry point to this module (and all report modules). Standard practice in this case is to use an entry function called: Other new standards here are using: |
||
| _fetch(project, milestone_validate_closed) | ||
|
|
||
|
|
||
| def _fetch(project, milestone_validate_closed): | ||
|
|
||
| tr = _tr() | ||
|
|
||
|
|
@@ -141,9 +145,14 @@ def testrail_milestones(project): | |
| pl.extract_build_version | ||
| ) | ||
|
|
||
| import sys | ||
|
||
| print(f"milestone_validate_closed: {milestone_validate_closed}") | ||
| sys.exit() | ||
|
|
||
|
|
||
| # Insert into database only if there is data | ||
| if not df_selected.empty: | ||
| report_milestones_insert(projects_id, df_selected) | ||
| _db_upsert(projects_id, df_selected) | ||
| else: | ||
| print( | ||
| f"No milestones data to insert into database for project " | ||
|
|
@@ -155,7 +164,7 @@ def testrail_milestones(project): | |
| # DB INSERT | ||
| # =================================================================== | ||
|
|
||
| def report_milestones_insert(projects_id, payload): | ||
| def _db_upsert(projects_id, payload): | ||
|
||
|
|
||
| # DIAGNOSTIC | ||
| print("--------------------------------------") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,11 @@ def handle_testrail_milestones(args): | |
| milestones.testrail_milestones(args.arg_list) | ||
|
|
||
|
|
||
| def handle_testrail_milestones_closed(args): | ||
| milestone_validate_closed = True | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doing it this way, we don't have to make the |
||
| milestones.run(args.arg_list, milestone_validate_closed) | ||
|
|
||
|
|
||
| def handle_testrail_users(args): | ||
| users.testrail_users() | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
introducing a new workflow environment:
demofor PRsOnce the PR has passed review, demo can change to either
stagingorproduction