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 integTest behavior to accept the version and set the password accordingly, and force HTTP1 policy for local clusters #1318

Merged

Conversation

DarshitChanpura
Copy link
Member

@DarshitChanpura DarshitChanpura commented Feb 5, 2024

Description

integtest.sh run by opensearch-build passes -v to supply opensearch version however it was not being consumed on CCR side. This PR consumes that version to conditionally set the password correctly and fixes:

2024-02-05 13:17:41 INFO     /tmp/tmpp1sdta5m/cross-cluster-replication/scripts/integtest.sh: line 78: ((: > 2 || ( == 2 &&  >= 12) : syntax error: operand expected (error token is "> 2 || ( == 2 &&  >= 12) ")

https://build.ci.opensearch.org/blue/rest/organizations/jenkins/pipelines/integ-test/runs/7592/nodes/98/steps/579/log/?start=0

Issues Resolved

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • 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.

… accordingly

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Copy link

codecov bot commented Feb 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (043a788) 74.19% compared to head (84b3422) 76.55%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1318      +/-   ##
============================================
+ Coverage     74.19%   76.55%   +2.36%     
- Complexity     1023     1050      +27     
============================================
  Files           141      141              
  Lines          4782     4782              
  Branches        526      526              
============================================
+ Hits           3548     3661     +113     
+ Misses          883      771     -112     
+ Partials        351      350       -1     

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

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
@DarshitChanpura
Copy link
Member Author

Security tests no-longer fail with unauthorized. instead they fail with:

Caused by:
        org.apache.hc.core5.http.ParseException: Invalid protocol version; error at offset 0: <[0x2e][0x2f][0x30][0x31][0x32][0x33][0x34][0x35][0x36][0x37][0x38][0x39][0x3a] [0x3c][0x3d][0x3e]e[0x40][0x41][0x42][0x43][0x44][0x45]�???[0x4a][0x4b][0x4c][0x4d]Unexpected HTTP/1.x request: GET /_cluster/settings?include_defaults=true&flat_settings=true >

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
@DarshitChanpura
Copy link
Member Author

@monusingh-1 Mind reviewing this one?

@monusingh-1 monusingh-1 enabled auto-merge (squash) February 7, 2024 16:38
monusingh-1
monusingh-1 previously approved these changes Feb 8, 2024
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
auto-merge was automatically disabled February 8, 2024 15:41

Head branch was pushed to by a user without write access

@DarshitChanpura DarshitChanpura changed the title Updates integTest behavior to accept the version and set the password accordingly Updates integTest behavior to accept the version and set the password accordingly, and force HTTP1 policy for local clusters Feb 8, 2024
@DarshitChanpura
Copy link
Member Author

@monusingh-1 Mind giving this another look? I've fixed the broken security tests.

monusingh-1
monusingh-1 previously approved these changes Feb 8, 2024
CREDENTIAL="admin:myStrongPassword123!"
else
COMPARE_VERSION=`echo $OPENSEARCH_REQUIRED_VERSION $OPENSEARCH_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1`
if [ "$COMPARE_VERSION" != "$OPENSEARCH_REQUIRED_VERSION" ]; then
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this check for 2.12 or higher?

Copy link
Member

Choose a reason for hiding this comment

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

Can you provide some context in code comments?

Copy link
Member Author

@DarshitChanpura DarshitChanpura Feb 9, 2024

Choose a reason for hiding this comment

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

That is what this check is doing.

OPENSEARCH_VERSION=3.0.0


OPENSEARCH_REQUIRED_VERSION="2.12.0"

if [ -z "$CREDENTIAL" ]
then
  # Starting in 2.12.0, security demo configuration script requires an initial admin password
  COMPARE_VERSION=`echo $OPENSEARCH_REQUIRED_VERSION $OPENSEARCH_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1`
  if [ "$COMPARE_VERSION" != "$OPENSEARCH_REQUIRED_VERSION" ]; then
    CREDENTIAL="admin:admin"
  else
    CREDENTIAL="admin:myStrongPassword123!"
  fi
fi

echo $CREDENTIAL

Feel free to test this out here: https://www.onlinegdb.com/online_bash_shell

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 more comments.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
auto-merge was automatically disabled February 9, 2024 15:47

Head branch was pushed to by a user without write access

@DarshitChanpura
Copy link
Member Author

@monusingh-1 @ankitkala I've addressed the feedback. Mind re-reviewing it?

@ankitkala ankitkala merged commit d703887 into opensearch-project:main Feb 9, 2024
24 of 26 checks passed
@opensearch-trigger-bot
Copy link

The backport to 2.x 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-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-1318-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 d703887f88f24c444e0513ebeca21e30b93354f8
# Push it to GitHub
git push --set-upstream origin backport/backport-1318-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-1318-to-2.x.

@opensearch-trigger-bot
Copy link

The backport to 2.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-2.12 2.12
# Navigate to the new working tree
cd .worktrees/backport-2.12
# Create a new branch
git switch --create backport/backport-1318-to-2.12
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 d703887f88f24c444e0513ebeca21e30b93354f8
# Push it to GitHub
git push --set-upstream origin backport/backport-1318-to-2.12
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.12

Then, create a pull request where the base branch is 2.12 and the compare/head branch is backport/backport-1318-to-2.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x backport 2.12 v2.12.0 Issues targeting release v2.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants