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

[2.x] Change the regex command in install dashboard GHA + Increment version to 2.10.0 #1533

Merged
merged 4 commits into from
Aug 3, 2023

Conversation

RyanL1997
Copy link
Collaborator

@RyanL1997 RyanL1997 commented Aug 1, 2023

Description

Change the regex command in install dashboard GHA to handle generic format of version numbers. This PR also includes the version bump to 2.10.0.

Category

Bug fix

Issues Resolved

Testing

Before:
Screenshot 2023-08-01 at 4 16 08 PM

After:
Screenshot 2023-08-01 at 4 17 34 PM

Check List

  • New functionality includes testing
  • New functionality has been documented
  • 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.

@codecov
Copy link

codecov bot commented Aug 1, 2023

Codecov Report

Merging #1533 (71fe260) into 2.x (d8f5851) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##              2.x    #1533   +/-   ##
=======================================
  Coverage   66.06%   66.06%           
=======================================
  Files          93       93           
  Lines        2328     2328           
  Branches      310      310           
=======================================
  Hits         1538     1538           
  Misses        722      722           
  Partials       68       68           

@@ -39,8 +39,8 @@ runs:

- id: osd-version
run: |
echo "::set-output name=osd-version::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-4)"
echo "::set-output name=osd-x-version::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-3)"
echo "::set-output name=osd-version::$(jq -r '.opensearchDashboards.version' package.json)"
Copy link
Collaborator Author

@RyanL1997 RyanL1997 Aug 1, 2023

Choose a reason for hiding this comment

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

Here is a little break down of the first command:

  • -r (or --raw-output): This option tells jq to output raw strings instead of JSON-encoded strings, which means it won't wrap the output in quotes.

Copy link
Member

@cwperks cwperks Aug 2, 2023

Choose a reason for hiding this comment

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

If .opensearchDashboards.version is 2.10.0 will this produce the following?

osd-version = 2.10
osd-x-version = 2.

I believe that's what the current logic intends.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, for the x-version, I moved the .x into this step. so it will be "2.x" directly.

Copy link
Member

@cwperks cwperks Aug 2, 2023

Choose a reason for hiding this comment

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

jq -r '.opensearchDashboards.version' package.json will output 2.10.0 right? This variable is used to checkout a branch here so it should match the branch name 2.10.

Copy link
Collaborator Author

@RyanL1997 RyanL1997 Aug 2, 2023

Choose a reason for hiding this comment

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

@cwperks nice catch! My bad, I wasnt noticing that at the beginning. I just fixed with:

echo "::set-output name=osd-version::$(jq -r '.opensearchDashboards.version | split(".") | .[:2] | join(".")' package.json)"

This will be the same strategy as the [0] we used down below. But [0] is just getting the first element, and this line will get the first 2 element of the array by using [:2]. So it will be 2 and 10 from ["2", "10", "0"] and join with . in between.

@RyanL1997 RyanL1997 changed the title [Bug fix] Change the regex command in install dashboard GHA [2.x] Change the regex command in install dashboard GHA Aug 1, 2023
echo "::set-output name=osd-version::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-4)"
echo "::set-output name=osd-x-version::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-3)"
echo "::set-output name=osd-version::$(jq -r '.opensearchDashboards.version' package.json)"
echo "::set-output name=osd-x-version::$(jq -r '.opensearchDashboards.version | split(".") | .[0]' package.json).x"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here's what's happening in the second command:

  • split("."): This is another jq filter that splits the version string into an array of strings using the period as a delimiter. This would turn "2.10.0" into ["2", "10", "0"].
  • .[0]: This is a jq filter that selects the first element of the array. This would extract the "2" from ["2", "10", "0"].
  • .x: This is concatenated onto the end of the major version number. So if the major version number is "2", it becomes "2.x". (This was originally at the next step of branch switching and I moved to here to make the entire flow more straight forward.)

@RyanL1997 RyanL1997 self-assigned this Aug 2, 2023
@RyanL1997 RyanL1997 changed the title [2.x] Change the regex command in install dashboard GHA [2.x] Change the regex command in install dashboard GHA + Increment version to 2.10.0 Aug 2, 2023
working-directory: ${{ steps.determine-plugin-directory.outputs.plugin-directory }}
shell: bash

- id: branch-switch-if-possible
continue-on-error: true # Defaults onto main if the branch switch doesn't work
if: ${{ steps.osd-version.outputs.osd-version }}
run: git checkout ${{ steps.osd-version.outputs.osd-version }} || git checkout ${{ steps.osd-version.outputs.osd-x-version }}x
run: git checkout ${{ steps.osd-version.outputs.osd-version }} || git checkout ${{ steps.osd-version.outputs.osd-x-version }}
Copy link
Member

Choose a reason for hiding this comment

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

Oh I see you removed the x here. Nice! I like this change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I have moved the .x up there when we parsing those versions. So this one should only be just trying out to see if we have a specific version branch, such as 2.10. If it is not, it will just grab the x line as version.

@RyanL1997
Copy link
Collaborator Author

Looking into this:

FAIL test/jest_integration/saml_auth.test.ts (35.497 s)
  start OpenSearch Dashboards server
    ✓ Login to app/opensearch_dashboards_overview#/ when SAML is enabled (21476 ms)
    ✕ Login to app/dev_tools#/console when SAML is enabled (114 ms)
    ✕ Login to Dashboard with Hash (109 ms)
    ○ skipped Tenancy persisted after Logout in SAML

  ● start OpenSearch Dashboards server › Login to app/dev_tools#/console when SAML is enabled

I don't think this is related to this change btw.

Reference:
https://github.com/opensearch-project/security-dashboards-plugin/actions/runs/5733034965/job/15537963336?pr=1533#step:14:486

@RyanL1997
Copy link
Collaborator Author

The current CI failure is introduced by the backport of this breaking change in core: opensearch-project/OpenSearch#9006

@cwperks
Copy link
Member

cwperks commented Aug 2, 2023

Thank you @RyanL1997! This change (minus the version increment) should be done against main as well.

@cwperks
Copy link
Member

cwperks commented Aug 3, 2023

I'm seeing a lot of InvalidArgumentError: binary is not a Firefox executable in the build output.

I see a successful run here with FF 115.

Mozilla Firefox 115.0.2
Successfully setup firefox version 115.0.2

This branch is failing with FF 116

Mozilla Firefox 116.0
Successfully setup firefox version 116.0

…rmat

Signed-off-by: Ryan Liang <jiallian@amazon.com>
Signed-off-by: Ryan Liang <jiallian@amazon.com>
Signed-off-by: Ryan Liang <jiallian@amazon.com>
Signed-off-by: Ryan Liang <jiallian@amazon.com>
@RyanL1997 RyanL1997 merged commit a5e35e3 into opensearch-project:2.x Aug 3, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants