Skip to content

Set order of tenant_template to the highest to avoid being overridden by custom templates#1247

Merged
cliu123 merged 3 commits intoopensearch-project:mainfrom
cliu123:set_order_for_tenant_template
Dec 9, 2022
Merged

Set order of tenant_template to the highest to avoid being overridden by custom templates#1247
cliu123 merged 3 commits intoopensearch-project:mainfrom
cliu123:set_order_for_tenant_template

Conversation

@cliu123
Copy link
Copy Markdown
Member

@cliu123 cliu123 commented Dec 8, 2022

Signed-off-by: Chang Liu lc12251109@gmail.com

Description

The issue description of #1246 explains the issue to be resolved.
The PR title described the approach to fix the issue.

Category

Bug fix

Issues Resolved

#1246

Testing

UTs and ITs

Check List

  • New functionality includes testing
  • Commits are signed per the DCO using --signoff

Screenshots

Screen Shot 2022-12-08 at 5 09 43 PM

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.

…plates

Signed-off-by: Chang Liu <lc12251109@gmail.com>
@cliu123 cliu123 requested a review from a team December 8, 2022 05:51
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Dec 8, 2022

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.78%. Comparing base (47faabf) to head (78292e3).
Report is 186 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1247   +/-   ##
=======================================
  Coverage   71.78%   71.78%           
=======================================
  Files          88       88           
  Lines        2027     2027           
  Branches      269      269           
=======================================
  Hits         1455     1455           
  Misses        509      509           
  Partials       63       63           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Member

@DarshitChanpura DarshitChanpura left a comment

Choose a reason for hiding this comment

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

@cliu123 Thank you for adding this PR. Two quick things:

  1. Can you create a global constant for the order? (too bad javascript doesn't have a built-in for Java's Integer.MAX_VALUE)
  2. Can you add a test showing that tenant_template is not overridden in both scenarios where order is equal and is less than 2147483647?

Signed-off-by: Chang Liu <lc12251109@gmail.com>
@cliu123
Copy link
Copy Markdown
Member Author

cliu123 commented Dec 8, 2022

  1. Can you create a global constant for the order? (too bad javascript doesn't have a built-in for Java's Integer.MAX_VALUE)

👍 Done

  1. Can you add a test showing that tenant_template is not overridden in both scenarios where order is equal and is less than 2147483647?

As I replied to the other comment, the template and order are parts of OpenSearch core. security-dashboards-plugin only calls the API to create template. So the definition of template and order, and how it gets overridden are defined by OpenSearch core. There's no need to test OpenSearch core functionality in plugins(would be duplicate effort).

@cliu123 cliu123 requested review from a team, DarshitChanpura and peternied December 8, 2022 22:35
Copy link
Copy Markdown
Member

@peternied peternied left a comment

Choose a reason for hiding this comment

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

Thanks @cliu123!

@cliu123 cliu123 dismissed DarshitChanpura’s stale review December 9, 2022 15:46

Thanks for the review! All the comments have been resolved.

@cliu123 cliu123 merged commit dcf75c4 into opensearch-project:main Dec 9, 2022
@davidlago
Copy link
Copy Markdown

Thanks for the work, @cliu123 !

@DarshitChanpura just double-checking that you had a chance to re-review after the latest change as the last commit addressed them, even though you didn't formally re-approve. Thanks!

@cliu123 cliu123 added backport 1.3 backport 2.0 backport to 2.0 branch backport 2.x backport to 2.x branch backport 1.x backport to 1.x branch backport 1.2 backport to 1.2 branch backport 2.1 backport 2.1 branch backport 1.0 backport 1.1 backport 2.2 backport to 2.2 branch backport 2.3 backport to 2.3 branch backport 2.4 backport to 2.4 branch labels Dec 10, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Dec 10, 2022
… by custom templates (#1247)

Signed-off-by: Chang Liu <lc12251109@gmail.com>
(cherry picked from commit dcf75c4)
@opensearch-trigger-bot
Copy link
Copy Markdown
Contributor

The backport to opendistro-1.12 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-opendistro-1.12 opendistro-1.12
# Navigate to the new working tree
cd .worktrees/backport-opendistro-1.12
# Create a new branch
git switch --create backport/backport-1247-to-opendistro-1.12
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 dcf75c49543997e0e85dde9be314d5df81e60491
# Push it to GitHub
git push --set-upstream origin backport/backport-1247-to-opendistro-1.12
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-opendistro-1.12

Then, create a pull request where the base branch is opendistro-1.12 and the compare/head branch is backport/backport-1247-to-opendistro-1.12.

@opensearch-trigger-bot
Copy link
Copy Markdown
Contributor

The backport to opendistro-1.11 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-opendistro-1.11 opendistro-1.11
# Navigate to the new working tree
cd .worktrees/backport-opendistro-1.11
# Create a new branch
git switch --create backport/backport-1247-to-opendistro-1.11
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 dcf75c49543997e0e85dde9be314d5df81e60491
# Push it to GitHub
git push --set-upstream origin backport/backport-1247-to-opendistro-1.11
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-opendistro-1.11

Then, create a pull request where the base branch is opendistro-1.11 and the compare/head branch is backport/backport-1247-to-opendistro-1.11.

@opensearch-trigger-bot
Copy link
Copy Markdown
Contributor

The backport to opendistro-1.13 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-opendistro-1.13 opendistro-1.13
# Navigate to the new working tree
cd .worktrees/backport-opendistro-1.13
# Create a new branch
git switch --create backport/backport-1247-to-opendistro-1.13
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 dcf75c49543997e0e85dde9be314d5df81e60491
# Push it to GitHub
git push --set-upstream origin backport/backport-1247-to-opendistro-1.13
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-opendistro-1.13

Then, create a pull request where the base branch is opendistro-1.13 and the compare/head branch is backport/backport-1247-to-opendistro-1.13.

cliu123 added a commit that referenced this pull request Dec 10, 2022
… by custom templates (#1247) (#1253)

Signed-off-by: Chang Liu <lc12251109@gmail.com>
(cherry picked from commit dcf75c4)

Co-authored-by: Chang Liu <lc12251109@gmail.com>
cliu123 added a commit that referenced this pull request Dec 10, 2022
… by custom templates (#1247) (#1254)

Signed-off-by: Chang Liu <lc12251109@gmail.com>
(cherry picked from commit dcf75c4)

Co-authored-by: Chang Liu <lc12251109@gmail.com>
cliu123 added a commit that referenced this pull request Dec 10, 2022
… by custom templates (#1247) (#1255)

Signed-off-by: Chang Liu <lc12251109@gmail.com>
(cherry picked from commit dcf75c4)

Co-authored-by: Chang Liu <lc12251109@gmail.com>
cliu123 added a commit that referenced this pull request Dec 10, 2022
… by custom templates (#1247) (#1256)

Signed-off-by: Chang Liu <lc12251109@gmail.com>
(cherry picked from commit dcf75c4)

Co-authored-by: Chang Liu <lc12251109@gmail.com>
cliu123 added a commit that referenced this pull request Dec 10, 2022
… by custom templates (#1247) (#1259)

Signed-off-by: Chang Liu <lc12251109@gmail.com>
(cherry picked from commit dcf75c4)

Co-authored-by: Chang Liu <lc12251109@gmail.com>
cliu123 added a commit that referenced this pull request Dec 10, 2022
… by custom templates (#1247) (#1260)

Signed-off-by: Chang Liu <lc12251109@gmail.com>
(cherry picked from commit dcf75c4)

Co-authored-by: Chang Liu <lc12251109@gmail.com>
cliu123 added a commit that referenced this pull request Dec 10, 2022
… by custom templates (#1247) (#1250)

Signed-off-by: Chang Liu <lc12251109@gmail.com>
(cherry picked from commit dcf75c4)

Co-authored-by: Chang Liu <lc12251109@gmail.com>
cliu123 added a commit that referenced this pull request Dec 10, 2022
… by custom templates (#1247) (#1257)

Signed-off-by: Chang Liu <lc12251109@gmail.com>
(cherry picked from commit dcf75c4)

Co-authored-by: Chang Liu <lc12251109@gmail.com>
cliu123 added a commit to cliu123/security-dashboards-plugin that referenced this pull request Dec 14, 2022
… by custom templates (opensearch-project#1247)

Signed-off-by: Chang Liu <lc12251109@gmail.com>
cliu123 added a commit to cliu123/security-dashboards-plugin that referenced this pull request Dec 14, 2022
… by custom templates (opensearch-project#1247)

Signed-off-by: Chang Liu <lc12251109@gmail.com>
cliu123 added a commit that referenced this pull request Dec 15, 2022
… by custom templates (#1247)

Signed-off-by: Chang Liu <lc12251109@gmail.com>
(cherry picked from commit dcf75c4)
cliu123 added a commit that referenced this pull request Dec 15, 2022
… by custom templates (#1247)

Signed-off-by: Chang Liu <lc12251109@gmail.com>
(cherry picked from commit dcf75c4)
cliu123 added a commit that referenced this pull request Dec 15, 2022
… by custom templates (#1247) (#1270)

Signed-off-by: Chang Liu <lc12251109@gmail.com>
cwperks pushed a commit to cwperks/security-dashboards-plugin that referenced this pull request May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 1.x backport to 1.x branch backport 1.0 backport 1.1 backport 1.2 backport to 1.2 branch backport 1.3 backport 2.x backport to 2.x branch backport 2.0 backport to 2.0 branch backport 2.1 backport 2.1 branch backport 2.2 backport to 2.2 branch backport 2.3 backport to 2.3 branch backport 2.4 backport to 2.4 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants