Skip to content

Commit

Permalink
chore: exclude running git diff job for the e2e quality gate in `deve…
Browse files Browse the repository at this point in the history
…lop`, `master` and release branches (#25605)

<!--
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**
This PR excludes running the git-diff script for the e2e quality gate
added
[here](3ea381d),
for `develop` as well as for `master` and release branches.
We don't want to run this in develop, master or release branch, since
there is no point on re-running the new/changed tests there, as the
changes are already in `develop` branch. This could add up more credits
and also slow down ci in those branches.

**Context**: in `develop` branch the current quality gate fails, since
the `diffResult` is empty, and we were throwing the following
[error](https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/89939/workflows/dccfb6e0-741d-4416-bc01-8ab1a884c12b/jobs/3329380)
as we were entering in the !diffResult condition.
However, this PR fixes the issue on the higher level, by skipping
entirely the git diff for the mentioned branches above.


```
  await fetchUntilMergeBaseFound();
  const { stdout: diffResult } = await exec(`git diff --name-only origin/HEAD...${process.env.CIRCLE_BRANCH}`);
  if (!diffResult) {
      throw new Error('Unable to get diff after full checkout.');
  }
```


[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25605?quickstart=1)

## **Related issues**

Fixes: current develop ci

## **Manual testing steps**
- ci should continue to work
- once merged, fixes develop

## **Screenshots/Recordings**

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

### **Before**

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

### **After**

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

## **Pre-merge author checklist**

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

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] 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.
  • Loading branch information
seaona authored Jul 2, 2024
1 parent d721e7f commit 4886a3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ develop_master_rc_only: &develop_master_rc_only
- master
- /^Version-v(\d+)[.](\d+)[.](\d+)/

exclude_develop_master_rc: &exclude_develop_master_rc
filters:
branches:
ignore:
- develop
- master
- /^Version-v(\d+)[.](\d+)[.](\d+)/
aliases:
# Shallow Git Clone
- &shallow-git-clone
Expand Down Expand Up @@ -106,6 +113,7 @@ workflows:
- check-pr-tag
- prep-deps
- get-changed-files-with-git-diff:
<<: *exclude_develop_master_rc
requires:
- prep-deps
- test-deps-audit:
Expand Down Expand Up @@ -203,7 +211,6 @@ workflows:
<<: *develop_master_rc_only
requires:
- prep-build-confirmation-redesign-test-mv2
- get-changed-files-with-git-diff
- test-e2e-chrome-rpc:
requires:
- prep-build-test
Expand All @@ -223,7 +230,6 @@ workflows:
<<: *develop_master_rc_only
requires:
- prep-build-test-flask-mv2
- get-changed-files-with-git-diff
- test-e2e-chrome-mmi:
requires:
- prep-build-test-mmi
Expand All @@ -243,7 +249,6 @@ workflows:
- /^Version-v(\d+)[.](\d+)[.](\d+)/
requires:
- prep-build
- get-changed-files-with-git-diff
- test-unit-jest-main:
requires:
- prep-deps
Expand Down Expand Up @@ -488,6 +493,7 @@ jobs:

# This job is used for the e2e quality gate.
# It must be run before any job which uses the run-all.js script.
# The job is skipped in develop, master or RC branches.
get-changed-files-with-git-diff:
executor: node-browsers-small
steps:
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/changedFilesUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function readChangedFiles() {
return changedFiles;
} catch (error) {
console.error('Error reading from file:', error);
return '';
return [];
}
}

Expand Down

0 comments on commit 4886a3f

Please sign in to comment.