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

Apply Google Chrome --no-sandbox flag to fix Travis CI and enable headless Firefox #169

Merged
merged 3 commits into from
Feb 5, 2018

Conversation

mbland
Copy link
Owner

@mbland mbland commented Feb 5, 2018

Pull requests started failing Travis CI builds with the following message:

05 02 2018 20:50:18.131:ERROR [launcher]: Cannot start ChromeHeadless
	[0205/205017.988204:FATAL:setuid_sandbox_host.cc(157)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /opt/google/chrome/chrome-sandbox is owned by root and has mode 4755.

From: https://travis-ci.org/mbland/custom-links/jobs/337734109

As it turns out, Chrome is now directly supported as an addon (rather than requiring it be installed via addons: apt: packages: -google-chrome-stable), and the source of the error is well-documented in the Travis docs:

https://docs.travis-ci.com/user/chrome#Sandboxing

This change applies the --no-sandbox flag for headless Google Chrome via the ./go test browser --single-run command, via Karma, and via ./go test end-to-end. Updated the mocha-chrome package and moved it from dependencies: to devDependencies: in the process.

Since this change removes xvfb, I also took the opportunity to switch to headless Firefox in the process via:

https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-the-Firefox-addon-in-headless-mode

Pull requests started failing Travis CI builds with the following
message:

  05 02 2018 20:50:18.131:ERROR [launcher]: Cannot start ChromeHeadless
    [0205/205017.988204:FATAL:setuid_sandbox_host.cc(157)] The SUID
    sandbox helper binary was found, but is not configured correctly.
    Rather than run without sandboxing I'm aborting now. You need to
    make sure that /opt/google/chrome/chrome-sandbox is owned by root
    and has mode 4755.

  From: https://travis-ci.org/mbland/custom-links/jobs/337734109

As it turns out, Chrome is now directly supported as an addon (rather
than requiring it be installed via `addons: apt: packages:
-google-chrome-stable`), and the source of the error is well-documented
in the Travis docs:

  https://docs.travis-ci.com/user/chrome#Sandboxing

This change applies the `--no-sandbox` flag for headless Google Chrome
via the `./go test browser --single-run` command and via Karma. Updated
the `mocha-chrome` package and moved it from `dependencies:` to
`devDependencies:` in the process.
The previous commit caused the build to continue to fail in part because
the removal of `xvfb` caused the Firefox Karma run to fail. This commit
should fix that aspect of the breakage by enabling a headless Firefox
run:

https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-the-Firefox-addon-in-headless-mode
This should've been included in the commit before last to fix the Travis
CI build failure due to sandboxing being eventually disabled:

https://docs.travis-ci.com/user/chrome#Sandboxing
@mbland mbland added this to the v1.0.0 milestone Feb 5, 2018
@mbland mbland self-assigned this Feb 5, 2018
Copy link
Collaborator

@akashvbabu akashvbabu left a comment

Choose a reason for hiding this comment

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

Looks good to me

@mbland
Copy link
Owner Author

mbland commented Feb 5, 2018

Coveralls is dragging in pushing its report to GitHub...will merge now, but keep the branch around until the Coveralls run has reported back.

@mbland mbland merged commit 6d713c2 into master Feb 5, 2018
@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.061% when pulling e588c3f on travis-ci-fix into 42960b6 on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.061% when pulling e588c3f on travis-ci-fix into 42960b6 on master.

@mbland mbland deleted the travis-ci-fix branch February 6, 2018 01:40
akashvbabu added a commit that referenced this pull request Apr 6, 2018
Chromium started failing with the same issue as in #169, so we had to Chromium to the list of filters to work around karma-detect-browsers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
v1.0.0
Awaiting triage
Development

Successfully merging this pull request may close these issues.

None yet

3 participants