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

[Website] Website deployment workflow (deploy.yml) is failing due to Node.js 18 version bump in ubuntu-latest GitHub Actions runner image and Webpack usage of md4 hashing algorithm #325

Closed
kevingurney opened this issue Feb 28, 2023 · 8 comments · Fixed by #326
Assignees

Comments

@kevingurney
Copy link
Member

kevingurney commented Feb 28, 2023

Describe the bug, including details regarding any error messages, version, and platform.

See the following comment on apache/arrow#322.

A few weeks ago, the apache/arrow-site deployment workflow (.github/workflows/deploy.yml) started failing with the following output:

.
.
.
npm ci
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1

added [13](https://github.com/apache/arrow-site/actions/runs/4257427943/jobs/7407542742#step:9:14)2 packages, and audited 133 packages in 2s

17 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
npx webpack --mode=production
rm -f javascript/main.js
node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at BulkUpdateDecorator.hashFactory (/home/runner/work/arrow-site/arrow-site/node_modules/webpack/lib/util/createHash.js:[14](https://github.com/apache/arrow-site/actions/runs/4257427943/jobs/7407542742#step:9:15)4:18)
    at BulkUpdateDecorator.update (/home/runner/work/arrow-site/arrow-site/node_modules/webpack/lib/util/createHash.js:46:50)
    at RawSource.updateHash (/home/runner/work/arrow-site/arrow-site/node_modules/webpack-sources/lib/RawSource.js:64:8)
    at NormalModule._initBuildHash (/home/runner/work/arrow-site/arrow-site/node_modules/webpack/lib/NormalModule.js:753:[17](https://github.com/apache/arrow-site/actions/runs/4257427943/jobs/7407542742#step:9:18))
    at handleParseResult (/home/runner/work/arrow-site/arrow-site/node_modules/webpack/lib/NormalModule.js:817:10)
    at /home/runner/work/arrow-site/arrow-site/node_modules/webpack/lib/NormalModule.js:908:4
    at processResult (/home/runner/work/arrow-site/arrow-site/node_modules/webpack/lib/NormalModule.js:640:11)
    at /home/runner/work/arrow-site/arrow-site/node_modules/webpack/lib/NormalModule.js:692:5 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v18.14.1
rake aborted!
Command failed with status (1): [npx webpack --mode=production...]
/home/runner/work/arrow-site/arrow-site/Rakefile:37:in `block in <top (required)>'
/home/runner/work/arrow-site/arrow-site/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/opt/hostedtoolcache/Ruby/3.0.2/x64/bin/bundle:[23](https://github.com/apache/arrow-site/actions/runs/4257427943/jobs/7407542742#step:9:24):in `load'
/opt/hostedtoolcache/Ruby/3.0.2/x64/bin/bundle:23:in `<main>'
Tasks: TOP => generate => javascript/main.js
(See full trace by running task with --trace)
Error: Process completed with exit code 1.

This appears to be related to the use of Webpack by apache/arrow-site and the following issues:

  1. nodejs 17: digital envelope routines::unsupported webpack/webpack#14532 (comment)
  2. Webpack Hash is not FIPS-Compliant webpack/webpack#13572
  3. allow to configure all hash functions used webpack/webpack#14306

My high level understanding is that in Node 18 (the build output above shows Node.js v18.14.1 is being used), the md4 hashing algorithm is deprecated (more specifically, it seems that Node 18 uses OpenSSL 3.0, which has deprecated md4) and the version of Webpack used by apache/arrow-site (v5.21.2) seems to default to using md4.

Webpack v5.61.0 added a WASM md4 implementation as a fallback. However, the advice in webpack/webpack#14532 (comment) recommends setting output.hasFunction in the Webpack config to use an alternative hashing algorithm instead. Specifically, it recommends using xxhash64 (which is planned to be the default hashing algorithm when Webpack 6 is released).

It seems that the version of Node.js in the ubuntu-latest GitHub Actions runner image (used by deploy.yml) was bumped to v18 on Februrary 13, 2023. This would explain why this issue started appearing a few weeks ago.

Workarounds

There are a few different approaches we could pursue to address this issue:

  1. We could choose to pin the version of Node.js used by the GitHub Actions runner to v16 for the actions/setup-node action to work around this issue. Of course, this would mean we would be continuing to rely on an outdated version of Node.js, which doesn't seem ideal in the long term.

  2. We could follow the advice in nodejs 17: digital envelope routines::unsupported webpack/webpack#14532 (comment) and set output.hashFunction in the Webpack config to use an alternative hashing algorithm, like xxhash64.

  3. We could follow the advice of @avantgardnerio in DataFusion Substrait blog post #322 (comment) and move away from relying on the proprietary ubuntu-latest image, which is subject to sudden updates like the Node.js one that caused this issue. Instead, we can use the official ubuntu:latest container image (this is the approach followed by arrow-ballista). ubuntu:latest wouldn't have unexpected library updates, and it would also be possible to run the container image locally for debugging purposes.

Component(s)

Website

@avantgardnerio
Copy link

FWIW, I'm in favor of both 2 & 3: we should control our upgrades and not have them unexpectedly change, but we should also follow a reasonable upgrade cycle and not use outdated cryptographic functions.

That being said, the arrow project in general lacks a surplus of front-end development skills, so it option 3 makes the most sense to me if we only have the resources for 1 of the above.

@kevingurney
Copy link
Member Author

@avantgardnerio - thanks for sharing your thoughts.

I agree - 2 + 3 seems like the optimal solution. As you mentioned, if we are concerned with resourcing, starting with option 3 feels like a good first step which would unblock things in the short term. We could always choose to address 2 in a separate PR when resourcing permits.

@kevingurney
Copy link
Member Author

take

kou referenced this issue Mar 1, 2023
…he/arrow-site website deployment workflow when pushing to master (#323)

# Overview

As part of apache/arrow#31142 and in response to the [recent rename of
the `apache/arrow-site` repository default branch to
`main`](https://issues.apache.org/jira/browse/INFRA-24242), this pull
request removes support for triggering the website deployment workflow
(`.github/workflows/deploy.yml`) on pushes to a branch with the name
"master".

# Qualification

To qualify these changes, I verified that:

1. Pushing these changes to the `main` branch of `mathworks/arrow-site`
[triggered the `deploy.yml` workflow as
expected](https://github.com/mathworks/arrow-site/actions/runs/4296490412/jobs/7488276762).
2. The workflow step "Configure for GitHub Pages on push to main or
master branch" has been renamed to "Configure for GitHub Pages on push
to main branch"
3. The `deploy.yml` is no longer being triggered when commits are pushed
to a branch named "master".

# Future Directions

1. I will follow up with a separate PR to address apache/arrow#20161

# Notes

**Note**: The [CI failures in the Build
step](https://github.com/mathworks/arrow-site/actions/runs/4296490412/jobs/7488276762)
are unrelated to this change. This is a result of apache/arrow#34379,
which is being addressed separately.

Closes apache/arrow#31412.
@jorisvandenbossche jorisvandenbossche transferred this issue from apache/arrow Mar 1, 2023
@kevingurney
Copy link
Member Author

kevingurney commented Mar 1, 2023

A quick status update:

I've been actively working on implementing workaround 3. (run the website deployment workflow inside of an ubuntu:latest container) in the mathworks/arrow-site fork.

However, getting the entire website deployment workflow to run successfully inside of an ubuntu:latest container has turned out to be more complicated than expected due to a variety of differences between the ubuntu-latest and ubuntu:latest environments.

I managed to get the workflow to succeed on the mathworks/arrow-site fork once. However, I had to change a significant portion of the workflow to get this working. Also, the use of apt-get update appears to be slowing the workflow down quite significantly (this might be resolvable through caching, but I have yet to get a chance to explore this).

You can see the history of attempts at getting the workflow running here:

https://github.com/mathworks/arrow-site/actions

Two more important issues I ran into while trying to get the container approach working:

  1. I had to manually create a gh-pages branch before running the workflow.
  2. I had to manually switch the deployment branch to gh-pages in the settings of the mathworks/arrow-site repository.

I suspect that 1. shouldn't be required to get the workflow running. It isn't clear to me at this point why this code was failing to create the gh-pages programmatically.

Also, it seems like README.md for arrow-site could be improved by adding a note that 2. is required when testing on a fork. I can follow up with a PR to address this.

Given the issues / tradeoffs here, it will take some more time to get this working effectively.

To unblock the website deployment for other PRs, we could consider pursuing workaround 1. or 2. described in this issue as short term solutions. I'm open to whatever approach the community prefers.

@kevingurney
Copy link
Member Author

kevingurney commented Mar 1, 2023

Update:

By reverting back a debugging change I accidentally left behind in the Rakefile (I had temporarily changed npm ci to npm install when I was debugging some npm related errors early on), the workflow passed successfully again. I can see that the changes were successfully deployed to https://mathworks.github.io/arrow-site/.

This appears to have also resolved the issue where the workflow was unable to create a gh-pages branch automatically. After deleting the gh-pages branch on mathworks/arrow-site and re-running the workflow, the workflow successfully created a gh-pages branch automatically. That being said, I still had to manually switch the deployment branch to gh-pages in the repository settings.

At this point, it seems like the main issue is reducing the time of the workflow (currently, it takes around 10 minutes) - possibly, through the use of caching.

@kevingurney
Copy link
Member Author

Update:

I've managed to reduce the time of the workflow to around 5 minutes by reverting back to using the setup-node and setup-ruby actions, which have support for caching. I had previously removed these while debugging issues with the container workflow early on.

It would still be great to reduce the workflow time further if possible.

@kevingurney
Copy link
Member Author

Update:

At this point, the only part of the workflow that is adding any significant additional time (around 1 minute) is the call to apt-get update and the installing of dependencies into the container.

@kevingurney
Copy link
Member Author

Update: I've opened pull request #326 to address this issue.

@kevingurney kevingurney changed the title [Website] Website deployment workflow (deploy.yml) is failing due to Node.js 18 version bump inubuntu-latest GitHub Actions runner image and Webpack usage of md4 hashing algorithm [Website] Website deployment workflow (deploy.yml) is failing due to Node.js 18 version bump in ubuntu-latest GitHub Actions runner image and Webpack usage of md4 hashing algorithm Mar 9, 2023
@kou kou closed this as completed in #326 Mar 10, 2023
kou added a commit that referenced this issue Mar 10, 2023
…version of Node.js and Webpack 5.75.0 (#326)

# Overview

This pull request modifies the `apache/arrow-site` website deployment
workflow (`.github/workflows/deploy.yml`) to use the latest LTS version
of Node.js and Webpack 5.75.0 to work around the build issue described
in #325.

# Qualification

To qualify these changes, I:

1. Submitted these changes to the `main` branch of the
`mathworks/arrow-site` fork in order to trigger the `gh-pages`
deployment workflow. I then selected `gh-pages` as the GitHub Pages
deployment branch and verified that the site was deployed as expected to
https://mathworks.github.io/arrow-site/. For an example of a successful
workflow run, see:
https://github.com/mathworks/arrow-site/actions/runs/4313253336/jobs/7524824999.
2. I inspected the GitHub Actions workflow steps to ensure there are no
errors.
 
# Future Directions

1. While qualifying with the [fork deployment
workflow](https://github.com/apache/arrow-site#deployment), I realized
that I needed to [manually change the GitHub Pages deployment
branch](https://docs.github.com/en/pages/quickstart) from `asf-site` to
`gh-pages` in the "Pages" settings of the `mathworks/arrow-site` fork.
This wasn't immediately obvious, and it [isn't listed explicitly as a
required step in the
README.md](https://github.com/apache/arrow-site#deployment) of
`apache/arrow-site`. It would helpful to add an explicit note about this
step. I've captured this as #327 and addressed it with PR #328.
2. As described in the "Workarounds" section of the description of
#325, there is still more we could choose to do to
address the root cause of these build failures (the deprecation of the
`md4` hash algorithm in Node 18). This would include setting the
`output.hashFunction` to `xxhash64` for Webpack.
3. We could move the workflow into a container to make it easier to
reproduce the website build process on a local machine (see the
discussion in the comments on this pull request).

# Notes

1. Thank you @sgilmore10 for your help with this pull request!
2. Thank you to @avantgardnerio for your suggestion to move the
deployment workflow inside of an `ubuntu:latest` container!

Closes #325.

---------

Co-authored-by: Sarah Gilmore <sgilmore@mathworks.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants