Skip to content
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

Introduce a way to bypass Sonarcloud quality gate #11403

Open
9 tasks
Cal-L opened this issue Sep 24, 2024 · 0 comments
Open
9 tasks

Introduce a way to bypass Sonarcloud quality gate #11403

Cal-L opened this issue Sep 24, 2024 · 0 comments

Comments

@Cal-L
Copy link
Contributor

Cal-L commented Sep 24, 2024

What is this about?

This task aims to introduce a way to bypass Sonarcloud quality gate but should only be used in appropriate conditions. Some conditions include:

  • TS migration
  • Enzyme -> RTL migration
  • Refactors that do not change the functionality of the app

Sonarcloud quality gate exists to uphold the quality of the codebase. This bypass should not be abused to circumvent that without reason.

Scenario

  • After applying the skip label, a contributor will be required to re-run the ci.yml action
  • This friction is intentional and aims to deter the frequent usage of the bypass

Design

No response

Technical Details

  • We can introduce a label that when exists on a PR, the sonar-cloud-quality-gate-status job in ci.yml will bypass and return success

Threat Modeling Framework

No response

Acceptance Criteria

  • On a non-functional refactor that has a failing sonarcloud quality gate

    • Apply the skip label
    • Manually re-run the ci.yml jobs
    • Upon CI completion, sonarcloud quality gate status should pass
    • PR should be unblocked
  • The reverse can be applied to the last scenario above

    • Remove the skip label
    • Re-run the ci.yml jobs
    • Upon CI completion, sonarcloud quality gate status should fail
    • PR should be blocked

Stakeholder review needed before the work gets merged

  • Engineering (needed in most cases)
  • Design
  • Product
  • QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
  • Security
  • Legal
  • Marketing
  • Management (please specify)
  • Other (please specify)

References

No response

github-merge-queue bot pushed a commit that referenced this issue Sep 25, 2024
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

Adds logic in the `sonar-cloud-quality-gate-status` step in the CI that
checks for the existence of `skip-sonar-cloud` label. If it exists, the
step is bypassed and passes. If the label doesn't exist, it checks the
sonar cloud quality gate status as usual.

Also removes the redundant `sonar-cloud` dependency in the
`all-jobs-pass` step

## **Related issues**

Fixes:

#11403 

## **Manual testing steps**

- Apply `skip-sonar-cloud` label
- Manually re-run `ci.yml` jobs
- Notice the `sonar-cloud-quality-gate-status` step logs that it is
skipped and the status checks is green

- Afterwards, remove `skip-sonar-cloud` label
- Manually re-run `ci.yml` jobs
- Notice the `sonar-cloud-quality-gate-status` step runs as usual

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

With label applied

https://github.com/MetaMask/metamask-mobile/actions/runs/11026106803/job/30622332596?pr=11425

Without label applied

**https://github.com/MetaMask/metamask-mobile/actions/runs/11026106803/job/30623782793**

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
devin-ai-integration bot pushed a commit that referenced this issue Sep 25, 2024
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

Adds logic in the `sonar-cloud-quality-gate-status` step in the CI that
checks for the existence of `skip-sonar-cloud` label. If it exists, the
step is bypassed and passes. If the label doesn't exist, it checks the
sonar cloud quality gate status as usual.

Also removes the redundant `sonar-cloud` dependency in the
`all-jobs-pass` step

## **Related issues**

Fixes:

#11403 

## **Manual testing steps**

- Apply `skip-sonar-cloud` label
- Manually re-run `ci.yml` jobs
- Notice the `sonar-cloud-quality-gate-status` step logs that it is
skipped and the status checks is green

- Afterwards, remove `skip-sonar-cloud` label
- Manually re-run `ci.yml` jobs
- Notice the `sonar-cloud-quality-gate-status` step runs as usual

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

With label applied

https://github.com/MetaMask/metamask-mobile/actions/runs/11026106803/job/30622332596?pr=11425

Without label applied

**https://github.com/MetaMask/metamask-mobile/actions/runs/11026106803/job/30623782793**

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant