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

[PM] Enhance single version requirements imposed during bootstrapping #5675

Merged
merged 1 commit into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Decouple] Add new cross compatibility check core service which export functionality for plugins to verify if their OpenSearch plugin counterpart is installed on the cluster or has incompatible version to configure the plugin behavior([#4710](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4710))
- [Discover] Display inner properties in the left navigation bar [#5429](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5429)
- [Chrome] Introduce registerCollapsibleNavHeader to allow plugins to customize the rendering of nav menu header ([#5244](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5244))
- [PM] Enhance single version requirements imposed during bootstrapping ([#5675](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5675))
- [Custom Branding] Relative URL should be allowed for logos ([#5572](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5572))

### 🐛 Bug Fixes
Expand Down
34 changes: 34 additions & 0 deletions packages/osd-pm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,40 @@ yarn osd
Bootstrapping also calls the `osd:bootstrap` script for every included project.
This is intended for packages that need to be built/transpiled to be usable.

#### Single-version validation

Bootstrapping, by default, applies a `strict` single-version validation where it requires all the dependencies defined
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we clarify what does single version validation mean and probably giving an example. that will help. let's say HelloPlugin

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really all that it is:

Bootstrapping, by default, applies a `strict` single-version validation where it requires all 
the dependencies defined more than once to have the same version-range in the `package.json`
files of Dashboards, packages, and plugins. If a violation is identified, bootstrapping terminates
with an error.

Unfortunately, I don't know the exact reasons behind its existence; I have some theories but I am having a hard time defending them.

more than once to have the same version-range in the `package.json` files of Dashboards, packages, and plugins. If a
violation is identified, bootstrapping terminates with an error. This behavior can be controlled using the
`--single-version` switch. Using any switch other than the default can result in the installation of versions of the
dependencies that were never tested and this could lead to unexpected results.

```
yarn osd bootstrap --single-version=loose
```
In `loose` mode, bootstrapping reconciles the various versions installed as a result of having multiple ranges for a
dependency, by choosing one that satisfies all said ranges. Even though installing the chosen version updates the
`yarn.lock` files, no `package.json` changes would be needed.

```
yarn osd bootstrap --single-version=force
```
In `force` mode, bootstrapping acts like `loose` for each dependency. If despite that, a suitable version was not found,
it switches to behave like the `brute-force` mode (see below).

```
yarn osd bootstrap --single-version=brute-force
```
In `brute-force` mode, bootstrapping chooses the newest of the various versions installed, irrespective of whether it
satisfies any of the ranges. Installing the chosen version, bootstrapping updates the `yarn.lock` files and applies a
range, in the form of `^<version>`, to all `package.json` files that declared the dependency.

```
yarn osd bootstrap --single-version=ignore
```
In `ignore` mode, bootstrapping behaves very similar to the `strict` mode by showing errors when different ranges of a
package are marked as dependencies, but without terminating.

### Running scripts

Some times you want to run the same script across multiple packages and plugins,
Expand Down
Loading
Loading