Skip to content

Fix 'gdk measure' for Linux hosts

What does this merge request do and why?

For Linux, we need to add --network=host to the sitespeed.io Docker command.

See https://www.sitespeed.io/documentation/sitespeed.io/docker/#access-localhost

Fixes #1286 (closed)

How to set up and validate locally

  1. Configure a local network.
  2. Check out this branch.
  3. Start GDK.
  4. Run gdk measure /explore.
  5. You should see an output similar to the following:
=> Starting Sitespeed measurements for https://gdk.test:3443/explore
Google Chrome 116.0.5845.140
Mozilla Firefox 117.0
Microsoft Edge 116.0.1938.69
[2023-09-20 17:35:02] INFO: Versions OS: linux 6.4.6-76060406-generic nodejs: v18.16.0 sitespeed.io: 29.5.0 browsertime: 17.16.0 coach: 8.0.2
[2023-09-20 17:35:02] INFO: Running tests using Chrome - 4 iteration(s)
[2023-09-20 17:35:02] INFO: Use Chrome trace categories: -*,disabled-by-default-lighthouse,v8,v8.execute,blink.user_timing,devtools.timeline,disabled-by-default-devtools.timeline,disabled-by-default-devtools.timeline.stack
[2023-09-20 17:35:02] INFO: Testing url https://gdk.test:3443/explore iteration 1
[2023-09-20 17:35:19] INFO: Take after page complete check screenshot
[2023-09-20 17:35:19] INFO: Take cumulative layout shift screenshot
[2023-09-20 17:35:20] INFO: Take largest contentful paint screenshot
[2023-09-20 17:35:22] INFO: Use the visual metrics portable script
[2023-09-20 17:35:22] INFO: Get visual metrics from the video
[2023-09-20 17:35:24] INFO: https://gdk.test:3443/explore TTFB: 6.26s DOMContentLoaded: 7.53s firstPaint: 6.61s FCP: 6.61s LCP: 6.61s Load: 7.54s TBT: 283ms CLS:0.0002
[2023-09-20 17:35:24] INFO: VisualMetrics: FirstVisualChange: 6.62s SpeedIndex: 6.66s VisualComplete85: 6.62s LastVisualChange: 10.33s
[2023-09-20 17:35:25] INFO: Use Chrome trace categories: -*,disabled-by-default-lighthouse,v8,v8.execute,blink.user_timing,devtools.timeline,disabled-by-default-devtools.timeline,disabled-by-default-devtools.timeline.stack
...

For macOS reviewers, you should also make sure the tests pass locally, since I verified on my Linux system, and our CI runners also run Linux:

bundle exec rspec spec/lib/gdk/command/measure_*

Impacted categories

The following categories relate to this merge request:

Merge request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise an issue to follow-up.
  • Documentation added/updated, if needed.
  • Announcement added, if change is notable.
  • gdk doctor test added, if needed.
  • Add the ~highlight label if this MR should be included in the CHANGELOG.md.

Merge request reports

Loading