Skip to content

Commit

Permalink
[packages] migrate all plugins to packages (elastic#148130)
Browse files Browse the repository at this point in the history
Fixes elastic#149344

This PR migrates all plugins to packages automatically. It does this
using `node scripts/lint_packages` to automatically migrate
`kibana.json` files to `kibana.jsonc` files. By doing this automatically
we can simplify many build and testing procedures to only support
packages, and not both "packages" and "synthetic packages" (basically
pointers to plugins).

The majority of changes are in operations related code, so we'll be
having operations review this before marking it ready for review. The
vast majority of the code owners are simply pinged because we deleted
all `kibana.json` files and replaced them with `kibana.jsonc` files, so
we plan on leaving the PR ready-for-review for about 24 hours before
merging (after feature freeze), assuming we don't have any blockers
(especially from @elastic/kibana-core since there are a few core
specific changes, though the majority were handled in elastic#149370).

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
Spencer and kibanamachine authored Feb 9, 2023
1 parent 26c8d71 commit 1b85815
Show file tree
Hide file tree
Showing 1,044 changed files with 11,345 additions and 11,124 deletions.
17 changes: 9 additions & 8 deletions .buildkite/scripts/build_kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ export KBN_NP_PLUGINS_BUILT=true

echo "--- Build Kibana Distribution"

BUILD_ARGS=""
is_pr_with_label "ci:build-all-platforms" && BUILD_ARGS="--all-platforms"
is_pr_with_label "ci:build-example-plugins" && BUILD_ARGS="$BUILD_ARGS --example-plugins"
is_pr_with_label "ci:build-docker-cross-compile" && BUILD_ARG="$BUILD_ARGS --docker-cross-compile"
is_pr_with_label "ci:build-os-packages" || BUILD_ARGS="$BUILD_ARGS --skip-os-packages"
is_pr_with_label "ci:build-canvas-shareable-runtime" || BUILD_ARGS="$BUILD_ARGS --skip-canvas-shareable-runtime"
is_pr_with_label "ci:build-docker-contexts" || BUILD_ARGS="$BUILD_ARGS --skip-docker-contexts"
node scripts/build $BUILD_ARGS
BUILD_ARGS=("--with-test-plugins" "--with-example-plugins")
is_pr_with_label "ci:build-all-platforms" && BUILD_ARGS+=("--all-platforms")
is_pr_with_label "ci:build-docker-cross-compile" && BUILD_ARGS+=("--docker-cross-compile")
is_pr_with_label "ci:build-os-packages" || BUILD_ARGS+=("--skip-os-packages")
is_pr_with_label "ci:build-canvas-shareable-runtime" || BUILD_ARGS+=("--skip-canvas-shareable-runtime")
is_pr_with_label "ci:build-docker-contexts" || BUILD_ARGS+=("--skip-docker-contexts")

echo "> node scripts/build" "${BUILD_ARGS[@]}"
node scripts/build "${BUILD_ARGS[@]}"

if is_pr_with_label "ci:build-cloud-image"; then
echo "$KIBANA_DOCKER_PASSWORD" | docker login -u "$KIBANA_DOCKER_USERNAME" --password-stdin docker.elastic.co
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/artifacts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -euo pipefail
source .buildkite/scripts/steps/artifacts/env.sh

echo "--- Build Kibana artifacts"
node scripts/build --all-platforms --debug --docker-cross-compile $(echo "$BUILD_ARGS")
node scripts/build --all-platforms --debug --docker-cross-compile "${BUILD_ARGS[@]}"

echo "--- Extract default i18n messages"
mkdir -p target/i18n
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/artifacts/docker_context.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ KIBANA_DOCKER_CONTEXT="${KIBANA_DOCKER_CONTEXT:="default"}"

echo "--- Create contexts"
mkdir -p target
node scripts/build --skip-initialize --skip-generic-folders --skip-platform-folders --skip-archives --docker-context-use-local-artifact $(echo "$BUILD_ARGS")
node scripts/build --skip-initialize --skip-generic-folders --skip-platform-folders --skip-archives --docker-context-use-local-artifact "${BUILD_ARGS[@]}"

echo "--- Setup context"
DOCKER_BUILD_FOLDER=$(mktemp -d)
Expand Down
4 changes: 2 additions & 2 deletions .buildkite/scripts/steps/artifacts/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ fi

if [[ "$RELEASE_BUILD" == "true" ]]; then
FULL_VERSION="$QUALIFIER_VERSION"
BUILD_ARGS="--release --version-qualifier=$VERSION_QUALIFIER"
BUILD_ARGS=("--release" "--version-qualifier=$VERSION_QUALIFIER")
WORKFLOW="staging"
else
FULL_VERSION="$QUALIFIER_VERSION-SNAPSHOT"
BUILD_ARGS="--version-qualifier=$VERSION_QUALIFIER"
BUILD_ARGS=("--version-qualifier=$VERSION_QUALIFIER")
WORKFLOW="snapshot"
fi

Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export DISABLE_BOOTSTRAP_VALIDATION=false
.buildkite/scripts/bootstrap.sh

.buildkite/scripts/steps/checks/precommit_hook.sh
.buildkite/scripts/steps/checks/packages.sh
.buildkite/scripts/steps/checks/ts_projects.sh
.buildkite/scripts/steps/checks/packages.sh
.buildkite/scripts/steps/checks/bazel_packages.sh
Expand All @@ -18,7 +19,6 @@ export DISABLE_BOOTSTRAP_VALIDATION=false
.buildkite/scripts/steps/checks/i18n.sh
.buildkite/scripts/steps/checks/file_casing.sh
.buildkite/scripts/steps/checks/licenses.sh
.buildkite/scripts/steps/checks/plugins_with_circular_deps.sh
.buildkite/scripts/steps/checks/test_projects.sh
.buildkite/scripts/steps/checks/test_hardening.sh
.buildkite/scripts/steps/checks/ftr_configs.sh
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/checks/packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail

source .buildkite/scripts/common/util.sh

echo --- Lint packages
echo --- Lint Packages
cmd="node scripts/lint_packages"
if is_pr && ! is_auto_commit_disabled; then
cmd="$cmd --fix"
Expand Down
8 changes: 0 additions & 8 deletions .buildkite/scripts/steps/checks/plugins_with_circular_deps.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/checks/ts_projects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail

source .buildkite/scripts/common/util.sh

echo --- Lint TS projects
echo --- Lint TS Projects
cmd="node scripts/lint_ts_projects"
if is_pr && ! is_auto_commit_disabled; then
cmd="$cmd --fix"
Expand Down
7 changes: 5 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const VENN_DIAGRAM_HEADER = `

/** Packages which should not be included within production code. */
const DEV_PACKAGE_DIRS = getPackages(REPO_ROOT).flatMap((pkg) =>
pkg.isDevOnly ? pkg.normalizedRepoRelativeDir : []
pkg.isDevOnly() ? pkg.normalizedRepoRelativeDir : []
);

/** Directories (at any depth) which include dev-only code. */
Expand Down Expand Up @@ -1734,7 +1734,10 @@ module.exports = {
* Code inside .buildkite runs separately from everything else in CI, before bootstrap, with ts-node. It needs a few tweaks because of this.
*/
{
files: 'packages/kbn-{package-*,repo-*,dep-*}/**/*',
files: [
'packages/kbn-{package-*,repo-*,dep-*}/**/*',
'packages/kbn-find-used-node-modules/**/*',
],
rules: {
'max-classes-per-file': 'off',
},
Expand Down
Loading

0 comments on commit 1b85815

Please sign in to comment.