Commit a492e34
authored
feat: use shallow clone in prepare and emit-build-metadata jobs (#29807)
## **Description**
The `prepare` and `emit-build-metadata` jobs in `build.yml` use
`fetch-depth: 0` (full git history clone), which takes ~1m 10s each
(median, n=21). Neither job performs any git history operations:
- `prepare`: reads `builds.yml` via `fs.readFileSync` and runs
`validate-build-config.js` (zero git commands)
- `emit-build-metadata`: runs `git rev-parse HEAD` (works on shallow
clones) and `get-build-metadata.sh` which only reads files (zero git
commands)
Removing `fetch-depth: 0` defaults to `fetch-depth: 1` (shallow clone),
reducing checkout from ~70s to ~10-15s per job.
**Expected saving:** ~1m 50s - 2m 10s per pipeline run across both jobs.
Also eliminates a tail-risk outlier where `emit-build-metadata` checkout
took 6m 45s.
Part of MCWP-574 (pipeline optimization series: PR 3 of 4).
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes: MCWP-574
## **Manual testing steps**
```gherkin
Feature: Shallow clone in build pipeline
Scenario: prepare job completes with shallow clone
Given a production build is triggered via workflow_dispatch on build.yml
And skip_version_bump is true
When the prepare job runs
Then the actions/checkout step completes in ~10-15s (down from ~70s)
And the prepare job outputs are identical to a full-clone run
Scenario: emit-build-metadata job completes with shallow clone
Given a production build completes successfully
When the emit-build-metadata job runs
Then the actions/checkout step completes in ~10-15s
And built_commit_sha, semantic_version, and version codes are output correctly
Scenario: version-bump commit ref works with shallow clone
Given a production build is triggered with skip_version_bump false
When the prepare job checks out the version-bump commit hash
Then actions/checkout fetches the specific commit successfully
And the prepare job completes without errors
```
## **Screenshots/Recordings**
### **Before**
Not applicable (CI pipeline change, no UI).
### **After**
Not applicable (CI pipeline change, no UI).
## **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
- [ ] 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**
- [ ] 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.1 parent ae4e8f0 commit a492e34
1 file changed
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
121 | 120 | | |
122 | 121 | | |
123 | 122 | | |
| |||
528 | 527 | | |
529 | 528 | | |
530 | 529 | | |
531 | | - | |
532 | 530 | | |
533 | 531 | | |
534 | 532 | | |
| |||
0 commit comments