metamask-extension
metamask-extension copied to clipboard
Add validation to production build script
Validation has been added to the build script when the "prod" target is selected. We now ensure that all expected environment variables are set, and that no extra environment variables are present (which might indicate that the wrong configuration file is being used).
The prod
target uses a new .metamaskprodrc
configuration file. Each required variable can be specified either via environment variable or via this config file. CI will continue set these via environment variable, but for local manual builds we can use the config file to simplify the build process and ensure consistency.
A new "dist" target has been added to preserve the ability to build a "production-like" build without this validation.
The config validation is invoked early in the script, in the CLI argument parsing step, so that it would fail more quickly. Otherwise we'd have to wait a few minutes longer for the validation to run. This required some refactoring, moving functions to the utility module and moving the config to a dedicated module.
Closes #15003
Manual Testing Steps
The build targets of dev
, devTest
, test
should all remain unchanged. The new build target dist
should behave the same as the old prod
target (which confusingly was invoked as yarn dist
).
The new prod
target has this new behavior:
- It should demand that all required variables are set either via environment variable or the
.metamaskprodrc
config file.- The required variables are:
-
SENTRY_DSN
-
PUBNUB_PUB_KEY
-
PUBNUB_SUB_KEY
-
INFURA_[build type]_PROJECT_ID
-
SEGMENT_[build type]_WRITE_KEY
-
- For the build-type-specific variables, only those used by the current build are required.
- The required variables are:
- Extra values specified in
.metamaskprodrc
should produce an error. - Extra environment variables should not produce an error (of course - that would make this impossible to use)
- The validation should occur early in the build process, before any tasks have started.
Pre-Merge Checklist
- [x] PR template is filled out
- [x] IF this PR fixes a bug, a test that would have caught the bug has been added
- [x] PR is linked to the appropriate GitHub issue
- [x] PR has been added to the appropriate release Milestone
+ If there are functional changes:
- [ ] Manual testing complete & passed
- [x] "Extension QA Board" label has been applied
~This depends upon #15464, #15447, and #15493~
This is ready for review
Builds ready [843d76c]
- builds: chrome, firefox, opera
- builds (beta): chrome, firefox, opera
- builds (flask): chrome, firefox, opera
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- code coverage: Report
- storybook: Storybook
- all artifacts
Page Load Metrics (1863 ± 109 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 87 | 156 | 114 | 19 | 9 |
domContentLoaded | 1551 | 2244 | 1837 | 218 | 105 | ||
load | 1564 | 2263 | 1863 | 228 | 109 | ||
domInteractive | 1551 | 2244 | 1837 | 218 | 105 |
Builds ready [faf5b3d]
- builds: chrome, firefox, opera
- builds (beta): chrome, firefox, opera
- builds (flask): chrome, firefox, opera
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- code coverage: Report
- storybook: Storybook
- all artifacts
Page Load Metrics (1717 ± 35 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 93 | 172 | 115 | 22 | 10 |
domContentLoaded | 1562 | 1879 | 1697 | 80 | 38 | ||
load | 1585 | 1879 | 1717 | 73 | 35 | ||
domInteractive | 1561 | 1879 | 1697 | 80 | 38 |
Builds ready [c491453]
- builds: chrome, firefox, opera
- builds (beta): chrome, firefox, opera
- builds (flask): chrome, firefox, opera
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- code coverage: Report
- storybook: Storybook
- all artifacts
Page Load Metrics (1814 ± 61 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 85 | 145 | 114 | 14 | 7 |
domContentLoaded | 1591 | 2015 | 1783 | 113 | 54 | ||
load | 1591 | 2045 | 1814 | 126 | 61 | ||
domInteractive | 1591 | 2015 | 1783 | 113 | 54 |
Builds ready [6a9ac31]
- builds: chrome, firefox, opera
- builds (beta): chrome, firefox, opera
- builds (flask): chrome, firefox, opera
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- code coverage: Report
- storybook: Storybook
- all artifacts
Page Load Metrics (1909 ± 81 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 89 | 366 | 132 | 57 | 27 |
domContentLoaded | 1606 | 2138 | 1882 | 149 | 71 | ||
load | 1607 | 2178 | 1909 | 169 | 81 | ||
domInteractive | 1606 | 2138 | 1882 | 149 | 71 |
Builds ready [e2c4872]
- builds: chrome, firefox, opera
- builds (beta): chrome, firefox, opera
- builds (flask): chrome, firefox, opera
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- code coverage: Report
- storybook: Storybook
- all artifacts
Page Load Metrics (1753 ± 41 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 97 | 1759 | 280 | 480 | 230 |
domContentLoaded | 1551 | 1847 | 1720 | 78 | 37 | ||
load | 1577 | 1903 | 1753 | 86 | 41 | ||
domInteractive | 1551 | 1847 | 1720 | 78 | 37 |
Builds ready [6154caf]
- builds: chrome, firefox, opera
- builds (beta): chrome, firefox, opera
- builds (flask): chrome, firefox, opera
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- code coverage: Report
- storybook: Storybook
- all artifacts
Page Load Metrics (1630 ± 35 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 83 | 1560 | 177 | 318 | 153 |
domContentLoaded | 1511 | 1792 | 1626 | 72 | 34 | ||
load | 1511 | 1792 | 1630 | 72 | 35 | ||
domInteractive | 1511 | 1792 | 1626 | 72 | 34 |
Builds ready [a6f17bc]
- builds: chrome, firefox, opera
- builds (beta): chrome, firefox, opera
- builds (flask): chrome, firefox, opera
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1802 ± 56 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 89 | 163 | 109 | 18 | 9 |
domContentLoaded | 1606 | 1966 | 1773 | 104 | 50 | ||
load | 1616 | 1992 | 1802 | 117 | 56 | ||
domInteractive | 1606 | 1966 | 1773 | 104 | 50 |
Builds ready [a7c29c6]
- builds: chrome, firefox, opera
- builds (beta): chrome, firefox, opera
- builds (flask): chrome, firefox, opera
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1933 ± 76 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 89 | 1753 | 201 | 357 | 172 |
domContentLoaded | 1713 | 2322 | 1897 | 160 | 77 | ||
load | 1745 | 2323 | 1933 | 159 | 76 | ||
domInteractive | 1713 | 2322 | 1897 | 160 | 77 |
Also validated that extra vars invalidate the build