diff --git a/.buildkite/scripts/bootstrap.sh b/.buildkite/scripts/bootstrap.sh index 76e6352d7cee..dbba709d883d 100755 --- a/.buildkite/scripts/bootstrap.sh +++ b/.buildkite/scripts/bootstrap.sh @@ -15,7 +15,7 @@ if ! yarn kbn bootstrap; then rm -rf node_modules echo "--- yarn install and bootstrap, attempt 2" - yarn kbn bootstrap + yarn kbn bootstrap --force-install fi if [[ "$DISABLE_BOOTSTRAP_VALIDATION" != "true" ]]; then diff --git a/packages/kbn-pm/dist/index.js b/packages/kbn-pm/dist/index.js index f836dff911c9..4ff6cedfbc09 100644 --- a/packages/kbn-pm/dist/index.js +++ b/packages/kbn-pm/dist/index.js @@ -8910,10 +8910,9 @@ const BootstrapCommand = { const kibanaProjectPath = ((_projects$get = projects.get('kibana')) === null || _projects$get === void 0 ? void 0 : _projects$get.path) || ''; const runOffline = (options === null || options === void 0 ? void 0 : options.offline) === true; const reporter = _kbn_dev_utils_ci_stats_reporter__WEBPACK_IMPORTED_MODULE_1__["CiStatsReporter"].fromEnv(_utils_log__WEBPACK_IMPORTED_MODULE_2__["log"]); - const timings = []; // Force install is set in case a flag is passed into yarn kbn bootstrap or if the `.yarn-integrity` - // file is not found which will be indicated by the return of yarnIntegrityFileExists. + const timings = []; // Force install is set in case a flag is passed into yarn kbn bootstrap - const forceInstall = !!options && options['force-install'] === true || !(await Object(_utils_bazel__WEBPACK_IMPORTED_MODULE_9__["yarnIntegrityFileExists"])(Object(path__WEBPACK_IMPORTED_MODULE_0__["resolve"])(kibanaProjectPath, 'node_modules'))); // Install bazel machinery tools if needed + const forceInstall = !!options && options['force-install'] === true; // Install bazel machinery tools if needed await Object(_utils_bazel__WEBPACK_IMPORTED_MODULE_9__["installBazelTools"])(rootPath); // Setup remote cache settings in .bazelrc.cache if needed @@ -52575,8 +52574,6 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _yarn_integrity__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(526); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeYarnIntegrityFileIfExists", function() { return _yarn_integrity__WEBPACK_IMPORTED_MODULE_3__["removeYarnIntegrityFileIfExists"]; }); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "yarnIntegrityFileExists", function() { return _yarn_integrity__WEBPACK_IMPORTED_MODULE_3__["yarnIntegrityFileExists"]; }); - /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License @@ -52802,6 +52799,7 @@ async function runBazelCommandWithRunner(bazelCommandRunner, bazelArgs, offline try { await bazelProc; } catch { + _log__WEBPACK_IMPORTED_MODULE_5__["log"].error('HINT: If experiencing problems with node_modules try `yarn kbn bootstrap --force-install` or as last resort `yarn kbn reset && yarn kbn bootstrap`'); throw new _errors__WEBPACK_IMPORTED_MODULE_6__["CliError"](`The bazel command that was running failed to complete.`); } @@ -59009,7 +59007,6 @@ function observeReadable(readable) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeYarnIntegrityFileIfExists", function() { return removeYarnIntegrityFileIfExists; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yarnIntegrityFileExists", function() { return yarnIntegrityFileExists; }); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(231); @@ -59033,19 +59030,6 @@ async function removeYarnIntegrityFileIfExists(nodeModulesPath) { } catch {// no-op } } -async function yarnIntegrityFileExists(nodeModulesPath) { - try { - const nodeModulesRealPath = await Object(_fs__WEBPACK_IMPORTED_MODULE_1__["tryRealpath"])(nodeModulesPath); - const yarnIntegrityFilePath = Object(path__WEBPACK_IMPORTED_MODULE_0__["join"])(nodeModulesRealPath, '.yarn-integrity'); // check if the file already exists - - if (await Object(_fs__WEBPACK_IMPORTED_MODULE_1__["isFile"])(yarnIntegrityFilePath)) { - return true; - } - } catch {// no-op - } - - return false; -} /***/ }), /* 527 */ diff --git a/packages/kbn-pm/src/commands/bootstrap.ts b/packages/kbn-pm/src/commands/bootstrap.ts index cb5d5d88f84b..b5a9645047c0 100644 --- a/packages/kbn-pm/src/commands/bootstrap.ts +++ b/packages/kbn-pm/src/commands/bootstrap.ts @@ -17,12 +17,7 @@ import { ICommand } from './'; import { readYarnLock } from '../utils/yarn_lock'; import { sortPackageJson } from '../utils/sort_package_json'; import { validateDependencies } from '../utils/validate_dependencies'; -import { - installBazelTools, - removeYarnIntegrityFileIfExists, - runBazel, - yarnIntegrityFileExists, -} from '../utils/bazel'; +import { installBazelTools, removeYarnIntegrityFileIfExists, runBazel } from '../utils/bazel'; import { setupRemoteCache } from '../utils/bazel/setup_remote_cache'; export const BootstrapCommand: ICommand = { @@ -42,11 +37,8 @@ export const BootstrapCommand: ICommand = { const reporter = CiStatsReporter.fromEnv(log); const timings = []; - // Force install is set in case a flag is passed into yarn kbn bootstrap or if the `.yarn-integrity` - // file is not found which will be indicated by the return of yarnIntegrityFileExists. - const forceInstall = - (!!options && options['force-install'] === true) || - !(await yarnIntegrityFileExists(resolve(kibanaProjectPath, 'node_modules'))); + // Force install is set in case a flag is passed into yarn kbn bootstrap + const forceInstall = !!options && options['force-install'] === true; // Install bazel machinery tools if needed await installBazelTools(rootPath); diff --git a/packages/kbn-pm/src/utils/bazel/run.ts b/packages/kbn-pm/src/utils/bazel/run.ts index c030081e53da..18a6cacdf6d2 100644 --- a/packages/kbn-pm/src/utils/bazel/run.ts +++ b/packages/kbn-pm/src/utils/bazel/run.ts @@ -52,6 +52,9 @@ async function runBazelCommandWithRunner( try { await bazelProc; } catch { + log.error( + 'HINT: If experiencing problems with node_modules try `yarn kbn bootstrap --force-install` or as last resort `yarn kbn reset && yarn kbn bootstrap`' + ); throw new CliError(`The bazel command that was running failed to complete.`); } await bazelLogs$.toPromise(); diff --git a/packages/kbn-pm/src/utils/bazel/yarn_integrity.ts b/packages/kbn-pm/src/utils/bazel/yarn_integrity.ts index 76910786898a..1ac9bfeba1e3 100644 --- a/packages/kbn-pm/src/utils/bazel/yarn_integrity.ts +++ b/packages/kbn-pm/src/utils/bazel/yarn_integrity.ts @@ -22,19 +22,3 @@ export async function removeYarnIntegrityFileIfExists(nodeModulesPath: string) { // no-op } } - -export async function yarnIntegrityFileExists(nodeModulesPath: string) { - try { - const nodeModulesRealPath = await tryRealpath(nodeModulesPath); - const yarnIntegrityFilePath = join(nodeModulesRealPath, '.yarn-integrity'); - - // check if the file already exists - if (await isFile(yarnIntegrityFilePath)) { - return true; - } - } catch { - // no-op - } - - return false; -}