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

Bump Node to v18.18.1; Remove puppeteer #7274

Merged
merged 23 commits into from
Oct 13, 2023

Conversation

1Copenut
Copy link
Contributor

@1Copenut 1Copenut commented Oct 10, 2023

Summary

PR captures a few streams of work that are related and easier to consolidate in one changeset:

  1. Bump our EUI Docker container to use node-18-18.0-slim node-18-18.1-slim as the base image. This matches the current downloadable version of Node for general use. A second PR will follow promptly to update EUI to use Node v18.18.0 v18.18.1 for daily work as well.
  2. Remove the yarn add global cypress from our Docker image. This will make upgrading to Cypress 13 easier.
  3. Remove the puppeteer user from our Docker image. Remove the Puppeteer script to check document pages for accessibility. We're using Cypress component tests and will roll new doc page checks using Cypress or Playwright.
  4. Bumps the .nvmrc to use Node v18.18.0 for day to day activities.
  5. BONUS Adds the ability to record video on failing Cypress tests and upload video to Buildkite artifacts.

PR closes #7022

QA

Docker container QA

QA will be verified manually on the Buildkite UI to ensure all tests pass with this new Docker image.

.nvmrc Node QA

This is a two-part process that shouldn't take more than 15-20 minutes.

Part I
Pull the branch locally, then enter the following commands on your terminal:

  • nvm install 18.18.0
  • yarn you may see a Node warning about fsevents optional dependency error. This is b/c of our older Jest dep.
  • yarn lint
  • yarn test-unit
  • yarn test-cypress

Part II
When all of the following tests complete successfully:

  • nvm alias default 18.18.0
  • nvm uninstall 18.17.1

@1Copenut
Copy link
Contributor Author

Buildkite test this

.buildkite/scripts/pipeline_test.sh Show resolved Hide resolved
@@ -32,7 +32,6 @@
"test": "yarn lint && yarn test-unit",
"test-ci": "yarn test && yarn test-cypress",
"test-unit": "node ./scripts/test-unit",
"test-a11y": "node ./scripts/a11y-testing",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the command to call our older Puppeteer tests to run a11y checks against the docs pages. I haven't removed the script because it'll be repurposed with Cypress at some point in the future.

Copy link
Member

@cee-chen cee-chen Oct 10, 2023

Choose a reason for hiding this comment

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

I would strongly rather see us rip it all out now (the script file, the start-test-server-and-a11y-test script, and the @axe-core/puppeteer+puppeteer dependencies.

There's honestly very little chance we'll end up using Puppeteer in the future. We'll likely either use Cypress E2E testing directly to test our docs, or we'll use Playwright instead (since Playwright is more lightweight and actually supports M1 machines).

There's virtually no upside to keeping Puppeteer in our dependencies - it causes issues for devs on arm64 machines and it increases CI load times installing a dependency we're not even using.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Puppeteer, script, and deps should be removed now. I wasn't 💯 that the start-test-server command in the package.json file was specific to Puppeteer, so it stayed in. Happy to remove it if it seems unnecessary.

Copy link
Member

@cee-chen cee-chen Oct 12, 2023

Choose a reason for hiding this comment

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

start-test-server is specific to puppeteer/the a11y script, please nuke it!

Copy link
Member

@cee-chen cee-chen Oct 12, 2023

Choose a reason for hiding this comment

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

I'm also fairly sure we can rip out the webpack-dev-server dependency as well once that's gone; the script is the only thing using it. The wins just keep on coming 🎉 💥

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes on start-test-server but we'll need to keep webpack-dev-server to run yarn start. Adding it back now as I bump the .nvmrc.

Copy link
Member

Choose a reason for hiding this comment

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

Lol fuck I totally missed that webpack serve is powered by webpack-dev-server, I just did a basic grep for the package name 🤦 Sorry!!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey, I missed it too. Adding it back in a jiffy.

@1Copenut 1Copenut marked this pull request as ready for review October 10, 2023 22:09
@1Copenut 1Copenut requested a review from a team as a code owner October 10, 2023 22:09
Comment on lines -47 to -49
&& chown -R pptruser:pptruser /home/pptruser \
&& chown -R pptruser:pptruser /node_modules \
&& chown -R pptruser:pptruser /cypress
Copy link
Member

Choose a reason for hiding this comment

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

I'm not confident this change is 1:1 - in particular -G audio,video seems potentially odd that we've lost it. Do you mind explaining how/why this works, and also pushing up a Cypress test change to fail deliberately so we can ensure that screenshots/artifacts are still captured?

Copy link
Contributor Author

@1Copenut 1Copenut Oct 11, 2023

Choose a reason for hiding this comment

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

I pulled the commands apart this morning with some help from the Linux man pages. To the best of my understanding we're safe to remove the commands as are. the -G audio,video was being used to assign the pptruser to the audio and video groups to enable audio and video recordings.

Cypress does allow video recordings, but the feature is turned off by default. If we want to start video recording in the future, we'd need to add back the -G audio,video to the node user.

I've pushed a commit d606b47 that purposely fails a Cypress test. The should output a screenshot Docker image captures screenshots and they're uploaded by the Buildkite runner under the Artifacts tab.

Copy link
Member

Choose a reason for hiding this comment

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

Cypress does allow video recordings, but the feature is turned off by default. If we want to start video recording in the future, we'd need to add back the -G audio,video to the node user.

Let's do that pre-emptively please. I'd like the ability to quickly set Cypress in CI to emit videos for easier debugging if necessary via cypress.json without having to know linux/docker settings or getting confused as to why no videos are being output.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@1Copenut 1Copenut changed the title [CHORE] Bumping Docker to use node-18.18.0-slim base image. [CHORE] Bump Docker and .nvmrc to use Node v18.18.0 Oct 11, 2023
@cee-chen
Copy link
Member

cee-chen commented Oct 12, 2023

🎉 🎉 This is looking really fantastic - thank you Trevor! Really excited for this cleanup. Can we do one more thing to test the video behavior:

  1. In a [REVERT ME] commit, deliberately make any test fail, then update cypress.config.ts to set video: true
  2. Wait for buildkite tests to finish running and confirm that both a screenshot and video were uploaded and are viewable for debugging purposes
  3. Revert the commit again

Once the above steps are complete, let's go ahead and merge away on this PR!

@1Copenut 1Copenut changed the title [CHORE] Bump Docker and .nvmrc to use Node v18.18.0 [CHORE] Bump Docker and .nvmrc to use Node v18.18.1 Oct 12, 2023
@1Copenut
Copy link
Contributor Author

Once the above steps are complete, let's go ahead and merge away on this PR!

I ran a quick test with a failing spec and verified the video is being created and added to Buildkite artifacts. That's the good news. The bad news is Cypress 12 doesn't allow me to only keep videos of failing tests, so we had a lot of MP4s in that last run.

Cypress 13 has an official solution for only keeping failing test runs, so I'll be sure to include that change with work to bump us to v13.3.

package.json Outdated Show resolved Hide resolved
@cee-chen cee-chen changed the title [CHORE] Bump Docker and .nvmrc to use Node v18.18.1 Bump Node to v18.18.1; Remove puppeteer Oct 13, 2023
Copy link
Member

@cee-chen cee-chen 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 bearing with me on feedback rounds Trevor - this is an enormously wonderful cleanup!

@kibanamachine
Copy link

Preview staging links for this PR:

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @1Copenut

@1Copenut 1Copenut merged commit 2de79ad into elastic:main Oct 13, 2023
7 checks passed
@1Copenut 1Copenut deleted the chore/docker-node-18.18.0 branch October 13, 2023 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Tech debt] Remove Puppeteer and old a11y tests
4 participants