[Bug]: Setting ASPECT_RULES_JS_DISABLE_UPDATE_PNPM_LOCK
disables update_pnpm_lock
until repo generated by npm_translate_lock
is deleted
#1925
Labels
bug
Something isn't working
What happened?
I recently configured my repo to set
update_pnpm_lock = True
in mynpm_translate_lock()
call inMODULE.bazel
following all of the instructions described here: https://docs.aspect.build/rulesets/aspect_rules_js/docs/pnpm/#update_pnpm_lockI am setting the
ASPECT_RULES_JS_DISABLE_UPDATE_PNPM_LOCK
environment variable to1
in my CI environment generally, so that only a specific CI job/step reports if the pnpm lock file is outdated as described at the above link:However, I noticed that once Bazel has been run with the
ASPECT_RULES_JS_DISABLE_UPDATE_PNPM_LOCK
environment variable set, further invocations of Bazel will no longer respectupdate_pnpm_lock = True
(i.e. if yourpnpm-lock.yaml
file is outdated then Bazel won't runpnpm install ...
to update it nor fail if you setASPECT_RULES_JS_FROZEN_PNPM_LOCK=1
), even if I completely unset theASPECT_RULES_JS_DISABLE_UPDATE_PNPM_LOCK
environment variable (not just empty it but completely remove it from the environment, e.g. usingenv --unset=ASPECT_RULES_JS_DISABLE_UPDATE_PNPM_LOCK bazel build ...
).Interestingly the opposite direction works as desired, so if
ASPECT_RULES_JS_DISABLE_UPDATE_PNPM_LOCK=1
has never been set then Bazel respectsupdate_pnpm_lock = True
, but then once you do setASPECT_RULES_JS_DISABLE_UPDATE_PNPM_LOCK=1
thenupdate_pnpm_lock
will be disabled.Version
Development (host) and target OS/architectures:
Output of
bazel --version
:Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file:Via
MODULE.bazel
,1.42.3
from BCRLanguage(s) and/or frameworks involved:
TypeScript, but maybe N/A to this issue
How to reproduce
No response
Any other information?
I'm currently using the following workaround in the specific CI job step that I want to check if the pnpm lock file is outdated, by deleting the repo generated by
npm_translate_lock
and then shutting down the Bazel server so that the nextbazel
invocation will recreate it but this time withupdate_pnpm_lock = True
being respected as long as I also unsetASPECT_RULES_JS_DISABLE_UPDATE_PNPM_LOCK
:I'm wondering if
rules_js
may need to use this feature of Bazel to declare more formally that it's sensitive to theASPECT_RULES_JS_DISABLE_UPDATE_PNPM_LOCK
environment variable: bazelbuild/bazel#19511I'm not sure
rules_js
is currently doing that either via theenviron
attribute of therepository_rule
:rules_js/npm/private/npm_translate_lock.bzl
Lines 146 to 149 in f0c67a2
Nor using the
repository_ctx
'sget_env()
method (insteadrctx.os.environ
appears to be used directly):rules_js/npm/private/npm_translate_lock_state.bzl
Lines 569 to 571 in f0c67a2
The text was updated successfully, but these errors were encountered: