From 65580d92f45e9e09fc5e8b56f49169ff655b2403 Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Wed, 16 Nov 2022 19:08:37 -0600 Subject: [PATCH] fix linux build --- .circleci/config.yml | 10 +++++----- packages/data-context/src/data/ProjectConfigIpc.ts | 13 +++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ece7fad43a0c..5d401a3a1f80 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,7 +27,7 @@ mainBuildFilters: &mainBuildFilters branches: only: - develop - - 'ryanm/fix/typescript-issue' + - 'ryanm/fix/cy-in-cy-and-v8-snapshots' # usually we don't build Mac app - it takes a long time # but sometimes we want to really confirm we are doing the right thing @@ -36,7 +36,7 @@ macWorkflowFilters: &darwin-workflow-filters when: or: - equal: [ develop, << pipeline.git.branch >> ] - - equal: [ 'ryanm/fix/typescript-issue', << pipeline.git.branch >> ] + - equal: [ 'ryanm/fix/cy-in-cy-and-v8-snapshots', << pipeline.git.branch >> ] - matches: pattern: "-release$" value: << pipeline.git.branch >> @@ -45,7 +45,7 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters when: or: - equal: [ develop, << pipeline.git.branch >> ] - - equal: [ 'ryanm/fix/typescript-issue', << pipeline.git.branch >> ] + - equal: [ 'ryanm/fix/cy-in-cy-and-v8-snapshots', << pipeline.git.branch >> ] - matches: pattern: "-release$" value: << pipeline.git.branch >> @@ -63,7 +63,7 @@ windowsWorkflowFilters: &windows-workflow-filters when: or: - equal: [ develop, << pipeline.git.branch >> ] - - equal: [ 'ryanm/fix/typescript-issue', << pipeline.git.branch >> ] + - equal: [ 'ryanm/fix/cy-in-cy-and-v8-snapshots', << pipeline.git.branch >> ] - matches: pattern: "-release$" value: << pipeline.git.branch >> @@ -130,7 +130,7 @@ commands: - run: name: Check current branch to persist artifacts command: | - if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "ryanm/fix/typescript-issue" ]]; then + if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "ryanm/fix/cy-in-cy-and-v8-snapshots" ]]; then echo "Not uploading artifacts or posting install comment for this branch." circleci-agent step halt fi diff --git a/packages/data-context/src/data/ProjectConfigIpc.ts b/packages/data-context/src/data/ProjectConfigIpc.ts index a5cbb7215338..c441c4be01fb 100644 --- a/packages/data-context/src/data/ProjectConfigIpc.ts +++ b/packages/data-context/src/data/ProjectConfigIpc.ts @@ -10,6 +10,7 @@ import debugLib from 'debug' import { autoBindDebug, hasTypeScriptInstalled, toPosix } from '../util' import _ from 'lodash' import { pathToFileURL } from 'url' +import os from 'os' const pkg = require('@packages/root') const debug = debugLib(`cypress:lifecycle:ProjectConfigIpc`) @@ -21,6 +22,14 @@ const tsNode = toPosix(require.resolve('@packages/server/lib/plugins/child/regis export type IpcHandler = (ipc: ProjectConfigIpc) => void +/** + * If running as root on Linux, no-sandbox must be passed or Chrome will not start + */ +const isSandboxNeeded = () => { + // eslint-disable-next-line no-restricted-properties + return (os.platform() === 'linux') && (process.geteuid && process.geteuid() === 0) +} + export interface SetupNodeEventsReply { setupConfig: Cypress.ConfigOptions | null requires: string[] @@ -311,6 +320,10 @@ export class ProjectConfigIpc extends EventEmitter { } if (process.env.CYPRESS_INTERNAL_E2E_TESTING_SELF_PARENT_PROJECT) { + if (isSandboxNeeded()) { + configProcessArgs.push('--no-sandbox') + } + return spawn(process.execPath, ['--entryPoint', CHILD_PROCESS_FILE_PATH, ...configProcessArgs], { ...childOptions, stdio: ['pipe', 'pipe', 'pipe', 'ipc'],