Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BackStopJs DockerFile Fix Arm M1 Mac #70

Merged
merged 3 commits into from Aug 10, 2022

Conversation

moabualruz
Copy link
Collaborator

@moabualruz moabualruz commented Jun 29, 2022

BackStopJs DockerFile Fix Arm M1 Mac

Bug: https://phabricator.wikimedia.org/T311573

@moabualruz moabualruz self-assigned this Jun 29, 2022
@moabualruz moabualruz force-pushed the MO_BackStopJs_DockerFile_Fix_Arm_M1_Mac branch from 83174a3 to 0d89f87 Compare June 29, 2022 13:35
@nicholasray
Copy link
Contributor

Thanks for taking a look into this @moabualruz ! I'm also getting the error you reported. Sometimes it also just seems to end without any error:

createBitmaps | Selected 21 of 21 scenarios.
      COMMAND | Command "reference" ended with an error after [4.026s]
      COMMAND | ProtocolError: Protocol error (Target.createTarget): Target closed.
                    at /usr/local/lib/node_modules/backstopjs/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:75:24
                    at new Promise (<anonymous>)
                    at Connection.send (/usr/local/lib/node_modules/backstopjs/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:71:16)
                    at Browser._createPageInContext (/usr/local/lib/node_modules/backstopjs/node_modules/puppeteer/lib/cjs/puppeteer/common/Browser.js:261:53)
                    at BrowserContext.newPage (/usr/local/lib/node_modules/backstopjs/node_modules/puppeteer/lib/cjs/puppeteer/common/Browser.js:520:30)
                    at Browser.newPage (/usr/local/lib/node_modules/backstopjs/node_modules/puppeteer/lib/cjs/puppeteer/common/Browser.js:254:37)
                    at processScenarioView (/usr/local/lib/node_modules/backstopjs/core/util/runPuppet.js:65:30)
                    at processTicksAndRejections (node:internal/process/task_queues:96:5)

@moabualruz
Copy link
Collaborator Author

moabualruz commented Jun 29, 2022

Thanks for taking a look into this @moabualruz ! I'm also getting the error you reported. Sometimes it also just seems to end without any error:

createBitmaps | Selected 21 of 21 scenarios.
      COMMAND | Command "reference" ended with an error after [4.026s]
      COMMAND | ProtocolError: Protocol error (Target.createTarget): Target closed.
                    at /usr/local/lib/node_modules/backstopjs/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:75:24
                    at new Promise (<anonymous>)
                    at Connection.send (/usr/local/lib/node_modules/backstopjs/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:71:16)
                    at Browser._createPageInContext (/usr/local/lib/node_modules/backstopjs/node_modules/puppeteer/lib/cjs/puppeteer/common/Browser.js:261:53)
                    at BrowserContext.newPage (/usr/local/lib/node_modules/backstopjs/node_modules/puppeteer/lib/cjs/puppeteer/common/Browser.js:520:30)
                    at Browser.newPage (/usr/local/lib/node_modules/backstopjs/node_modules/puppeteer/lib/cjs/puppeteer/common/Browser.js:254:37)
                    at processScenarioView (/usr/local/lib/node_modules/backstopjs/core/util/runPuppet.js:65:30)
                    at processTicksAndRejections (node:internal/process/task_queues:96:5)

@nicholasray I faced same error I rebuilt the image again a tidy bit different to accommodate that, now it works on arm64 on M1, can you get back to me on it working on amd64

@nicholasray
Copy link
Contributor

I've run this 10+ times on my MacBook Pro M1 and they all ran great so you're definitely onto something here!

@moabualruz
Copy link
Collaborator Author

I've run this 10+ times on my MacBook Pro M1 and they all ran great so you're definitely onto something here!

I will squash merge this once approved

Comment on lines +12 to +20
RUN /bin/bash -c 'set -ex && \
ARCH=`uname -m` && \
if [ "$ARCH" == "x86_64" ]; then \
sudo npm install -g --unsafe-perm=true --allow-root backstopjs@${BACKSTOPJS_VERSION}; \
else \
sudo PUPPETEER_SKIP_DOWNLOAD=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install -g --unsafe-perm=true --allow-root backstopjs@${BACKSTOPJS_VERSION} && \
apt-get -qqy update && apt-get -qqy --no-install-recommends install chromium && \
sudo test -f /usr/bin/chromium && sudo ln -s /usr/bin/chromium /usr/bin/chromium-browser && sudo ln -s /usr/bin/chromium /usr/bin/chrome; \
fi'
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to work great on my M1!

I am, however, a little nervous about merging it this week as I feel like it should be more thoroughly tested from other team members who are running on x86_64 rather than someone who is about to leave for 2 months 😊 . I also wonder whether this might affect the consistency of the screenshots across team members? The nice thing about the current setup is I have yet to see screenshots produced on my machine look any different from those produced on https://pixel.wmcloud.org/reports/desktop/index.html). We are all comparing apples-to-apples. Would this affect that?

For example, could people with M1 macs be download different versions of chromium than those with x86_64 and would that cause different screenshots/results/confusion? Relatedly, how much randomness does putting this logic in a Dockerfile (rather than downloading the backstop Docker image) introduce and would that cause any inconsistency in the screenshots (e.g. team members who build this Docker image at different dates)? I'm mostly thinking out loud here but those are my thoughts

@jdlrobson jdlrobson force-pushed the MO_BackStopJs_DockerFile_Fix_Arm_M1_Mac branch from 90f79fb to 3166fee Compare August 10, 2022 07:08
@jdlrobson jdlrobson merged commit 6cd4aec into main Aug 10, 2022
@montehurd montehurd deleted the MO_BackStopJs_DockerFile_Fix_Arm_M1_Mac branch May 7, 2024 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants