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

Added the addition of the server version and distribution as a respon… #8084

Conversation

Sam-ScottLogic
Copy link
Contributor

…se header

Description

In this PR code has been added to the default rest channel file that adds a new custom header containing the server version.

Related Issues

Issue - (#6583)

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.

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@Sam-ScottLogic Sam-ScottLogic force-pushed the feature/return_a_server_header_with_server_version branch from db29578 to 3da7ec7 Compare June 16, 2023 11:07
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.remotestore.RemoteStoreIT.testStaleCommitDeletionWithInvokeFlush

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@Sam-ScottLogic
Copy link
Contributor Author

Im not too sure why gradle is failing, tried to run ./gradlew :server:spotlessApply but no changes are applied

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@reta
Copy link
Collaborator

reta commented Jul 12, 2023

Im not too sure why gradle is failing, tried to run ./gradlew :server:spotlessApply but no changes are applied

Flaky tests ... :( @Sam-ScottLogic could you please rebase against main? thank you

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.remotestore.RemoteStoreIT.testStaleCommitDeletionWithInvokeFlush

@Sam-ScottLogic
Copy link
Contributor Author

Im not too sure why gradle is failing, tried to run ./gradlew :server:spotlessApply but no changes are applied

Flaky tests ... :( @Sam-ScottLogic could you please rebase against main? thank you

Merged main believe its fixed it

@reta
Copy link
Collaborator

reta commented Jul 13, 2023

@andrross looks good to you?

@andrross andrross merged commit 68ddf24 into opensearch-project:main Jul 13, 2023
9 checks passed
@andrross andrross added the backport 2.x Backport to 2.x branch label Jul 13, 2023
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

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

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
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-8084-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 68ddf2442c57672ff65c72f39c36e66dcd2e4dd7
# Push it to GitHub
git push --set-upstream origin backport/backport-8084-to-2.x
# Go back to the original working tree
popd
# 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-8084-to-2.x.

@reta
Copy link
Collaborator

reta commented Jul 13, 2023

@Sam-ScottLogic could toy please send manual backport to 2.x branch? thank you

r1walz pushed a commit to r1walz/OpenSearch that referenced this pull request Jul 13, 2023
opensearch-project#8084)

* Added server distribution and version into response header

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed extra lines

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Update server/src/main/java/org/opensearch/http/DefaultRestChannel.java

Co-authored-by: Owais Kazi <owaiskazi19@gmail.com>
Signed-off-by: Sam Hobbs <118170270+Sam-ScottLogic@users.noreply.github.com>

* Moved defining of server header string

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed wildcard import

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Applied spotless to files

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added to testHeadersSet test within the default rest channel test file to test that server version is returned

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Ran spotless

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added comment

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Created static string for reused server header title and name of application strings, also refactored server header to server version

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Refactored hash map from server header to server version and updated test

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Ran spotless

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Moved server version field from global variable to local, defined sever string as static value

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added prefix to header title

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed redundant serverVersion field and instead inlined creation of map passed into addCustomHeader method

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Ran spotless

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed redundant OPEN_SEARCH_NAME_VALUE

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Update server/src/test/java/org/opensearch/http/DefaultRestChannelTests.java

Co-authored-by: Andriy Redko <drreta@gmail.com>
Signed-off-by: Sam Hobbs <118170270+Sam-ScottLogic@users.noreply.github.com>

* Moved change log addition to 2.x unreleased and wrote message in imperative

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Corrected name of fetched header in header test

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added server version header value as constant

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

---------

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>
Signed-off-by: Sam Hobbs <118170270+Sam-ScottLogic@users.noreply.github.com>
Co-authored-by: Owais Kazi <owaiskazi19@gmail.com>
Co-authored-by: Andriy Redko <drreta@gmail.com>
buddharajusahil pushed a commit to buddharajusahil/OpenSearch that referenced this pull request Jul 18, 2023
opensearch-project#8084)

* Added server distribution and version into response header

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed extra lines

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Update server/src/main/java/org/opensearch/http/DefaultRestChannel.java

Co-authored-by: Owais Kazi <owaiskazi19@gmail.com>
Signed-off-by: Sam Hobbs <118170270+Sam-ScottLogic@users.noreply.github.com>

* Moved defining of server header string

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed wildcard import

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Applied spotless to files

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added to testHeadersSet test within the default rest channel test file to test that server version is returned

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Ran spotless

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added comment

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Created static string for reused server header title and name of application strings, also refactored server header to server version

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Refactored hash map from server header to server version and updated test

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Ran spotless

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Moved server version field from global variable to local, defined sever string as static value

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added prefix to header title

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed redundant serverVersion field and instead inlined creation of map passed into addCustomHeader method

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Ran spotless

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed redundant OPEN_SEARCH_NAME_VALUE

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Update server/src/test/java/org/opensearch/http/DefaultRestChannelTests.java

Co-authored-by: Andriy Redko <drreta@gmail.com>
Signed-off-by: Sam Hobbs <118170270+Sam-ScottLogic@users.noreply.github.com>

* Moved change log addition to 2.x unreleased and wrote message in imperative

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Corrected name of fetched header in header test

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added server version header value as constant

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

---------

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>
Signed-off-by: Sam Hobbs <118170270+Sam-ScottLogic@users.noreply.github.com>
Co-authored-by: Owais Kazi <owaiskazi19@gmail.com>
Co-authored-by: Andriy Redko <drreta@gmail.com>
Signed-off-by: sahil buddharaju <sahilbud@amazon.com>
baba-devv pushed a commit to baba-devv/OpenSearch that referenced this pull request Jul 29, 2023
opensearch-project#8084)

* Added server distribution and version into response header

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed extra lines

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Update server/src/main/java/org/opensearch/http/DefaultRestChannel.java

Co-authored-by: Owais Kazi <owaiskazi19@gmail.com>
Signed-off-by: Sam Hobbs <118170270+Sam-ScottLogic@users.noreply.github.com>

* Moved defining of server header string

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed wildcard import

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Applied spotless to files

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added to testHeadersSet test within the default rest channel test file to test that server version is returned

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Ran spotless

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added comment

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Created static string for reused server header title and name of application strings, also refactored server header to server version

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Refactored hash map from server header to server version and updated test

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Ran spotless

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Moved server version field from global variable to local, defined sever string as static value

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added prefix to header title

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed redundant serverVersion field and instead inlined creation of map passed into addCustomHeader method

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Ran spotless

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed redundant OPEN_SEARCH_NAME_VALUE

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Update server/src/test/java/org/opensearch/http/DefaultRestChannelTests.java

Co-authored-by: Andriy Redko <drreta@gmail.com>
Signed-off-by: Sam Hobbs <118170270+Sam-ScottLogic@users.noreply.github.com>

* Moved change log addition to 2.x unreleased and wrote message in imperative

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Corrected name of fetched header in header test

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added server version header value as constant

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

---------

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>
Signed-off-by: Sam Hobbs <118170270+Sam-ScottLogic@users.noreply.github.com>
Co-authored-by: Owais Kazi <owaiskazi19@gmail.com>
Co-authored-by: Andriy Redko <drreta@gmail.com>
@Sam-ScottLogic
Copy link
Contributor Author

@Sam-ScottLogic could toy please send manual backport to 2.x branch? thank you

Sorry for late response. Does this still need to be backported?

@dblock
Copy link
Member

dblock commented Aug 15, 2023

@Sam-ScottLogic I believe yes, if you want this in 2.x

@Sam-ScottLogic
Copy link
Contributor Author

I dont mind it going in the next release just dont want to mess up what I've done messing up the series of git commands :)

@dblock
Copy link
Member

dblock commented Aug 22, 2023

Up to you to backport it.

@Sam-ScottLogic Sam-ScottLogic deleted the feature/return_a_server_header_with_server_version branch November 2, 2023 10:04
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
opensearch-project#8084)

* Added server distribution and version into response header

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed extra lines

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Update server/src/main/java/org/opensearch/http/DefaultRestChannel.java

Co-authored-by: Owais Kazi <owaiskazi19@gmail.com>
Signed-off-by: Sam Hobbs <118170270+Sam-ScottLogic@users.noreply.github.com>

* Moved defining of server header string

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed wildcard import

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Applied spotless to files

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added to testHeadersSet test within the default rest channel test file to test that server version is returned

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Ran spotless

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added comment

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Created static string for reused server header title and name of application strings, also refactored server header to server version

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Refactored hash map from server header to server version and updated test

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Ran spotless

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Moved server version field from global variable to local, defined sever string as static value

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added prefix to header title

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed redundant serverVersion field and instead inlined creation of map passed into addCustomHeader method

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Ran spotless

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Removed redundant OPEN_SEARCH_NAME_VALUE

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Update server/src/test/java/org/opensearch/http/DefaultRestChannelTests.java

Co-authored-by: Andriy Redko <drreta@gmail.com>
Signed-off-by: Sam Hobbs <118170270+Sam-ScottLogic@users.noreply.github.com>

* Moved change log addition to 2.x unreleased and wrote message in imperative

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Corrected name of fetched header in header test

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

* Added server version header value as constant

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>

---------

Signed-off-by: Sam Hobbs <shobbs@scottlogic.com>
Signed-off-by: Sam Hobbs <118170270+Sam-ScottLogic@users.noreply.github.com>
Co-authored-by: Owais Kazi <owaiskazi19@gmail.com>
Co-authored-by: Andriy Redko <drreta@gmail.com>
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
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.

6 participants