Skip to content

Commit

Permalink
[yarn] download prebuilt artifacts for re2 and node-sass from custom …
Browse files Browse the repository at this point in the history
…mirrors (#126820)

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit c509fda)

# Conflicts:
#	yarn.lock
  • Loading branch information
Spencer committed Mar 3, 2022
1 parent ccaaadb commit e9a0e6b
Show file tree
Hide file tree
Showing 8 changed files with 816 additions and 902 deletions.
4 changes: 4 additions & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,8 @@ yarn_install(
symlink_node_modules = True,
quiet = False,
frozen_lockfile = False,
environment = {
"SASS_BINARY_SITE": "https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-sass",
"RE2_DOWNLOAD_MIRROR": "https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2",
}
)
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"docs:acceptApiChanges": "node --max-old-space-size=6144 scripts/check_published_api_changes.js --accept",
"es": "node scripts/es",
"preinstall": "node ./preinstall_check",
"postinstall": "node scripts/kbn patch_native_modules",
"kbn": "node scripts/kbn",
"lint": "yarn run lint:es && yarn run lint:style",
"lint:es": "node scripts/eslint",
Expand Down Expand Up @@ -334,7 +333,7 @@
"raw-loader": "^3.1.0",
"rbush": "^3.0.1",
"re-resizable": "^6.1.1",
"re2": "^1.16.0",
"re2": "1.17.4",
"react": "^16.12.0",
"react-ace": "^7.0.5",
"react-beautiful-dnd": "^13.0.0",
Expand Down Expand Up @@ -836,7 +835,7 @@
"multimatch": "^4.0.0",
"mutation-observer": "^1.0.3",
"ncp": "^2.0.0",
"node-sass": "^6.0.1",
"node-sass": "6.0.1",
"null-loader": "^3.0.0",
"nyc": "^15.1.0",
"oboe": "^2.1.4",
Expand Down
1,441 changes: 681 additions & 760 deletions packages/kbn-pm/dist/index.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions packages/kbn-pm/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { CleanCommand } from './clean';
import { ResetCommand } from './reset';
import { RunCommand } from './run';
import { WatchCommand } from './watch';
import { PatchNativeModulesCommand } from './patch_native_modules';
import { Kibana } from '../utils/kibana';

export const commands: { [key: string]: ICommand } = {
Expand All @@ -42,5 +41,4 @@ export const commands: { [key: string]: ICommand } = {
reset: ResetCommand,
run: RunCommand,
watch: WatchCommand,
patch_native_modules: PatchNativeModulesCommand,
};
68 changes: 0 additions & 68 deletions packages/kbn-pm/src/commands/patch_native_modules.ts

This file was deleted.

6 changes: 6 additions & 0 deletions packages/kbn-pm/src/utils/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ export async function installInDir(directory: string, extraArgs: string[] = [])
// given time (e.g. to avoid conflicts).
await spawn(YARN_EXEC, options, {
cwd: directory,
env: {
SASS_BINARY_SITE:
'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-sass',
RE2_DOWNLOAD_MIRROR:
'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2',
},
});
}

Expand Down
48 changes: 29 additions & 19 deletions src/dev/build/tasks/patch_native_modules_task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,50 @@ interface Package {
const packages: Package[] = [
{
name: 're2',
version: '1.16.0',
version: '1.17.4',
destinationPath: 'node_modules/re2/build/Release/re2.node',
extractMethod: 'gunzip',
archives: {
'darwin-x64': {
url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/darwin-x64-93.gz',
sha256: 'a267c6202d86d08170eb4a833acf81d83660ce33e8981fcd5b7f6e0310961d56',
url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.17.4/darwin-x64-93.gz',
sha256: '9558c5cb39622e9b3653203e772b129d6c634e7dbd7af1b244352fc1d704601f',
},
'linux-x64': {
url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/linux-x64-93.gz',
sha256: 'e0ca5d6527fe7ec0fe98b6960c47b66a5bb2823c3bebb3bf4ed4d58eed3d23c5',
url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.17.4/linux-x64-93.gz',
sha256: '4d06747b266c75b6f7ced93977692c0586ce6a52924cabb569bd966378941aa1',
},

// ARM build is currently done manually as Github Actions used in upstream project
// ARM builds are currently done manually as Github Actions used in upstream project
// do not natively support an ARM target.

// From a AWS Graviton instance:
// * checkout the node-re2 project,
// * install Node using the same minor used by Kibana
// * git submodule update --init --recursive to download re2
// * npm install, which will also create a build
// * gzip -c build/Release/re2.node > linux-arm64-83.gz
// * upload to kibana-ci-proxy-cache bucket
// From a AWS Graviton instance running Ubuntu:
// * install build-essential package
// * install nvm and the node version used by the Kibana repository
// * `npm install [email protected]`
// * re2 will build itself on install
// * `cp node_modules/re2/build/Release/re2.node > linux-arm64-$(node -e "console.log(process.versions.modules)")
// * `gzip linux-arm64-*`
// * capture the sha256 with: `shasum -a 256 linux-arm64-*`
// * upload the `linux-arm64-*.gz` artifact to the `yarn-prebuilt-assets` bucket in GCS using the correct version number
'linux-arm64': {
url: 'https://storage.googleapis.com/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.16.0/linux-arm64-93.gz',
sha256: '7a786e0b75985e5aafdefa9af55cad8e85e69a3326f16d8c63d21d6b5b3bff1b',
url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.17.4/linux-arm64-93.gz',
sha256: '25409584f76f3d6ed85463d84adf094eb6e256ed1cb0b754b95bcbda6691fc26',
},

// A similar process is necessary for building on ARM macs:
// * bootstrap and re2 will build itself on install
// * `cp node_modules/re2/build/Release/re2.node > darwin-arm64-$(node -e "console.log(process.versions.modules)")
// * `gzip darwin-arm64-*`
// * capture the sha256 with: `shasum -a 256 darwin-arm64-*`
// * upload the `darwin-arm64-*.gz` artifact to the `yarn-prebuilt-assets` bucket in GCS using the correct version number
'darwin-arm64': {
url: 'https://storage.googleapis.com/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.16.0/darwin-arm64-93.gz',
sha256: '28b540cdddf13578f1bd28a03e29ffdc26a7f00ec859c369987b8d51ec6357c8',
url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.17.4/darwin-arm64-93.gz',
sha256: 'd4b708749ddef1c87019f6b80e051ed0c29ccd1de34f233c47d8dcaddf803872',
},

'win32-x64': {
url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/win32-x64-93.gz',
sha256: '37245ceb59a086b5e7e9de8746a3cdf148c383be9ae2580f92baea90d0d39947',
url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.17.4/win32-x64-93.gz',
sha256: '0320d0c0385432944c6fb3c8c8fcd78d440ce5626f7618f9ec71d88e44820674',
},
},
},
Expand Down
Loading

0 comments on commit e9a0e6b

Please sign in to comment.