Skip to content

ci: fix create-lavamoat-viz script#22759

Merged
legobeat merged 7 commits intoMetaMask:developfrom
legobeat:fix-lavamoat-viz
Apr 16, 2024
Merged

ci: fix create-lavamoat-viz script#22759
legobeat merged 7 commits intoMetaMask:developfrom
legobeat:fix-lavamoat-viz

Conversation

@legobeat
Copy link
Copy Markdown
Contributor

@legobeat legobeat commented Jan 31, 2024

Description

It seems like the lavamoat-viz usage in CI has been broken since #12702. The create-lavamoat-viz script is silently failing on develop:

+ npx lavamoat-viz --dest ./build-artifacts/build-viz/

[Error: ENOENT: no such file or directory, open 'lavamoat/browserify/policy-debug.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'lavamoat/browserify/policy-debug.json'
}

Changes

  • ci(create-lavamoat-viz): Remove use of npx (undeterministic) and call the devDependency of lavamoat-viz
  • add lavamoat:debug:webapp package scripts which is to lavamoat:debug:build what lavamoat:webapp:auto is to lavamoat:build:auto (that is, it produces LavaMoat policy-debug.json files alongside the browserify policy for each build type)
    • Added these to .gitignore to avoid this increasing contribution overhead.
  • ci(create-lavamoat-viz): Fix invocation to lavamoat-viz to correctly generate for build-system
  • ci(create-lavamoat-viz): Extend to also generate and visualize runtime LavaMoat policies just like for build policy

Related issues

Manual testing steps

  1. Run yarn build:dev dist
  2. Run .circleci/scripts/create-lavamoat-viz.sh
  3. If you have plenty of RAM and CPU you can speed it up by removing the --parallel=false option to yarn lavamoat:debug:webapp
  4. Open build-artifacts/build-viz/index.html in web browser
  5. Contemplate who maintains all these packages

Screenshots/Recordings

Before

N/A

After

Firefox (build-system)

lavamoat-viz-ff-build

Chrome (flask)

lavamoat-viz-chrome-flask

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@legobeat legobeat force-pushed the fix-lavamoat-viz branch 3 times, most recently from 7d459b4 to c9f9750 Compare February 29, 2024 04:00
@legobeat legobeat marked this pull request as ready for review February 29, 2024 04:17
@legobeat legobeat requested review from a team, brad-decker and kumavis as code owners February 29, 2024 04:17
@legobeat legobeat requested a review from naugtur February 29, 2024 04:18
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.43%. Comparing base (86510bc) to head (c4d68bf).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #22759      +/-   ##
===========================================
- Coverage    68.44%   68.43%   -0.00%     
===========================================
  Files         1141     1141              
  Lines        43766    43766              
  Branches     11726    11726              
===========================================
- Hits         29952    29951       -1     
- Misses       13814    13815       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@legobeat legobeat force-pushed the fix-lavamoat-viz branch 10 times, most recently from 48d70a7 to 96366b0 Compare March 6, 2024 22:49
@legobeat legobeat force-pushed the fix-lavamoat-viz branch 3 times, most recently from b49fa5b to fcb8025 Compare March 12, 2024 10:42
@legobeat legobeat force-pushed the fix-lavamoat-viz branch 7 times, most recently from f600be3 to e9738d3 Compare March 19, 2024 21:15
@legobeat legobeat force-pushed the fix-lavamoat-viz branch 2 times, most recently from a8cf27f to 2a8df84 Compare March 20, 2024 23:35
@legobeat legobeat requested a review from davidmurdoch April 15, 2024 08:32
@legobeat legobeat requested a review from DDDDDanica April 15, 2024 08:36
mkdir -p "${BUILD_DEST}"

# generate lavamoat debug config
# generate lavamoat debug configs
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

policies

Suggested change
# generate lavamoat debug configs
# generate lavamoat debug policies

Copy link
Copy Markdown
Member

@kumavis kumavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surprised to see the policy changes but otherwise good

@legobeat legobeat merged commit f23f095 into MetaMask:develop Apr 16, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 16, 2024
@metamaskbot metamaskbot added the release-11.16.0 Issue or pull request that will be included in release 11.16.0 label Apr 25, 2024
@metamaskbot
Copy link
Copy Markdown
Collaborator

No release label on PR. Adding release label release-11.16.0 on PR, as PR was added to branch 11.16.0 when release was cut.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CI release-11.16.0 Issue or pull request that will be included in release 11.16.0 team-lavamoat

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants