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

chore(NA): manage npm dependencies within bazel #92864

Merged
merged 44 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a463565
chore(NA): full WORKSPACE.bazel logic plus manage yarn dependencies w…
mistic Feb 5, 2021
ce62ee6
chore(NA): update BUILD.bazel files comments on root and packages
mistic Feb 5, 2021
6188d73
chore(NA): add workspace file with useful data
mistic Feb 5, 2021
8b4ed1d
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Feb 6, 2021
9a4233c
chore(NA): install deps through bazel
mistic Feb 6, 2021
8ea0510
chore(NA): update workspace file
mistic Feb 6, 2021
9e909a2
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Feb 6, 2021
881f394
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Feb 11, 2021
7d74bdf
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Feb 16, 2021
749faeb
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Feb 17, 2021
cbc51fa
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Feb 17, 2021
9290d10
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Feb 19, 2021
d570b0f
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Feb 22, 2021
9ab353a
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Feb 22, 2021
5e12549
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Feb 23, 2021
ad033fc
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Feb 23, 2021
a87cc5c
chore(NA): update into last rules nodejs
mistic Feb 24, 2021
7755267
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Feb 24, 2021
54217bb
chore(NA): ensure bazel always run yarn install
mistic Feb 25, 2021
c35f012
chore(NA): support offline mode
mistic Feb 25, 2021
e90c9d1
chore(NA): remove elastic-datemath
mistic Feb 25, 2021
53043b8
chore(NA): merge and solve conflicts with master
mistic Feb 25, 2021
21efe9b
chore(NA): restore bazel 4.0.0
mistic Feb 25, 2021
a5fb654
chore(NA): update kbn pm dist
mistic Feb 25, 2021
89906db
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Feb 25, 2021
ccccd76
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Feb 25, 2021
da58249
chore(NA): introduce force-install command
mistic Feb 25, 2021
a137039
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Feb 26, 2021
c17bb28
Merge branch 'master' into manage-npm-dependencies-with-bazel
kibanamachine Feb 27, 2021
c1d0c4e
Merge branch 'manage-npm-dependencies-with-bazel' of github.com:misti…
mistic Feb 28, 2021
80ac0d5
Merge branch 'master' into manage-npm-dependencies-with-bazel
kibanamachine Mar 1, 2021
515104e
Merge branch 'manage-npm-dependencies-with-bazel' of github.com:misti…
mistic Mar 1, 2021
551d476
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Mar 1, 2021
511568e
Merge branch 'master' into manage-npm-dependencies-with-bazel
kibanamachine Mar 1, 2021
838953b
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Mar 2, 2021
5d67d00
Merge branch 'manage-npm-dependencies-with-bazel' of github.com:misti…
mistic Mar 2, 2021
3e5aac2
chore(NA): merge and solve conflicts with master
mistic Mar 3, 2021
2b3d67b
docs(NA): update docs with new yarn kbn bootstrap flags
mistic Mar 3, 2021
d385bbd
chore(NA): use path.resolve on kbn bootstrap integrity check verifica…
mistic Mar 3, 2021
bcf7aa1
chore(NA): update .yarnrc
mistic Mar 3, 2021
862df29
chore(NA): change cli argument typo
mistic Mar 3, 2021
ab5d4ee
Merge branch 'manage-npm-dependencies-with-bazel' of github.com:misti…
mistic Mar 3, 2021
d66cf7a
Merge remote-tracking branch 'upstream/master' into manage-npm-depend…
mistic Mar 3, 2021
d1221cf
chore(NA): fix spacing on kbn pm cli
mistic Mar 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ build --workspace_status_command="node ./src/dev/bazel_workspace_status.js"
# build --build_metadata=VISIBILITY=PUBLIC
build --build_metadata=TEST_GROUPS=//packages

###############################
# Offline Support #
# Turn on these settings with #
# --config=offline #
tylersmalley marked this conversation as resolved.
Show resolved Hide resolved
###############################

## Reset remote cache and backend support
build:offline --bes_backend="" --remote_cache=""
run:offline --bes_backend="" --remote_cache=""
4 changes: 3 additions & 1 deletion .bazelrc.common
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

# Local Cache Settings
## Avoid cache results from being corrupt when changing source during build
common --experimental_guard_against_concurrent_changes
build --experimental_guard_against_concurrent_changes
run --experimental_guard_against_concurrent_changes
test --experimental_guard_against_concurrent_changes

## Cache action outputs on disk so they persist across output_base and bazel shutdown (eg. changing branches)
build --disk_cache=~/.bazel-cache/disk-cache
Expand Down
6 changes: 6 additions & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ yarn-offline-mirror ".yarn-local-mirror"

# Always look into the cache first before fetching online
--install.prefer-offline true

# Disable interactive and progress logs as yarn install is now
# managed by Bazel and we are piping the longs from the underlying
mistic marked this conversation as resolved.
Show resolved Hide resolved
# process running bazel into the parent one running kbn
--install.non-interactive true
--install.no-progress true
2 changes: 2 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Expose those targets as they are required as part of
# other packages builds and need to be included as inputs
exports_files(
[
"tsconfig.json",
Expand Down
67 changes: 66 additions & 1 deletion WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,68 @@
# Define the workspace base name and a managed directory by bazel
# that will hold the node_modules called @npm
workspace(
name = "kibana",
name = "kibana",
managed_directories = {"@npm": ["node_modules"]},
)

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# Fetch Node.js rules
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "bfacf15161d96a6a39510e7b3d3b522cf61cb8b82a31e79400a84c5abcab5347",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.2.1/rules_nodejs-3.2.1.tar.gz"],
)

# Now that we have the rules let's import from them to complete the work
load("@build_bazel_rules_nodejs//:index.bzl", "check_rules_nodejs_version", "node_repositories", "yarn_install")

# Assure we have at least a given rules_nodejs version
check_rules_nodejs_version(minimum_version_string = "3.2.1")

# Setup the Node.js toolchain for the architectures we want to support
#
# NOTE: darwin-arm64 is not being installed because bazel is not yet available on that architecture.
# The PR for it was merged and should be available in the next release of bazel and bazelisk. As soon as they have it
# we can update that rule.
node_repositories(
node_repositories = {
"14.16.0-darwin_amd64": ("node-v14.16.0-darwin-x64.tar.gz", "node-v14.16.0-darwin-x64", "14ec767e376d1e2e668f997065926c5c0086ec46516d1d45918af8ae05bd4583"),
"14.16.0-linux_arm64": ("node-v14.16.0-linux-arm64.tar.xz", "node-v14.16.0-linux-arm64", "440489a08bfd020e814c9e65017f58d692299ac3f150c8e78d01abb1104c878a"),
"14.16.0-linux_s390x": ("node-v14.16.0-linux-s390x.tar.xz", "node-v14.16.0-linux-s390x", "335348e46f45284b6356416ef58f85602d2dee99094588b65900f6c8839df77e"),
"14.16.0-linux_amd64": ("node-v14.16.0-linux-x64.tar.xz", "node-v14.16.0-linux-x64", "2e079cf638766fedd720d30ec8ffef5d6ceada4e8b441fc2a093cb9a865f4087"),
"14.16.0-windows_amd64": ("node-v14.16.0-win-x64.zip", "node-v14.16.0-win-x64", "716045c2f16ea10ca97bd04cf2e5ef865f9c4d6d677a9bc25e2ea522b594af4f"),
},
node_version = "14.16.0",
node_urls = [
"https://nodejs.org/dist/v{version}/{filename}",
],
yarn_repositories = {
"1.21.1": ("yarn-v1.21.1.tar.gz", "yarn-v1.21.1", "d1d9f4a0f16f5ed484e814afeb98f39b82d4728c6c8beaafb5abc99c02db6674"),
},
yarn_version = "1.21.1",
yarn_urls = [
"https://github.com/yarnpkg/yarn/releases/download/v{version}/{filename}",
],
package_json = ["//:package.json"],
)

# Run yarn_install rule to take care of dependencies
#
# NOTE: FORCE_COLOR env var forces colors on non tty mode
yarn_install(
name = "npm",
environment = {
"FORCE_COLOR": "True",
},
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
data = [
"//:.yarnrc",
"//:preinstall_check.js",
"//:node_modules/.yarn-integrity",
],
symlink_node_modules = True,
quiet = False,
frozen_lockfile = False,
)
17 changes: 17 additions & 0 deletions docs/developer/getting-started/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ https://github.com/nodejs/node-gyp#installation[https://github.com/nodejs/node-g
and follow the guide according your platform.
____

In case you don't have an internet connection, the `yarn kbn bootstrap` command will
fail. As it is likely you have the required node_modules in the
offline mirror, you can try to run the step in offline mode by using:

[source,bash]
----
yarn kbn bootstrap --offline
----

In any other circumstance where you want to force the node_modules install step
you can use:

[source,bash]
----
yarn kbn bootstrap --force-install
----

(You can also run `yarn kbn` to see the other available commands. For
more info about this tool, see
{kib-repo}tree/{branch}/packages/kbn-pm[{kib-repo}tree/{branch}/packages/kbn-pm].)
Expand Down
3 changes: 2 additions & 1 deletion packages/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Call each package final target
# Grouping target to call all underlying packages build
# targets so we can build them all at once
filegroup(
name = "build",
srcs = [],
Expand Down
Loading