-
Notifications
You must be signed in to change notification settings - Fork 522
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
npm_package: version placeholder sometimes not populated properly #1219
Comments
The `build-packages-dist` script does not seem to work on MacOS because the `cp --no-preserve` flag is not supported by default. This commit switches to a simple `chmod` call in order to make it work in all Bash environments. Additionally the script has been updated to clean previous `npm_package` outputs. This ensures that the version placeholder is properly replaced in the release output. This is necessary due to a bug in `rules_nodejs`. Read more here: bazel-contrib/rules_nodejs#1219
The `build-packages-dist` script does not seem to work on MacOS because the `cp --no-preserve` flag is not supported by default. This commit switches to a simple `chmod` call in order to make it work in all Bash environments. Additionally the script has been updated to clean previous `npm_package` outputs. This ensures that the version placeholder is properly replaced in the release output. This is necessary due to a bug in `rules_nodejs`. Read more here: bazel-contrib/rules_nodejs#1219
The `build-packages-dist` script does not seem to work on MacOS because the `cp --no-preserve` flag is not supported by default. This commit switches to a simple `chmod` call in order to make it work in all Bash environments. Additionally the script has been updated to clean previous `npm_package` outputs. This ensures that the version placeholder is properly replaced in the release output. This is necessary due to a bug in `rules_nodejs`. Read more here: bazel-contrib/rules_nodejs#1219
It's subtle - see a good writeup bazelbuild/bazel#4842 I always write release scripts with Maybe you're proposing that we stop using Bazel's stamping mechanism altogether and do something like |
@alexeagle Maybe I miss something, but my idea was that we just use the non-volatile stamping file and add it as an action input. That way, if one value of the stable keys changes, the
This can be achieved by using |
@devversion I should have listened to you! Yes the stable-version file |
This fixes a long-standing issue where the project version is emitted as a volatile key in stamping. This means that everytime a new version is put into `package.json`, the NPM package will not be rebuilt if it has been built previously. This is the typical source of outdated NPM package artifacts where the package version is accidentally still the old one. The Bazel idiomatic fix is to use a `STABLE_` stamping key so that Bazel will properly re-build dependent targets whenever the version changes. Ideally as part of larger future Bazel refactorings we would also make sure that only necessary target configurations depend on the stable status key file. Currently `ng_package`/`pkg_npm` always depends on it, even if there is no subsitution dependency on actual stable keys. bazel-contrib/rules_nodejs#1219 (comment) Angular currently always wipes the cached artifact exactly to workaround this issue. Previously it even built completely from scatch, dismissing all of the previously cached artifacts.
This fixes a long-standing issue where the project version is emitted as a volatile key in stamping. This means that everytime a new version is put into `package.json`, the NPM package will not be rebuilt if it has been built previously. This is the typical source of outdated NPM package artifacts where the package version is accidentally still the old one. The Bazel idiomatic fix is to use a `STABLE_` stamping key so that Bazel will properly re-build dependent targets whenever the version changes. Ideally as part of larger future Bazel refactorings we would also make sure that only necessary target configurations depend on the stable status key file. Currently `ng_package`/`pkg_npm` always depends on it, even if there is no subsitution dependency on actual stable keys. bazel-contrib/rules_nodejs#1219 (comment) Angular currently always wipes the cached artifact exactly to workaround this issue. Previously it even built completely from scatch, dismissing all of the previously cached artifacts.
This fixes a long-standing issue where the project version is emitted as a volatile key in stamping. This means that everytime a new version is put into `package.json`, the NPM package will not be rebuilt if it has been built previously. This is the typical source of outdated NPM package artifacts where the package version is accidentally still the old one. The Bazel idiomatic fix is to use a `STABLE_` stamping key so that Bazel will properly re-build dependent targets whenever the version changes. Ideally as part of larger future Bazel refactorings we would also make sure that only necessary target configurations depend on the stable status key file. Currently `ng_package`/`pkg_npm` always depends on it, even if there is no subsitution dependency on actual stable keys. bazel-contrib/rules_nodejs#1219 (comment) Angular currently always wipes the cached artifact exactly to workaround this issue. Previously it even built completely from scatch, dismissing all of the previously cached artifacts.
🐞 bug report
Affected Rule
npm_package
Is this a regression?
No
Description
Currently the version placeholder in the
npm_package
is populated by retrieving the version through a volatile stamp variable called:BUILD_SCM_VERSION
.This is not ideal because whenever the version changes, the
npm_package
targets are not re-built. Causing the old version to be part of thenpm_package
output.Ideally the version placeholder would be a stable/non-volatile stamp variable that will cause the
npm_package
targets to be rebuilt if the version changes. Since this happens rarely and intentionally causes the version to be updated, it sounds like a reasonable solution.Read more about stamp variables here: https://docs.bazel.build/versions/master/user-manual.html#flag--workspace_status_command
The text was updated successfully, but these errors were encountered: