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

Add step to install dependencies prior to building #1743

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

derek-ho
Copy link
Collaborator

@derek-ho derek-ho commented Jan 19, 2024

Description

This PR adds a step to install the dependencies prior to building. This will fix the workflow of installing the binary when the dependent libraries are not installed yet, leading to false-positive failures of the install via binary workflow.

The reason why this was not caught before is that security dashboards plugin's current dependencies are only used in the server and test folders. In the build process, there is a step to run yarn to install dependencies, but the workflow is erroring out in the @osd/optimizer step when trying to add dependencies that live in the public folder. This is because the front end code needs to be bundled and thus when a dependency is not there it will error out. This should fix the build and install workflow for dependencies used in the frontend public folder.

We should not rely on some implementation detail of how OSD core runs yarn build and instead makes sure all necessary dependencies are available when we run that command.

yarn run v1.22.19
$ yarn plugin-helpers build && node build_tools/rename_zip.js
$ node ../../scripts/plugin_helpers build
 info deleting the build and target directories
 info running @osd/optimizer
 │ info initialized, 0 bundles cached
 │ info starting worker [1 bundle]
 │ succ 1 bundles compiled successfully after 11.6 sec
 info copying assets from `public/assets` to build
 info copying server source into the build and converting with babel
 info running yarn to install dependencies
 info compressing plugin into [securityDashboards-3.0.0.zip]
 info cleaning up compression temporary artifacts

Category

[Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation]

Why these changes are required?

What is the old behavior before changes and new behavior after changes?

Issues Resolved

[List any issues this PR will resolve (Is this a backport? If so, please add backport PR # and/or commits #)]

Testing

[Please provide details of testing done: unit testing, integration testing and manual testing]

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.

Copy link

codecov bot commented Jan 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3f81415) 67.09% compared to head (7716890) 67.09%.

❗ Current head 7716890 differs from pull request most recent head f0913eb. Consider uploading reports for the commit f0913eb to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1743   +/-   ##
=======================================
  Coverage   67.09%   67.09%           
=======================================
  Files          94       94           
  Lines        2404     2404           
  Branches      318      318           
=======================================
  Hits         1613     1613           
  Misses        713      713           
  Partials       78       78           

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

@derek-ho
Copy link
Collaborator Author

Copy link
Member

@DarshitChanpura DarshitChanpura left a comment

Choose a reason for hiding this comment

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

LTGM! Thanks @derek-ho

@derek-ho
Copy link
Collaborator Author

Confirm that this is how opensearch-build runs the build of plugin zips: https://github.com/opensearch-project/opensearch-build/blob/main/scripts/default/opensearch-dashboards/build.sh#L101

@derek-ho derek-ho added the backport 2.x backport to 2.x branch label Jan 22, 2024
@cwperks cwperks merged commit df1a4ea into opensearch-project:main Jan 22, 2024
25 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 22, 2024
cwperks pushed a commit that referenced this pull request Jan 22, 2024
Signed-off-by: Derek Ho <[email protected]>
(cherry picked from commit df1a4ea)

Co-authored-by: Derek Ho <[email protected]>
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.

3 participants