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

Extends plugin-helpers to be used for automating version changes #2398

Merged
merged 1 commit into from
Sep 30, 2022

Conversation

AMoo-Miki
Copy link
Collaborator

Signed-off-by: Miki [email protected]

Description

This extends the existing plugin-helpers package by adding a version command to facilitate updating the versions in the manifest and package files of a plugin.

Issues Resolved

Addresses the #1801 for OSD plugins

Check List

  • New functionality includes testing.
    • All tests pass
      • yarn test:jest
      • yarn test:jest_integration
      • yarn test:ftr
  • New functionality has been documented.
  • Commits are signed per the DCO using --signoff

@codecov-commenter
Copy link

Codecov Report

Merging #2398 (0302300) into main (77af7f9) will increase coverage by 0.19%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #2398      +/-   ##
==========================================
+ Coverage   66.55%   66.75%   +0.19%     
==========================================
  Files        3169     3194      +25     
  Lines       60313    60803     +490     
  Branches     9182     9238      +56     
==========================================
+ Hits        40141    40587     +446     
- Misses      17979    18008      +29     
- Partials     2193     2208      +15     
Impacted Files Coverage Δ
...erver/index_patterns/fetcher/lib/opensearch_api.ts 63.63% <0.00%> (-36.37%) ⬇️
...ndex_pattern_prompt/empty_index_pattern_prompt.tsx 80.00% <0.00%> (-20.00%) ⬇️
...rd/public/application/listing/dashboard_listing.js 78.57% <0.00%> (-4.77%) ⬇️
...dex_pattern_wizard/create_index_pattern_wizard.tsx 67.08% <0.00%> (-4.34%) ⬇️
src/core/server/http/router/router.ts 74.54% <0.00%> (-3.89%) ⬇️
...mponents/step_index_pattern/step_index_pattern.tsx 85.71% <0.00%> (-2.14%) ⬇️
...izard/public/application/utils/use/use_can_save.ts 11.11% <0.00%> (-1.39%) ⬇️
...agement_section/objects_table/components/table.tsx 65.51% <0.00%> (-1.15%) ⬇️
...on/index_patterns/index_patterns/index_patterns.ts 57.07% <0.00%> (-0.07%) ⬇️
...ins/wizard/public/embeddable/wizard_embeddable.tsx 1.00% <0.00%> (-0.03%) ⬇️
... and 48 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@joshuarrrr joshuarrrr left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! I think we need to just be a little more explicit about the fact that this script updates source files, so must be run before build. And I think small examples will make any version formatting errors much easier to navigate.

packages/osd-plugin-helpers/README.md Outdated Show resolved Hide resolved
packages/osd-plugin-helpers/README.md Outdated Show resolved Hide resolved
packages/osd-plugin-helpers/README.md Outdated Show resolved Hide resolved
packages/osd-plugin-helpers/README.md Outdated Show resolved Hide resolved
packages/osd-plugin-helpers/src/cli.ts Outdated Show resolved Hide resolved
packages/osd-plugin-helpers/src/tasks/update_versions.ts Outdated Show resolved Hide resolved

Options:
--skip-archive Don't create the zip file, just create the build/opensearch-dashboards directory
--opensearch-dashboards-version, -v OpenSearch Dashboards version that the built plugin will target
Copy link
Member

Choose a reason for hiding this comment

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

looks like we have two options that both use the flag -v. Log verbosity and versioning. We may need a new shorthand for this since it can be a little confusing for folks who want to turn on verbose logging during build only to realize that they updated the version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What a terrible decision. Sadly changing this would be a "breaking change" and will need to be scheduled for a major release.


Options:
--sync Update the versions to match Dashboards' (default)
--set Update the version to a specific semantic version value
Copy link
Member

Choose a reason for hiding this comment

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

I agree with josh, a simple example here will definitely be more helpful. semantic is well understood but but given our x.x.x.x versioning system it may be a little confusing as to what we expect as the semantic version. Also its a lot easier with examples

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added some text.

kavilla
kavilla previously approved these changes Sep 27, 2022
Copy link
Member

@kavilla kavilla left a comment

Choose a reason for hiding this comment

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

Awesome improvement!

One thing I want to mention, it doesn't currently support qualifiers.

For example, yarn plugin-helpers version --set 3.0.0-alpha or yarn plugin-helpers version --sync when my core is defined as 3.0.0-alpha sets the plugin to 3.0.0.0 and opensearchDashboardsVersion: 3.0.0.

But I'm fine with iterating on this and opening an issue to support qualifiers.

--opensearch-dashboards-version, -v OpenSearch Dashboards version that the

Options:
--sync Update the versions to match Dashboards' (default)
Copy link
Member

Choose a reason for hiding this comment

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

nit: Dashboards' --> OpenSearch Dashboards'

Copy link
Collaborator Author

@AMoo-Miki AMoo-Miki Sep 30, 2022

Choose a reason for hiding this comment

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

Originally, I did that suffix stripping intentionally. I have reverted that in the latest iteration.

packages/osd-plugin-helpers/src/tasks/update_versions.ts Outdated Show resolved Hide resolved
Copy link
Member

@kavilla kavilla left a comment

Choose a reason for hiding this comment

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

Nice! LGTM qualifiers work as well!

Copy link
Member

@joshuarrrr joshuarrrr left a comment

Choose a reason for hiding this comment

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

nice, I like the addition of compatibility updates and legacy version support

@joshuarrrr joshuarrrr merged commit 48fe60b into opensearch-project:main Sep 30, 2022
@opensearch-trigger-bot
Copy link
Contributor

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

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

@opensearch-trigger-bot
Copy link
Contributor

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

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

@opensearch-trigger-bot
Copy link
Contributor

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-2398-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 48fe60b40661c0bb19ed73d3426f5d5ec418887c
# Push it to GitHub
git push --set-upstream origin backport/backport-2398-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-2398-to-2.x.

@opensearch-trigger-bot
Copy link
Contributor

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

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

kavilla pushed a commit to kavilla/OpenSearch-Dashboards-1 that referenced this pull request Sep 30, 2022
joshuarrrr pushed a commit to joshuarrrr/OpenSearch-Dashboards that referenced this pull request Sep 30, 2022
joshuarrrr pushed a commit to joshuarrrr/OpenSearch-Dashboards that referenced this pull request Sep 30, 2022
joshuarrrr pushed a commit to joshuarrrr/OpenSearch-Dashboards that referenced this pull request Sep 30, 2022
kavilla added a commit that referenced this pull request Sep 30, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 30, 2022
kavilla pushed a commit that referenced this pull request Sep 30, 2022
joshuarrrr added a commit that referenced this pull request Sep 30, 2022
Signed-off-by: Miki <[email protected]>

Signed-off-by: Miki <[email protected]>
(cherry picked from commit 48fe60b)

Co-authored-by: Miki <[email protected]>
kavilla pushed a commit that referenced this pull request Oct 2, 2022
@AMoo-Miki AMoo-Miki added v2.4.0 'Issues and PRs related to version v2.4.0' enhancement New feature or request plugins Plugin related work labels Nov 5, 2022
sipopo pushed a commit to sipopo/OpenSearch-Dashboards that referenced this pull request Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.3 backport 2.x build Build related additions or modifications enhancement New feature or request plugins Plugin related work v1.3.6 v2.4.0 'Issues and PRs related to version v2.4.0'
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[PROPOSAL] Incorporate a generic build system (something like Gradle).
6 participants