-
Notifications
You must be signed in to change notification settings - Fork 186
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 dockerized yarn runner #5305
Conversation
Duplicated values are also dropped now
Fixes a bug where the environment variables were not read
|
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.
Wazuh dashboardLegend: Other
Details 🟢 Build a package using the dockerized runner through node scripts/runner build[vagrant@localhost wazuh-kibana-app]$ node scripts/runner build
APP: osd
VERSION: 2.6.0
REPO: /home/vagrant/wazuh-kibana-app
CMD: plugin-helpers build
ARGS: --opensearch-dashboards-version=2.6.0
Container runner Created
Attaching to runner
runner | yarn install v1.22.19
runner | [1/4] Resolving packages...
runner | success Already up-to-date.
runner | Done in 0.32s.
runner | yarn run v1.22.19
runner | $ node ../../scripts/plugin_helpers build --opensearch-dashboards-version=2.6.0
runner | info Loaded config file from [/home/node/kbn/plugins/wazuh/.opensearch_dashboards-plugin-helpers.json]
runner | info deleting the build and target directories
runner | info running @osd/optimizer
runner | │ info initialized, 0 bundles cached
runner | │ info starting worker [1 bundle]
runner | │ warn worker stderr Browserslist: caniuse-lite is outdated. Please run:
runner | │ warn worker stderr npx browserslist@latest --update-db
runner | │ warn worker stderr Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
runner | │ succ 1 bundles compiled successfully after 470.9 sec
runner | info copying assets from `public/assets` to build
runner | info copying server source into the build and converting with babel
runner | Browserslist: caniuse-lite is outdated. Please run:
runner | npx browserslist@latest --update-db
runner | Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
runner | info running yarn to install dependencies
runner | info compressing plugin into [wazuh-2.6.0.zip]
runner | info cleaning up compression temporary artifacts
runner | Done in 489.01s.
runner exited with code 0
[vagrant@localhost wazuh-kibana-app]$ ls build/
wazuh-2.6.0.zip 🟢 Run the jest tests using the dockerized runner through node scripts/runner test[vagrant@localhost wazuh-kibana-app]$ node scripts/runner test
APP: osd
VERSION: 2.6.0
REPO: /home/vagrant/wazuh-kibana-app
CMD: test:jest
ARGS: --runInBand
...
runner | Test Suites: 6 skipped, 63 passed, 63 of 69 total
runner | Tests: 36 skipped, 901 passed, 937 total
runner | Snapshots: 37 passed, 37 total
runner | Time: 207.171 s
runner | Ran all test suites.
runner | Done in 210.12s.
runner exited with code 0
🟢 Build a package using the dockerized runner through yarn build:runner[vagrant@localhost wazuh-kibana-app]$ yarn build:runner
yarn run v1.22.19
$ node scripts/runner build
APP: osd
VERSION: 2.6.0
REPO: /home/vagrant/wazuh-kibana-app
CMD: plugin-helpers build
ARGS: --opensearch-dashboards-version=2.6.0
Container runner Created
Attaching to runner
runner | yarn install v1.22.19
runner | [1/4] Resolving packages...
runner | success Already up-to-date.
runner | Done in 0.32s.
runner | yarn run v1.22.19
runner | $ node ../../scripts/plugin_helpers build --opensearch-dashboards-version=2.6.0
runner | info Loaded config file from [/home/node/kbn/plugins/wazuh/.opensearch_dashboards-plugin-helpers.json]
runner | info deleting the build and target directories
runner | info running @osd/optimizer
runner | │ info initialized, 0 bundles cached
runner | │ info starting worker [1 bundle]
runner | │ warn worker stderr Browserslist: caniuse-lite is outdated. Please run:
runner | │ warn worker stderr npx browserslist@latest --update-db
runner | │ warn worker stderr Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
runner | │ succ 1 bundles compiled successfully after 480.9 sec
runner | info copying assets from `public/assets` to build
runner | info copying server source into the build and converting with babel
runner | Browserslist: caniuse-lite is outdated. Please run:
runner | npx browserslist@latest --update-db
runner | Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
runner | info running yarn to install dependencies
runner | info compressing plugin into [wazuh-2.6.0.zip]
runner | info cleaning up compression temporary artifacts
runner | Done in 499.52s.
runner exited with code 0
Done in 500.90s.
[vagrant@localhost wazuh-kibana-app]$ ls build/
wazuh-2.6.0.zip 🟢 Run the jest tests using the dockerized runner through yarn test:jest:runner[vagrant@localhost wazuh-kibana-app]$ yarn test:jest:runner
yarn run v1.22.19
$ node scripts/runner test
APP: osd
VERSION: 2.6.0
REPO: /home/vagrant/wazuh-kibana-app
CMD: test:jest
ARGS: --runInBand
...
runner | Test Suites: 6 skipped, 63 passed, 63 of 69 total
runner | Tests: 36 skipped, 901 passed, 937 total
runner | Snapshots: 37 passed, 37 total
runner | Time: 211.848 s
runner | Ran all test suites.
runner | Done in 214.59s.
runner exited with code 0 |
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.
review:
🟢 code
🟢 test #5305 (comment)
The backport to
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-4.5-7.10 4.5-7.10
# Navigate to the new working tree
cd .worktrees/backport-4.5-7.10
# Create a new branch
git switch --create backport-5305-to-4.5-7.10
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 c7d97f2d71fbe772541918953e79310d196dce50
# Push it to GitHub
git push --set-upstream origin backport-5305-to-4.5-7.10
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.5-7.10 Then, create a pull request where the |
The backport to
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-4.5-7.16 4.5-7.16
# Navigate to the new working tree
cd .worktrees/backport-4.5-7.16
# Create a new branch
git switch --create backport-5305-to-4.5-7.16
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 c7d97f2d71fbe772541918953e79310d196dce50
# Push it to GitHub
git push --set-upstream origin backport-5305-to-4.5-7.16
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.5-7.16 Then, create a pull request where the |
* Add Dockerized Jest runner * Add possibility to pass Jest CLI options to the runner * Fix buildJestArgs function to actually include default Jest options Duplicated values are also dropped now * Refactor the test runner to allow building packages * Extend documentation of the runner * Formatter and bug fix Fixes a bug where the environment variables were not read * Fix docker compose command * Allow passing additional arguments which do not start with -- --------- Co-authored-by: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> (cherry picked from commit c7d97f2)
* Add Dockerized Jest runner * Add possibility to pass Jest CLI options to the runner * Fix buildJestArgs function to actually include default Jest options Duplicated values are also dropped now * Refactor the test runner to allow building packages * Extend documentation of the runner * Formatter and bug fix Fixes a bug where the environment variables were not read * Fix docker compose command * Allow passing additional arguments which do not start with -- --------- Co-authored-by: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> (cherry picked from commit c7d97f2)
* Add Dockerized Jest runner * Add possibility to pass Jest CLI options to the runner * Fix buildJestArgs function to actually include default Jest options Duplicated values are also dropped now * Refactor the test runner to allow building packages * Extend documentation of the runner * Formatter and bug fix Fixes a bug where the environment variables were not read * Fix docker compose command * Allow passing additional arguments which do not start with -- --------- Co-authored-by: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> (cherry picked from commit c7d97f2)
* Add Dockerized Jest runner * Add possibility to pass Jest CLI options to the runner * Fix buildJestArgs function to actually include default Jest options Duplicated values are also dropped now * Refactor the test runner to allow building packages * Extend documentation of the runner * Formatter and bug fix Fixes a bug where the environment variables were not read * Fix docker compose command * Allow passing additional arguments which do not start with -- --------- Co-authored-by: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> (cherry picked from commit c7d97f2)
Add dockerized yarn runner (#5305) * Add Dockerized Jest runner * Add possibility to pass Jest CLI options to the runner * Fix buildJestArgs function to actually include default Jest options Duplicated values are also dropped now * Refactor the test runner to allow building packages * Extend documentation of the runner * Formatter and bug fix Fixes a bug where the environment variables were not read * Fix docker compose command * Allow passing additional arguments which do not start with -- --------- Co-authored-by: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> (cherry picked from commit c7d97f2)
Add dockerized yarn runner (#5305) * Add Dockerized Jest runner * Add possibility to pass Jest CLI options to the runner * Fix buildJestArgs function to actually include default Jest options Duplicated values are also dropped now * Refactor the test runner to allow building packages * Extend documentation of the runner * Formatter and bug fix Fixes a bug where the environment variables were not read * Fix docker compose command * Allow passing additional arguments which do not start with -- --------- Co-authored-by: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> (cherry picked from commit c7d97f2)
Description
This pull request adds a runner, which essentially is a dockerized environment to run any supported
yarn
command, for example to run the unit tests of the app, or to build it.The runner is meant to be run locally, uses our development images, and its usage is properly documented.
The preferred way to run it is using the Node scripts, which automatically generates the environment. However, the
docker-compose
project can be started directly, in such case, the launch parameters must be provided.Issues Resolved
None
Evidence
Test
Run the runner using the different ways to do it:
Using the script (automatic environment generation):
The information available in the
package.json
is used to generate the environment, such as the platform version. This can be overridden using environment variables. See thedocker-compose.yml
for more information.Check List
yarn test:jest