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

Updates Dev guide #897

Merged
merged 5 commits into from
Jun 29, 2022
Merged

Conversation

DarshitChanpura
Copy link
Member

@DarshitChanpura DarshitChanpura commented Feb 1, 2022

Description

Enhances the dev-guide to be more elaborative and intuitive.

Category

Documentation

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@DarshitChanpura DarshitChanpura requested a review from a team February 1, 2022 23:01
@codecov-commenter
Copy link

codecov-commenter commented Feb 1, 2022

Codecov Report

Merging #897 (f6c152b) into main (f0cb0c4) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #897   +/-   ##
=======================================
  Coverage   72.14%   72.14%           
=======================================
  Files          87       87           
  Lines        1906     1906           
  Branches      242      242           
=======================================
  Hits         1375     1375           
  Misses        477      477           
  Partials       54       54           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f0cb0c4...f6c152b. Read the comment docs.


As a prerequisite, please follow [the developer guide of the Security Plugin](https://github.com/opensearch-project/security/blob/main/DEVELOPER_GUIDE.md). This will leave you with a running OpenSearch server with security enabled. For the sake of this guide, let's assume the latest versions at the time of writing (`1.3.0-SNAPSHOT` for OpenSearch and OpenSearch Dashboards, and `1.3.0.0-SNAPSHOT` for both backend and frontend (this repo) security plugins.) Update the config file (`config/opensearch.yml`) to look like this one:
This project is as a plugin of [OpenSearch-Dashboards](**https://github.com/opensearch-project/OpenSearch-Dashboards). It requires an [OpenSearch](https://github.com/opensearch-project/OpenSearch) server running with the [Security](https://github.com/opensearch-project/security) plugin installed. At the time of this writing there is a strict version check between these components, so we recommend running all of them from their respective branches with matching versions (this will also ensure they work well together before we cut a new release.)

Choose a reason for hiding this comment

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

Probably a typo (is as a plugin)

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed it

@@ -39,7 +49,15 @@ node.max_local_storage_nodes: 3
######## End OpenSearch Security Demo Configuration ########
```

Next, we need to check out OpenSearch Dashboards from the branch matching our version, in this example that would be the [1.x branch](https://github.com/opensearch-project/OpenSearch-Dashboards/tree/1.x). Follow the [developer guide](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/1.x/DEVELOPER_GUIDE.md) and replace the version of `opensearch-dashboards.yml` there with this:

**Please Note** : This project runs on node `10.24.1` and so when installing node please ensure that you install this version. You can do so by running

Choose a reason for hiding this comment

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

I'd probably make this relative to .node-version so we don't have to upgrade every time (I'm not sure if we already use a .node-version file but we should)

Copy link
Member Author

Choose a reason for hiding this comment

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

ahaa...yes...we do use .node-version and .nvm-rc.. I just added an extra explanation saying "refer to .node-version file in base directory"

davidlago
davidlago previously approved these changes Feb 2, 2022

**Please Note** : This project runs on node `10.24.1` (refer to the `.nvmrc` or `.node-version` file in the base directory for correct version) and so when installing node please ensure that you install this version. You can do so by running
```script
nvm install 10.24.1
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
nvm install 10.24.1
nvm use --install

That way we don't have to specify the version explicitly, since it is picked up from .nvmrc

Copy link
Member

Choose a reason for hiding this comment

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

What's the deal with this comment?

Copy link
Contributor

Choose a reason for hiding this comment

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

Just an idea for an improvement on the docs. E.g. if we move towards 2.0 the node version changed and that would mean we always have to update the docs when we change .nvmrc. If we simply use the nvm use --install command we then don't have to upgrade the docs all the time.


**IMPORTANT**: Throughout this guide we will be using 1.x branches as our source for all 4 repos (OpenSearch, OpenSearch-Dashboards, security and security-dashboards-plugin).

> NOTE: If you are following this guide by the dot, please make sure that source code that you compile for OpenSearch project using `./gradlew localDistro` is done from [1.x branch](https://github.com/opensearch-project/OpenSearch/tree/1.x)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we updating this statement every time the branch is changed?

Choose a reason for hiding this comment

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

L14 says this is used just during the guide as just an example. The paragraph above makes reference to the need for matching versions. But yeah, if we move to a major version (2, 3...) it might be a bit confusing so we can update. Perhaps we can omit L14 as L10 covers the general idea and then we move on to use 1.3.0 as a driving example (that part can stay as it is clear it's just for the sake of the example code)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think down the road when there are multiple versions and branches for developers to choose, adding a table to show each version with there corresponding branch will be helpful

Copy link
Member Author

Choose a reason for hiding this comment

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

I have added the relevant branch and version info here... we can add info to this table as we develop in the future

davidlago
davidlago previously approved these changes Feb 4, 2022
\
For the sake of this guide, let's assume that the latest versions (`1.3.0-SNAPSHOT` for OpenSearch and OpenSearch Dashboards, and `1.3.0.0-SNAPSHOT` for the backend and the frontend of this Security plugin).

Next, ensure that the config file (`config/opensearch.yml`) in the OpenSearch home directory where you copied the source code using the [dev-guide](https://github.com/opensearch-project/security/blob/main/DEVELOPER_GUIDE.md#:~:text=export%20OPENSEARCH_HOME%3D~/Test/opensearch%2D1.3.0%2DSNAPSHOT) (basically `cd $OPENSEARCH_HOME`) contains this:
Copy link
Member Author

Choose a reason for hiding this comment

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

@hsiang9431-amzn @davidlago ... can you please review this again?

davidlago
davidlago previously approved these changes Feb 7, 2022
@cliu123
Copy link
Member

cliu123 commented Mar 28, 2022

ITs failed. Would you please take a look?

@cliu123
Copy link
Member

cliu123 commented Mar 28, 2022

Is there a template reference of the Dev Guide?
Please sign the commits. All commits are "Unverified".

@DarshitChanpura
Copy link
Member Author

Is there a template reference of the Dev Guide? Please sign the commits. All commits are "Unverified".

I did sign all the commits idk why it says Unsigned...Shouldn't DCO check fail if commits are unsigned?

@DarshitChanpura
Copy link
Member Author

DarshitChanpura commented Mar 28, 2022

ITs are failing because the integration test uses 1.x branch as base for OpenSearch-Dashboards (see here)

Because 1.x has been bumped to 1.4 in the core dashboards repo, there is a mismatch between plugin's expected version (1.4.0.0) and actual version (1.3.0.0) when integration tests are run. This results in failing ITs.

Error log from one of the failing tests:
start OpenSearch Dashboards server › call multitenancy info API as admin

    Failed to initialize plugins:
    	Plugin "securityDashboards" is only compatible with OpenSearch Dashboards version "1.3.0", but used OpenSearch Dashboards version is "1.4.0". (incompatible-version, /home/runner/work/security-dashboards-plugin/security-dashboards-plugin/OpenSearch-Dashboards/plugins/security-dashboards-plugin/opensearch_dashboards.json)

      214 |       .toPromise();
      215 |     if (errors.length > 0) {
    > 216 |       throw new Error(
          |             ^
      217 |         `Failed to initialize plugins:${errors.map((err) => `\n\t${err.message}`).join('')}`
      218 |       );
      219 |     }

      at PluginsService.handleDiscoveryErrors (src/core/server/plugins/plugins_service.ts:216:13)

This change will be updated to point to main in 2.0 version bump PR: #928

@DarshitChanpura
Copy link
Member Author

I would suggest waiting until main branch is bumped to 2.0 and then rebasing this branch with main before merging it.

@cliu123
Copy link
Member

cliu123 commented Jun 8, 2022

@DarshitChanpura main branch has been bumped to 2.1.0.0 now. Do you want to rebase and get it ready for review?

@DarshitChanpura
Copy link
Member Author

@opensearch-project/security Can I get review on this?


| OpenSearch<br>branch | Security Plugin<br>branch | OpenSearch<br>version |
|-------- |--- |--- |
| [1.x](https://github.com/opensearch-project/OpenSearch/tree/1.x) | [main](https://github.com/opensearch-project/security/) | [v1.3.0](https://github.com/opensearch-project/OpenSearch/blob/6eda740be744846f7aa0b2674820b5ed9b6be17e/buildSrc/version.properties#L1) |
Copy link
Member

Choose a reason for hiding this comment

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

While I think it would be better to use more recent builds, IMO any update to this guide that make it more usable are for the better, and we can update it afterward.

@cliu123 cliu123 merged commit b6fe0c0 into opensearch-project:main Jun 29, 2022
@cliu123 cliu123 added the backport 2.x backport to 2.x branch label Jul 28, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 28, 2022
Signed-off-by: Darshit Chanpura <[email protected]>
(cherry picked from commit b6fe0c0)
peternied pushed a commit that referenced this pull request Jul 28, 2022
Signed-off-by: Darshit Chanpura <[email protected]>
(cherry picked from commit b6fe0c0)

Co-authored-by: Darshit Chanpura <[email protected]>
spartan2015 pushed a commit to spartan2015/security-dashboards-plugin that referenced this pull request Aug 8, 2022
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Vasile Negru <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x backport to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants