-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
build: add crypto check to markdown lint target #21326
Conversation
Currently, if configured --without-ssl the following error will be repored by remark-cli: Running Markdown linter on misc docs... internal/util.js:100 throw new ERR_NO_CRYPTO(); ^ Error [ERR_NO_CRYPTO]: Node.js is not compiled with OpenSSL crypto support at assertCrypto (internal/util.js:100:11) at crypto.js:31:1 at NativeModule.compile (internal/bootstrap/loaders.js:235:7) at Function.NativeModule.require (internal/bootstrap/loaders.js:155:18) at Function.Module._load (internal/modules/cjs/loader.js:530:25) at Module.require (internal/modules/cjs/loader.js:650:17) at require (internal/modules/cjs/helpers.js:20:18) at Object.<anonymous> (/node/tools/remark-cli/node_modules/math-random/node.js:1:76) at Module._compile (internal/modules/cjs/loader.js:702:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10) make[1]: *** [tools/.miscmdlintstamp] Error 1 make: *** [lint] Error 2 This commit adds a check for crypto to avoid this error when node has been configured without crypto support. The alternative was to try to fix this in randomatic but that lead to another dependency failing (uuid) and felt like this might be simpler.
Makefile
Outdated
@@ -1048,9 +1048,13 @@ LINT_MD_DOC_FILES = $(shell ls doc/**/*.md) | |||
run-lint-doc-md = tools/remark-cli/cli.js -q -f $(LINT_MD_DOC_FILES) | |||
# Lint all changed markdown files under doc/ | |||
tools/.docmdlintstamp: $(LINT_MD_DOC_FILES) | |||
ifeq ("$(HAS_CRYPTO)", "true") |
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.
Slightly more idiomatic: ifeq ($(HAS_CRYPTO),true)
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.
I'll update this shortly.
configure
Outdated
@@ -1517,6 +1517,7 @@ config = { | |||
'BUILDTYPE': 'Debug' if options.debug else 'Release', | |||
'PYTHON': sys.executable, | |||
'NODE_TARGET_TYPE': variables['node_target_type'], | |||
'HAS_CRYPTO': variables['node_use_openssl'], |
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.
I'd call this NODE_USE_OPENSSL
for consistency with NODE_TARGET_TYPE
(and also grep -i
greppability.)
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.
I'll change this as well. Thanks
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.
So this is causing the linter jobs (both on Travis and the CI) to skip doc linting:
https://travis-ci.com/nodejs/node/jobs/129356058
https://ci.nodejs.org/blue/rest/organizations/jenkins/pipelines/node-linter/runs/27/nodes/25/log/?start=0
$ NODE=$(which node) make lint-ci
Running JS linter...
Running C++ linter...
Total errors found: 0
Skipping Markdown linter on misc docs (no crypto)
Skipping Markdown linter on docs (no crypto)
The lint jobs use an existing Node.js binary.
I’ll take a look. Thanks
tors 14 juni 2018 kl. 16:04 skrev Richard Lau <notifications@github.com>:
… ***@***.**** requested changes on this pull request.
So this is causing the linter jobs (both on Travis and the CI) to skip doc
linting:
https://travis-ci.com/nodejs/node/jobs/129356058
https://ci.nodejs.org/blue/rest/organizations/jenkins/pipelines/node-linter/runs/27/nodes/25/log/?start=0
$ NODE=$(which node) make lint-ci
Running JS linter...
Running C++ linter...
Total errors found: 0
Skipping Markdown linter on misc docs (no crypto)
Skipping Markdown linter on docs (no crypto)
The lint jobs use an existing Node.js binary.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#21326 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAaY37nWro8IZq3zR22qwb8lA-dcSLL2ks5t8m1ygaJpZM4UnZs4>
.
|
The lint task my be run without configure being run in which case there will be no config.mk. The value is set to true as this would be the most common configuration I think.
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.
Travis linter now works: https://travis-ci.com/nodejs/node/jobs/129401932
@richardlau I think I'm looking at the correct log and it looks like it is not skipping anymore. |
Makefile
Outdated
@@ -1048,9 +1049,13 @@ LINT_MD_DOC_FILES = $(shell ls doc/**/*.md) | |||
run-lint-doc-md = tools/remark-cli/cli.js -q -f $(LINT_MD_DOC_FILES) | |||
# Lint all changed markdown files under doc/ | |||
tools/.docmdlintstamp: $(LINT_MD_DOC_FILES) | |||
ifeq ($(NODE_USE_OPENSSL),true) |
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.
Since this step anyway requires an existing node
binary, why not simply test @$(call available-node,"-p require('crypto')")
. Then you can remove all the other "breadcrumbs".
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.
Or -p process.config.variables.node_use_openssl
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.
Good point, it would be safer to do that as the existing node
binary might have been compiled without openssl (might not be the common case but could happen). I'll take a look and update. Thanks
This commit checks the node environment to determine if openssl (crypto) support if available.
@refack Would you be able to take a look at the latest commit and see what you think? Thanks |
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.
💯
/CC @nodejs/build-files |
Landed in 6ced651. |
Currently, if configured --without-ssl the following error will be repored by remark-cli: Running Markdown linter on misc docs... internal/util.js:100 throw new ERR_NO_CRYPTO(); ^ Error [ERR_NO_CRYPTO]: Node.js is not compiled with OpenSSL crypto support at assertCrypto (internal/util.js:100:11) at crypto.js:31:1 at NativeModule.compile (internal/bootstrap/loaders.js:235:7) at Function.NativeModule.require (internal/bootstrap/loaders.js:155:18) at Function.Module._load (internal/modules/cjs/loader.js:530:25) at Module.require (internal/modules/cjs/loader.js:650:17) at require (internal/modules/cjs/helpers.js:20:18) at Object.<anonymous> (/node/tools/remark-cli/node_modules/math-random/node.js:1:76) at Module._compile (internal/modules/cjs/loader.js:702:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10) make[1]: *** [tools/.miscmdlintstamp] Error 1 make: *** [lint] Error 2 This commit adds a check for crypto to avoid this error when node has been configured without crypto support. The alternative was to try to fix this in randomatic but that lead to another dependency failing (uuid) and felt like this might be simpler. PR-URL: #21326 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Currently, if configured --without-ssl the following error will be repored by remark-cli: Running Markdown linter on misc docs... internal/util.js:100 throw new ERR_NO_CRYPTO(); ^ Error [ERR_NO_CRYPTO]: Node.js is not compiled with OpenSSL crypto support at assertCrypto (internal/util.js:100:11) at crypto.js:31:1 at NativeModule.compile (internal/bootstrap/loaders.js:235:7) at Function.NativeModule.require (internal/bootstrap/loaders.js:155:18) at Function.Module._load (internal/modules/cjs/loader.js:530:25) at Module.require (internal/modules/cjs/loader.js:650:17) at require (internal/modules/cjs/helpers.js:20:18) at Object.<anonymous> (/node/tools/remark-cli/node_modules/math-random/node.js:1:76) at Module._compile (internal/modules/cjs/loader.js:702:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10) make[1]: *** [tools/.miscmdlintstamp] Error 1 make: *** [lint] Error 2 This commit adds a check for crypto to avoid this error when node has been configured without crypto support. The alternative was to try to fix this in randomatic but that lead to another dependency failing (uuid) and felt like this might be simpler. PR-URL: #21326 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Currently, if configured
--without-ssl
the following error will berepored by remark-cli:
This commit adds a check for crypto to avoid this error when node has
been configured without crypto support. The alternative was to try to
fix this in randomatic but that lead to another dependency failing
(uuid) and felt like this might be simpler.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes