-
Notifications
You must be signed in to change notification settings - Fork 174
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
Conversation
Codecov Report
@@ 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)" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
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" |
There was a problem hiding this comment.
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.)
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 }} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Looking into this:
I don't think this is related to this change btw. |
The current CI failure is introduced by the backport of this breaking change in core: opensearch-project/OpenSearch#9006 |
Thank you @RyanL1997! This change (minus the version increment) should be done against main as well. |
11dc1f4
to
1203e9a
Compare
I'm seeing a lot of I see a successful run here with FF 115.
This branch is failing with FF 116
|
…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>
1203e9a
to
71fe260
Compare
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](https://private-user-images.githubusercontent.com/109499885/257662094-ae7000c6-0aa0-431a-824b-fe262e7fbce3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzODY5NTQsIm5iZiI6MTczOTM4NjY1NCwicGF0aCI6Ii8xMDk0OTk4ODUvMjU3NjYyMDk0LWFlNzAwMGM2LTBhYTAtNDMxYS04MjRiLWZlMjYyZTdmYmNlMy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQxODU3MzRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00YjBhZDcyZmQ5Y2U2Y2IwM2Q3YWU1ZmJhZGE4Zjc3NTZlN2JmNThlOTNhMGY5NzkxZTQxMjQwYzkwNzJjMDdmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.YrA6m2brflRc1UWYmibdb0QZ5uuDUPrRHxnr3PFtfIw)
After:
![Screenshot 2023-08-01 at 4 17 34 PM](https://private-user-images.githubusercontent.com/109499885/257662078-1ad80e5c-c0c8-43d0-a615-b703c00bd422.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzODY5NTQsIm5iZiI6MTczOTM4NjY1NCwicGF0aCI6Ii8xMDk0OTk4ODUvMjU3NjYyMDc4LTFhZDgwZTVjLWMwYzgtNDNkMC1hNjE1LWI3MDNjMDBiZDQyMi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQxODU3MzRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kMDc4MTkyZWQwZDJkMGNiOTFlZGY3ZDEyZWZhZThjNjJhNjEwN2IxNzVjZmQ4ZGViYzRmNzBhNDFlMGIzMWQ1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.4k8qECm60IGhplhEG79tTPeiQ0EPxEcajrCJ2ZS5JMI)
Check List
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.